# Path: pootle/legacy/jToolkit/sparse.py
# def stringeval(input):
# def stringquote(input):
# def findall(src, substr):
#   def __init__(self, parser, message, tokennum):
#   def __init__(self, defaulttokenlist=None, whitespacechars=" \t\r\n", includewhitespacetokens=0):
#   def stringtokenize(self, input):
#   def keeptogether(self, input):
#   def isstringtoken(self, input):
#   def separatetokens(self, input, tokenlist = None):
#   def removewhitespace(self, input):
#   def applytokenizer(self, inputlist, tokenizer):
#   def applytokenizers(self, inputlist, tokenizers):
#   def tokenize(self, source, tokenizers=None):
#   def refreshposcache(self):
#   def findtokenpos(self, tokennum):
#   def getlinepos(self, tokenpos):
#   def raiseerror(self, message, tokennum):
# class ParserError(ValueError):
# class SimpleParser:


from pootle.legacy.jToolkit import sparse
import os
import sys
  import sys
  import pickle
  def removekey(self, key):
    """remove the given key from the prefs tree. no node removal yet"""
    if key in self.__root__._assignments:
      del self.__root__._assignments[key]
    parent = self.__root__
    keyparts = key.split(".")
    for keypart in keyparts[:-1]:
      if not parent.__dict__.has_key(keypart):
        raise ValueError("key %s not found: %s has no child %s" % (key, parent.__key__, keypart))
      parent = parent.__dict__[keypart]
    attribname = keyparts[-1]
    if attribname in parent.__dict__:
      deadnode = parent.__dict__[attribname]
      if isinstance(deadnode, PrefNode):
        for childkey in deadnode.__dict__.keys():
          if childkey not in ("__root__", "__key__", "__base__"):
            self.removekey(key + "." + childkey)
      del parent.__dict__[attribname]
    else:
      raise ValueError("key %s not found: %s has no child %s" % (key, parent.__key__, attribname))
    self.removals[key] = True

  def parsevalue(self, value):
    """Parses a value set in a config file, and returns the correct object type"""
    if not isinstance(value, (str, unicode)):
      return value
    # If it's a string, try to parse it
    if (value.isdigit()):
      return int(value)
    elif (value[0] in ['"',"'"] and value[-1] == value[0]):

# Path: pootle/legacy/jToolkit/sparse.py
# def stringeval(input):
# def stringquote(input):
# def findall(src, substr):
#   def __init__(self, parser, message, tokennum):
#   def __init__(self, defaulttokenlist=None, whitespacechars=" \t\r\n", includewhitespacetokens=0):
#   def stringtokenize(self, input):
#   def keeptogether(self, input):
#   def isstringtoken(self, input):
#   def separatetokens(self, input, tokenlist = None):
#   def removewhitespace(self, input):
#   def applytokenizer(self, inputlist, tokenizer):
#   def applytokenizers(self, inputlist, tokenizers):
#   def tokenize(self, source, tokenizers=None):
#   def refreshposcache(self):
#   def findtokenpos(self, tokennum):
#   def getlinepos(self, tokenpos):
#   def raiseerror(self, message, tokennum):
# class ParserError(ValueError):
# class SimpleParser:


# Path: pootle/legacy/jToolkit/prefs.py
from pootle.legacy.jToolkit import sparse
import os
import sys
  import sys
  import pickle

  def removekey(self, key):
    """remove the given key from the prefs tree. no node removal yet"""
    if key in self.__root__._assignments:
      del self.__root__._assignments[key]
    parent = self.__root__
    keyparts = key.split(".")
    for keypart in keyparts[:-1]:
      if not parent.__dict__.has_key(keypart):
        raise ValueError("key %s not found: %s has no child %s" % (key, parent.__key__, keypart))
      parent = parent.__dict__[keypart]
    attribname = keyparts[-1]
    if attribname in parent.__dict__:
      deadnode = parent.__dict__[attribname]
      if isinstance(deadnode, PrefNode):
        for childkey in deadnode.__dict__.keys():
          if childkey not in ("__root__", "__key__", "__base__"):
            self.removekey(key + "." + childkey)
      del parent.__dict__[attribname]
    else:
      raise ValueError("key %s not found: %s has no child %s" % (key, parent.__key__, attribname))
    self.removals[key] = True

  def parsevalue(self, value):
    """Parses a value set in a config file, and returns the correct object type"""
    if not isinstance(value, (str, unicode)):
      return value
    # If it's a string, try to parse it
    if (value.isdigit()):
      return int(value)
    elif (value[0] in ['"',"'"] and value[-1] == value[0]):

      return sparse.stringeval(value)