home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / simplejson / __init__.pyo (.txt) next >
Encoding:
Python Compiled Bytecode  |  2011-10-05  |  2.6 KB  |  62 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. __version__ = '2.0.6'
  5. __all__ = [
  6.     'dump',
  7.     'dumps',
  8.     'load',
  9.     'loads',
  10.     'JSONDecoder',
  11.     'JSONEncoder']
  12. from decoder import JSONDecoder
  13. from encoder import JSONEncoder
  14. _default_encoder = JSONEncoder(skipkeys = False, ensure_ascii = True, check_circular = True, allow_nan = True, indent = None, separators = None, encoding = 'utf-8', default = None)
  15.  
  16. def dump(obj, fp, skipkeys = False, ensure_ascii = True, check_circular = True, allow_nan = True, cls = None, indent = None, separators = None, encoding = 'utf-8', default = None, **kw):
  17.     if skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and not kw:
  18.         iterable = _default_encoder.iterencode(obj)
  19.     elif cls is None:
  20.         cls = JSONEncoder
  21.     
  22.     iterable = cls(skipkeys = skipkeys, ensure_ascii = ensure_ascii, check_circular = check_circular, allow_nan = allow_nan, indent = indent, separators = separators, encoding = encoding, default = default, **kw).iterencode(obj)
  23.     for chunk in iterable:
  24.         fp.write(chunk)
  25.     
  26.  
  27.  
  28. def dumps(obj, skipkeys = False, ensure_ascii = True, check_circular = True, allow_nan = True, cls = None, indent = None, separators = None, encoding = 'utf-8', default = None, use_speedups = True, **kw):
  29.     if skipkeys is False and ensure_ascii is True and check_circular is True and allow_nan is True and cls is None and indent is None and separators is None and encoding == 'utf-8' and default is None and use_speedups is True and not kw:
  30.         return _default_encoder.encode(obj)
  31.     if cls is None:
  32.         cls = JSONEncoder
  33.     
  34.     return cls(skipkeys = skipkeys, ensure_ascii = ensure_ascii, check_circular = check_circular, allow_nan = allow_nan, indent = indent, separators = separators, encoding = encoding, default = default, use_speedups = use_speedups, **kw).encode(obj)
  35.  
  36. _default_decoder = JSONDecoder(encoding = None, object_hook = None)
  37.  
  38. def load(fp, encoding = None, cls = None, object_hook = None, parse_float = None, parse_int = None, parse_constant = None, **kw):
  39.     return loads(fp.read(), encoding = encoding, cls = cls, object_hook = object_hook, parse_float = parse_float, parse_int = parse_int, parse_constant = parse_constant, **kw)
  40.  
  41.  
  42. def loads(s, encoding = None, cls = None, object_hook = None, parse_float = None, parse_int = None, parse_constant = None, **kw):
  43.     if cls is None and encoding is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and not kw:
  44.         return _default_decoder.decode(s)
  45.     if cls is None:
  46.         cls = JSONDecoder
  47.     
  48.     if object_hook is not None:
  49.         kw['object_hook'] = object_hook
  50.     
  51.     if parse_float is not None:
  52.         kw['parse_float'] = parse_float
  53.     
  54.     if parse_int is not None:
  55.         kw['parse_int'] = parse_int
  56.     
  57.     if parse_constant is not None:
  58.         kw['parse_constant'] = parse_constant
  59.     
  60.     return cls(encoding = encoding, **kw).decode(s)
  61.  
  62.