PK:{|6“×2EGG-INFO/zip-safe PKJ¦C8woY ññEGG-INFO/SOURCES.txtLICENSE.txt ez_setup.py setup.cfg setup.py docs/class-simplejson.JSONDecoder.html docs/class-simplejson.JSONEncoder.html docs/class_to_source.js docs/index.html docs/layout.css docs/module-index.html docs/module-simplejson-index.html docs/module-simplejson.html docs/pudge.css docs/rst.css docs/simplejson/__init__.py.html docs/simplejson/decoder.py.html docs/simplejson/encoder.py.html docs/simplejson/jsonfilter.py.html docs/simplejson/scanner.py.html scripts/bench.sh scripts/make_docs.py scripts/prof.py simplejson/__init__.py simplejson/_speedups.c simplejson/decoder.py simplejson/encoder.py simplejson/jsonfilter.py simplejson/scanner.py simplejson.egg-info/PKG-INFO simplejson.egg-info/SOURCES.txt simplejson.egg-info/dependency_links.txt simplejson.egg-info/entry_points.txt simplejson.egg-info/native_libs.txt simplejson.egg-info/top_level.txt simplejson.egg-info/zip-safe simplejson/tests/__init__.py simplejson/tests/test_attacks.py simplejson/tests/test_dump.py simplejson/tests/test_fail.py simplejson/tests/test_float.py simplejson/tests/test_indent.py simplejson/tests/test_pass1.py simplejson/tests/test_pass2.py simplejson/tests/test_pass3.py simplejson/tests/test_recursion.py simplejson/tests/test_separators.py simplejson/tests/test_unicode.py PKI¦C8D÷ƒOAAEGG-INFO/entry_points.txt[paste.filter_app_factory] json = simplejson.jsonfilter:factory PKW¦C8ñ9²YEGG-INFO/native_libs.txtsimplejson/_speedups.so PKI¦C8“×2EGG-INFO/dependency_links.txt PKI¦C8°2†¸¸EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: simplejson Version: 1.7.3 Summary: Simple, fast, extensible JSON encoder/decoder for Python Home-page: http://undefined.org/python/#simplejson Author: Bob Ippolito Author-email: bob@redivi.com License: MIT License Description: simplejson is a simple, fast, complete, correct and extensible JSON encoder and decoder for Python 2.3+. It is pure Python code with no dependencies, but includes an optional C extension for a serious speed boost. simplejson was formerly known as simple_json, but changed its name to comply with PEP 8 module naming guidelines. The encoder may be subclassed to provide serialization in any kind of situation, without any special support by the objects to be serialized (somewhat like pickle). The decoder can handle incoming JSON strings of any specified encoding (UTF-8 by default). Platform: any Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules PKI¦C8 ¦ÎÆ EGG-INFO/top_level.txtsimplejson PKQ¦C8öï’Õà6à6simplejson/encoder.pyo;ò wÌGc@sXdZdkZydklZWnej o eZnXeidƒZeidƒZhdd<dd<d d <d d <d d<dd<dd<dd encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s__init__sdefaultsencodes iterencodes, s: sutf-8c Cso||_||_||_||_||_||_d|_|t j o|\|_ |_ n||_ dS(sf Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. iN( sskipkeyssselfs ensure_asciischeck_circulars allow_nans sort_keyssindentscurrent_indent_levels separatorssNonesitem_separators key_separatorsencoding( sselfsskipkeyss ensure_asciischeck_circulars allow_nans sort_keyssindents separatorssencoding((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys__init__ps(        cCsdd|i|iSdS(Ns s (sselfsindentscurrent_indent_level(sself((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys_newline_indent¥sc csB| o dVdSn|tj o7t|ƒ}||jotdƒ‚n|||          ccs| o dVdSn|tj o7t|ƒ}||jotdƒ‚n|||>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}' sutf-8sN(s isinstancesos basestringsstrsselfsencodings _encodingsNones _need_utf8sdecodesencode_basestring_asciislists iterencodeschunkssjoin(sselfsos _encodingschunks((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pysencodeNs "cCs.|io h}nt}|i||ƒSdS(sô Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) N(sselfscheck_circularsmarkerssNones _iterencodeso(sselfsosmarkers((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys iterencodecs   (s__name__s __module__s__doc__s__all__sitem_separators key_separatorsFalsesTruesNones__init__s_newline_indents_iterencode_lists_iterencode_dicts _iterencodes_iterencode_defaultsdefaultsencodes iterencode(((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys JSONEncoderPs !5  ! G &   (s__doc__sres simplejsons _speedupss ImportErrorsNonescompilesESCAPEs ESCAPE_ASCIIs ESCAPE_DCTsrangesis setdefaultschrsfloatsINFINITYsTruesfloatstrsencode_basestringsencode_basestring_asciis _need_utf8sAttributeErrorsFalsesobjects JSONEncoders__all__( sfloatstrs _need_utf8s ESCAPE_ASCIIs__all__sESCAPEsres _speedupssINFINITYsencode_basestring_asciis ESCAPE_DCTs JSONEncodersisencode_basestring((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys?s.  N !       ÿ$PKfR5 ÿÎÉÙÙsimplejson/scanner.py""" Iterator based sre token scanner """ import sre_parse, sre_compile, sre_constants from sre_constants import BRANCH, SUBPATTERN from re import VERBOSE, MULTILINE, DOTALL import re __all__ = ['Scanner', 'pattern'] FLAGS = (VERBOSE | MULTILINE | DOTALL) class Scanner(object): def __init__(self, lexicon, flags=FLAGS): self.actions = [None] # combine phrases into a compound pattern s = sre_parse.Pattern() s.flags = flags p = [] for idx, token in enumerate(lexicon): phrase = token.pattern try: subpattern = sre_parse.SubPattern(s, [(SUBPATTERN, (idx + 1, sre_parse.parse(phrase, flags)))]) except sre_constants.error: raise p.append(subpattern) self.actions.append(token) p = sre_parse.SubPattern(s, [(BRANCH, (None, p))]) self.scanner = sre_compile.compile(p) def iterscan(self, string, idx=0, context=None): """ Yield match, end_idx for each match """ match = self.scanner.scanner(string, idx).match actions = self.actions lastend = idx end = len(string) while True: m = match() if m is None: break matchbegin, matchend = m.span() if lastend == matchend: break action = actions[m.lastindex] if action is not None: rval, next_pos = action(m, context) if next_pos is not None and next_pos != matchend: # "fast forward" the scanner matchend = next_pos match = self.scanner.scanner(string, matchend).match yield rval, matchend lastend = matchend def pattern(pattern, flags=FLAGS): def decorator(fn): fn.pattern = pattern fn.regex = re.compile(pattern, flags) return fn return decorator PKQ¦C8TÞæk-k-simplejson/decoder.pyo;ò ·ÖüEc@sdZdkZdklZlZeieiBeiBZd„Z e ƒ\Z Z Z d„Z ed„Zhde <de <de <d e<d e<d e decoder Performs the following translations in decoding: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. s__init__sdecodes raw_decodecCs||_||_dS(s‰ ``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). N(sencodingsselfs object_hook(sselfsencodings object_hook((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys__init__ås  cCs|i|d||dƒiƒƒ\}}|||ƒiƒ}|t|ƒjo%ttd||t|ƒƒƒ‚n|SdS(s‚ Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) sidxis Extra dataN( sselfs raw_decodesss_wsendsobjslens ValueErrorserrmsg(sselfsss_wsendsobj((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pysdecodeös *%cKse|id|ƒy%|ii||iƒ\}}Wnt j ot dƒ‚nX||fSdS(sT Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. scontextsNo JSON object could be decodedN( skws setdefaultsselfs_scannersiterscansssnextsobjsends StopIterations ValueError(sselfssskwsobjsend((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys raw_decodes%( s__name__s __module__s__doc__sScannersANYTHINGs_scanners__all__sNones__init__s WHITESPACEsmatchsdecodes raw_decode(((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys JSONDecoderÄs   ($s__doc__sressimplejson.scannersScannerspatternsVERBOSEs MULTILINEsDOTALLsFLAGSs_floatconstantssNaNsPosInfsNegInfslinecolsNoneserrmsgsTruesFalses _CONSTANTSs JSONConstants JSONNumberscompiles STRINGCHUNKs BACKSLASHsDEFAULT_ENCODINGsmatchs scanstrings JSONStrings WHITESPACEs JSONObjects JSONArraysANYTHINGs JSONScannersobjects JSONDecoders__all__(s JSONDecodersNegInfs _CONSTANTSs__all__slinecolspatterns JSONConstantsNaNs BACKSLASHsres JSONScanners scanstringsFLAGSsPosInfs WHITESPACEs STRINGCHUNKs JSONStringsScannersANYTHINGs JSONArrays JSONObjectsDEFAULT_ENCODINGs_floatconstantsserrmsgs JSONNumber((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys?s6    <  N+ ( MPKµr6®a¬Éˆ"ˆ"simplejson/decoder.py""" Implementation of JSONDecoder """ import re from simplejson.scanner import Scanner, pattern FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL def _floatconstants(): import struct import sys _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') if sys.byteorder != 'big': _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1] nan, inf = struct.unpack('dd', _BYTES) return nan, inf, -inf NaN, PosInf, NegInf = _floatconstants() def linecol(doc, pos): lineno = doc.count('\n', 0, pos) + 1 if lineno == 1: colno = pos else: colno = pos - doc.rindex('\n', 0, pos) return lineno, colno def errmsg(msg, doc, pos, end=None): lineno, colno = linecol(doc, pos) if end is None: return '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos) endlineno, endcolno = linecol(doc, end) return '%s: line %d column %d - line %d column %d (char %d - %d)' % ( msg, lineno, colno, endlineno, endcolno, pos, end) _CONSTANTS = { '-Infinity': NegInf, 'Infinity': PosInf, 'NaN': NaN, 'true': True, 'false': False, 'null': None, } def JSONConstant(match, context, c=_CONSTANTS): return c[match.group(0)], None pattern('(-?Infinity|NaN|true|false|null)')(JSONConstant) def JSONNumber(match, context): match = JSONNumber.regex.match(match.string, *match.span()) integer, frac, exp = match.groups() if frac or exp: res = float(integer + (frac or '') + (exp or '')) else: res = int(integer) return res, None pattern(r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?')(JSONNumber) STRINGCHUNK = re.compile(r'(.*?)(["\\])', FLAGS) BACKSLASH = { '"': u'"', '\\': u'\\', '/': u'/', 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t', } DEFAULT_ENCODING = "utf-8" def scanstring(s, end, encoding=None, _b=BACKSLASH, _m=STRINGCHUNK.match): if encoding is None: encoding = DEFAULT_ENCODING chunks = [] _append = chunks.append begin = end - 1 while 1: chunk = _m(s, end) if chunk is None: raise ValueError( errmsg("Unterminated string starting at", s, begin)) end = chunk.end() content, terminator = chunk.groups() if content: if not isinstance(content, unicode): content = unicode(content, encoding) _append(content) if terminator == '"': break try: esc = s[end] except IndexError: raise ValueError( errmsg("Unterminated string starting at", s, begin)) if esc != 'u': try: m = _b[esc] except KeyError: raise ValueError( errmsg("Invalid \\escape: %r" % (esc,), s, end)) end += 1 else: esc = s[end + 1:end + 5] try: m = unichr(int(esc, 16)) if len(esc) != 4 or not esc.isalnum(): raise ValueError except ValueError: raise ValueError(errmsg("Invalid \\uXXXX escape", s, end)) end += 5 _append(m) return u''.join(chunks), end def JSONString(match, context): encoding = getattr(context, 'encoding', None) return scanstring(match.string, match.end(), encoding) pattern(r'"')(JSONString) WHITESPACE = re.compile(r'\s*', FLAGS) def JSONObject(match, context, _w=WHITESPACE.match): pairs = {} s = match.string end = _w(s, match.end()).end() nextchar = s[end:end + 1] # trivial empty object if nextchar == '}': return pairs, end + 1 if nextchar != '"': raise ValueError(errmsg("Expecting property name", s, end)) end += 1 encoding = getattr(context, 'encoding', None) iterscan = JSONScanner.iterscan while True: key, end = scanstring(s, end, encoding) end = _w(s, end).end() if s[end:end + 1] != ':': raise ValueError(errmsg("Expecting : delimiter", s, end)) end = _w(s, end + 1).end() try: value, end = iterscan(s, idx=end, context=context).next() except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) pairs[key] = value end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 if nextchar == '}': break if nextchar != ',': raise ValueError(errmsg("Expecting , delimiter", s, end - 1)) end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 if nextchar != '"': raise ValueError(errmsg("Expecting property name", s, end - 1)) object_hook = getattr(context, 'object_hook', None) if object_hook is not None: pairs = object_hook(pairs) return pairs, end pattern(r'{')(JSONObject) def JSONArray(match, context, _w=WHITESPACE.match): values = [] s = match.string end = _w(s, match.end()).end() # look-ahead for trivial empty array nextchar = s[end:end + 1] if nextchar == ']': return values, end + 1 iterscan = JSONScanner.iterscan while True: try: value, end = iterscan(s, idx=end, context=context).next() except StopIteration: raise ValueError(errmsg("Expecting object", s, end)) values.append(value) end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 if nextchar == ']': break if nextchar != ',': raise ValueError(errmsg("Expecting , delimiter", s, end)) end = _w(s, end).end() return values, end pattern(r'\[')(JSONArray) ANYTHING = [ JSONObject, JSONArray, JSONString, JSONConstant, JSONNumber, ] JSONScanner = Scanner(ANYTHING) class JSONDecoder(object): """ Simple JSON decoder Performs the following translations in decoding: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. """ _scanner = Scanner(ANYTHING) __all__ = ['__init__', 'decode', 'raw_decode'] def __init__(self, encoding=None, object_hook=None): """ ``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). """ self.encoding = encoding self.object_hook = object_hook def decode(self, s, _w=WHITESPACE.match): """ Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) """ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise ValueError(errmsg("Extra data", s, end, len(s))) return obj def raw_decode(self, s, **kw): """ Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ kw.setdefault('context', self) try: obj, end = self._scanner.iterscan(s, **kw).next() except StopIteration: raise ValueError("No JSON object could be decoded") return obj, end __all__ = ['JSONDecoder'] PKV¦C8&F¿Á>>simplejson/_speedups.pyo;ò so¦Gc@sd„atƒdS(cCsGdk}dk}dk}|itdƒabb|ittƒdS(Ns _speedups.so( ssyss pkg_resourcessimpsresource_filenames__name__s__file__s __bootstrap__s __loader__s load_dynamic(s pkg_resourcesssyssimp((s9build/bdist.darwin-8.0.1-i386/egg/simplejson/_speedups.pys __bootstrap__s N(s __bootstrap__(((s9build/bdist.darwin-8.0.1-i386/egg/simplejson/_speedups.pys?s PKU¦C8&F¿Á>>simplejson/_speedups.pyc;ò so¦Gc@sd„atƒdS(cCsGdk}dk}dk}|itdƒabb|ittƒdS(Ns _speedups.so( ssyss pkg_resourcessimpsresource_filenames__name__s__file__s __bootstrap__s __loader__s load_dynamic(s pkg_resourcesssyssimp((s9build/bdist.darwin-8.0.1-i386/egg/simplejson/_speedups.pys __bootstrap__s N(s __bootstrap__(((s9build/bdist.darwin-8.0.1-i386/egg/simplejson/_speedups.pys?s PKL—B7+§Ks"*"*simplejson/__init__.pyr""" A simple, fast, extensible JSON encoder and decoder JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. simplejson exposes an API familiar to uses of the standard library marshal and pickle modules. Encoding basic Python object hierarchies:: >>> import simplejson >>> simplejson.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print simplejson.dumps("\"foo\bar") "\"foo\bar" >>> print simplejson.dumps(u'\u1234') "\u1234" >>> print simplejson.dumps('\\') "\\" >>> print simplejson.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> simplejson.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson >>> simplejson.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson >>> print simplejson.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson >>> simplejson.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> simplejson.loads('"\\"foo\\bar"') u'"foo\x08ar' >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> simplejson.load(io) [u'streaming API'] Specializing JSON object decoding:: >>> import simplejson >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> simplejson.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) Extending JSONEncoder:: >>> import simplejson >>> class ComplexEncoder(simplejson.JSONEncoder): ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... return simplejson.JSONEncoder.default(self, obj) ... >>> dumps(2 + 1j, cls=ComplexEncoder) '[2.0, 1.0]' >>> ComplexEncoder().encode(2 + 1j) '[2.0, 1.0]' >>> list(ComplexEncoder().iterencode(2 + 1j)) ['[', '2.0', ', ', '1.0', ']'] Note that the JSON produced by this module's default settings is a subset of YAML, so it may be used as a serializer for that as well. """ __version__ = '1.7.3' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONEncoder', ] from decoder import JSONDecoder from encoder import JSONEncoder _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, encoding='utf-8' ) def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', **kw): """ Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder 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 not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', **kw): """ Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. """ # cached encoder 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 not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, encoding=encoding, **kw).encode(obj) _default_decoder = JSONDecoder(encoding=None, object_hook=None) def load(fp, encoding=None, cls=None, object_hook=None, **kw): """ Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ return loads(fp.read(), encoding=encoding, cls=cls, object_hook=object_hook, **kw) def loads(s, encoding=None, cls=None, object_hook=None, **kw): """ Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) to a Python object. If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed and should be decoded to ``unicode`` first. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. """ if cls is None and encoding is None and object_hook is None and not kw: return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook return cls(encoding=encoding, **kw).decode(s) def read(s): """ json-py API compatibility hook. Use loads(s) instead. """ import warnings warnings.warn("simplejson.loads(s) should be used instead of read(s)", DeprecationWarning) return loads(s) def write(obj): """ json-py API compatibility hook. Use dumps(s) instead. """ import warnings warnings.warn("simplejson.dumps(s) should be used instead of write(s)", DeprecationWarning) return dumps(obj) PKM¦C8;ÀþS S simplejson/scanner.pyc;ò Ð[6Ec@s–dZdkZdkZdkZdklZlZdklZlZl Z dkZddgZ eeBe BZ de fd„ƒYZ e d„ZdS(s" Iterator based sre token scanner N(sBRANCHs SUBPATTERN(sVERBOSEs MULTILINEsDOTALLsScannerspatterncBs#tZed„Zded„ZRS(Nc Csòtg|_tiƒ}||_g}x‘t|ƒD]ƒ\}}|i }y5ti|t|dti||ƒffgƒ}Wntij o ‚nX|i|ƒ|ii|ƒq4Wti|tt|ffgƒ}ti|ƒ|_dS(Ni(sNonesselfsactionss sre_parsesPatternsssflagssps enumerateslexiconsidxstokenspatternsphrases SubPatterns SUBPATTERNsparses subpatterns sre_constantsserrorsappendsBRANCHs sre_compilescompilesscanner( sselfslexiconsflagssphrasesidxs subpatternstokenspss((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pys__init__ s       , !iccs|ii||ƒi} |i} |}t|ƒ}xÊt oÂ| ƒ}|t joPn|i ƒ\} } || joPn| |i} | t j o_| ||ƒ\}}|t j o || jo"|} |ii|| ƒi} n|| fVn| }q6WdS(s5 Yield match, end_idx for each match N(sselfsscannersstringsidxsmatchsactionsslastendslensendsTruesmsNonesspans matchbeginsmatchends lastindexsactionscontextsrvalsnext_pos(sselfsstringsidxscontextslastendsendsnext_possrvalsmsactionss matchbeginsactionsmatchendsmatch((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pysiterscan!s*       (s__name__s __module__sFLAGSs__init__sNonesiterscan(((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pysScanner s cs‡‡d†}|SdS(Ncs&ˆ|_tiˆˆƒ|_|SdS(N(spatternsfnsrescompilesflagssregex(sfn(spatternsflags(s7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pys decorator;s (s decorator(spatternsflagss decorator((spatternsflagss7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pyspattern:s(s__doc__s sre_parses sre_compiles sre_constantssBRANCHs SUBPATTERNsresVERBOSEs MULTILINEsDOTALLs__all__sFLAGSsobjectsScannerspattern( sDOTALLsVERBOSEs__all__spatterns sre_constantssFLAGSsres SUBPATTERNs MULTILINEsBRANCHsScanners sre_parses sre_compile((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/scanner.pys?s  .PKQ¦C83/3/simplejson/__init__.pyo;ò ÍGc@sdZdZddddddgZdklZd klZed ed ed ed ede de ddƒZ eeeee e e dd„Z eeeee e e dd„Z ede de ƒZ e e e d„Ze e e d„Zd„Zd„ZdS(s A simple, fast, extensible JSON encoder and decoder JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. simplejson exposes an API familiar to uses of the standard library marshal and pickle modules. Encoding basic Python object hierarchies:: >>> import simplejson >>> simplejson.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print simplejson.dumps("\"foo\bar") "\"foo\bar" >>> print simplejson.dumps(u'\u1234') "\u1234" >>> print simplejson.dumps('\\') "\\" >>> print simplejson.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> simplejson.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson >>> simplejson.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson >>> print simplejson.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson >>> simplejson.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> simplejson.loads('"\\"foo\\bar"') u'"foo\x08ar' >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> simplejson.load(io) [u'streaming API'] Specializing JSON object decoding:: >>> import simplejson >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> simplejson.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) Extending JSONEncoder:: >>> import simplejson >>> class ComplexEncoder(simplejson.JSONEncoder): ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... return simplejson.JSONEncoder.default(self, obj) ... >>> dumps(2 + 1j, cls=ComplexEncoder) '[2.0, 1.0]' >>> ComplexEncoder().encode(2 + 1j) '[2.0, 1.0]' >>> list(ComplexEncoder().iterencode(2 + 1j)) ['[', '2.0', ', ', '1.0', ']'] Note that the JSON produced by this module's default settings is a subset of YAML, so it may be used as a serializer for that as well. s1.7.3sdumpsdumpssloadsloadss JSONDecoders JSONEncoder(s JSONDecoder(s JSONEncodersskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingsutf-8c Ksû|tjo`|tjoS|tjoF|tjo9|tjo,|tjo|tjo| djo| ot i |ƒ} nW|tjo t}n|d|d|d|d|d|d|d| | i |ƒ} x| D]} |i| ƒqàWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. sutf-8sskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingN(sskipkeyssFalses ensure_asciisTruescheck_circulars allow_nansclssNonesindents separatorssencodingskws_default_encoders iterencodesobjsiterables JSONEncoderschunksfpswrite( sobjsfpsskipkeyss ensure_asciischeck_circulars allow_nansclssindents separatorssencodingskwschunksiterable((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysdumpls'p  c KsÙ|tjo`|tjoS|tjoF|tjo9|tjo,|tjo|tjo|djo| ot i |ƒSn|tjo t}n|d|d|d|d|d|d|d|| i |ƒSd S( sy Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. sutf-8sskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingN(sskipkeyssFalses ensure_asciisTruescheck_circulars allow_nansclssNonesindents separatorssencodingskws_default_encodersencodesobjs JSONEncoder( sobjsskipkeyss ensure_asciischeck_circulars allow_nansclssindents separatorssencodingskw((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysdumps¦s%p  s object_hookc Ks)t|iƒd|d|d||SdS(sx Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. sencodingsclss object_hookN(sloadssfpsreadsencodingsclss object_hookskw(sfpsencodingsclss object_hookskw((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysloadÜs cKs|tjo|tjo|tjo| oti|ƒSn|tjo t}n|tj o||d attack '/': '\\/', '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) # assume this produces an infinity on all machines (probably not guaranteed) INFINITY = float('1e66666') def floatstr(o, allow_nan=True): # Check for specials. Note that this type of test is processor- and/or # platform-specific, so do tests which don't depend on the internals. if o != o: text = 'NaN' elif o == INFINITY: text = 'Infinity' elif o == -INFINITY: text = '-Infinity' else: return repr(o) if not allow_nan: raise ValueError("Out of range float values are not JSON compliant: %r" % (o,)) return text def encode_basestring(s): """ Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' def encode_basestring_ascii(s): def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u%04x\\u%04x' % (s1, s2) return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' try: encode_basestring_ascii = _speedups.encode_basestring_ascii _need_utf8 = True except AttributeError: _need_utf8 = False class JSONEncoder(object): """ Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ __all__ = ['__init__', 'default', 'encode', 'iterencode'] item_separator = ', ' key_separator = ': ' def __init__(self, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8'): """ Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent self.current_indent_level = 0 if separators is not None: self.item_separator, self.key_separator = separators self.encoding = encoding def _newline_indent(self): return '\n' + (' ' * (self.indent * self.current_indent_level)) def _iterencode_list(self, lst, markers=None): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst yield '[' if self.indent is not None: self.current_indent_level += 1 newline_indent = self._newline_indent() separator = self.item_separator + newline_indent yield newline_indent else: newline_indent = None separator = self.item_separator first = True for value in lst: if first: first = False else: yield separator for chunk in self._iterencode(value, markers): yield chunk if newline_indent is not None: self.current_indent_level -= 1 yield self._newline_indent() yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(self, dct, markers=None): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' key_separator = self.key_separator if self.indent is not None: self.current_indent_level += 1 newline_indent = self._newline_indent() item_separator = self.item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = self.item_separator first = True if self.ensure_ascii: encoder = encode_basestring_ascii else: encoder = encode_basestring allow_nan = self.allow_nan if self.sort_keys: keys = dct.keys() keys.sort() items = [(k, dct[k]) for k in keys] else: items = dct.iteritems() _encoding = self.encoding _do_decode = (_encoding is not None and not (_need_utf8 and _encoding == 'utf-8')) for key, value in items: if isinstance(key, str): if _do_decode: key = key.decode(_encoding) elif isinstance(key, basestring): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): key = floatstr(key, allow_nan) elif isinstance(key, (int, long)): key = str(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif self.skipkeys: continue else: raise TypeError("key %r is not a string" % (key,)) if first: first = False else: yield item_separator yield encoder(key) yield key_separator for chunk in self._iterencode(value, markers): yield chunk if newline_indent is not None: self.current_indent_level -= 1 yield self._newline_indent() yield '}' if markers is not None: del markers[markerid] def _iterencode(self, o, markers=None): if isinstance(o, basestring): if self.ensure_ascii: encoder = encode_basestring_ascii else: encoder = encode_basestring _encoding = self.encoding if (_encoding is not None and isinstance(o, str) and not (_need_utf8 and _encoding == 'utf-8')): o = o.decode(_encoding) yield encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, (int, long)): yield str(o) elif isinstance(o, float): yield floatstr(o, self.allow_nan) elif isinstance(o, (list, tuple)): for chunk in self._iterencode_list(o, markers): yield chunk elif isinstance(o, dict): for chunk in self._iterencode_dict(o, markers): yield chunk else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o for chunk in self._iterencode_default(o, markers): yield chunk if markers is not None: del markers[markerid] def _iterencode_default(self, o, markers=None): newobj = self.default(o) return self._iterencode(newobj, markers) def default(self, o): """ Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, o) """ raise TypeError("%r is not JSON serializable" % (o,)) def encode(self, o): """ Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks... if isinstance(o, basestring): if isinstance(o, str): _encoding = self.encoding if (_encoding is not None and not (_encoding == 'utf-8' and _need_utf8)): o = o.decode(_encoding) return encode_basestring_ascii(o) # This doesn't pass the iterator directly to ''.join() because it # sucks at reporting exceptions. It's going to do this internally # anyway because it uses PySequence_Fast or similar. chunks = list(self.iterencode(o)) return ''.join(chunks) def iterencode(self, o): """ Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None return self._iterencode(o, markers) __all__ = ['JSONEncoder'] PKU¦C8øâhFr r simplejson/jsonfilter.pyo;ò ghÐCc@s5dkZdkZdefd„ƒYZd„ZdS(Ns JSONFiltercBstZdd„Zd„ZRS(Ns text/x-jsoncCs||_||_dS(N(sappsselfs mime_type(sselfsapps mime_type((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys__init__s c s¾hdd<dg<‰‡d†}|i|d<|iddƒdjo‘|id dƒ|ijoqgi}|id ƒgD]} | o|| ƒq€q€~}|d i t t |ƒŒ} ti| ƒ|d $   (s__name__s __module__s__init__s__call__(((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys JSONFilters cKst||SdS(N(s JSONFiltersappskw(sapps global_confskw((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pysfactory's(s simplejsonscgisobjects JSONFiltersfactory(scgis JSONFilters simplejsonsfactory((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys?s  #PKô4)8˜\ðŒŽŒŽsimplejson/_speedups.soÎúíþ¨…Œ__TEXT__text__TEXT¤ð¤€__picsymbol_stub__TEXT””€__cstring__TEXT   __picsymbolstub2__TEXT@–@€__textcoal_nt__TEXTÖÖ @H__DATA__data__DATA€__dyld__DATA€€__la_sym_ptr2__DATAˆˆ__nl_symbol_ptr__DATA    8__LINKEDIT p Œn 4FÇYBX/usr/lib/libSystem.B.dylibP -¨.ä_ P##$ l. èXÿ°W‹€×ÿàèX‹€ÛÿàU‰åSè ƒì$“‰T$“ïÇD$ôÇD$ ÇD$‰$ènƒÄ$[]ÃU‰åƒì‰]ø‰uü轋u ‹“‹‹F9Ðt‰T$‰$è …Àt‰u‹]ø‹uü‰ì]銋F‹“‡9Ðt‰T$‰$èò…Àt‰u‹]ø‹uü‰ì]é(“㋃ƒ‰T$‹‰$誋]ø‹uü‰ì1À]ÃU‰åWVƒì0‹E‹H‰Mì‰Î‹@ ƒÆÇ$‰Eä‰t$èí1Ò…À‰Eô„ÑH¿‰MèÆ@"ÇEð‹Eì9EðÏMô‰Mà @‰UÜ‹Eð‹Uä‹ ‚Qàƒú^–ƒù\•À!Ш„ƒƒù/•ƒù"•À!Шtq‹Eèˆ ƒÇ‰ñ)ùƒù (ö‹Eà;u܉$Ou܉t$è41Òƒøÿt7‹EôƒÀ‰EèƒEð‹Eì9Eð|†‹EèÆ"ƒÇ‰|$‹}à‰<$èÿ1ÒƒøÿEUôƒÄ0‰Ð^_]ËEè‰|$‰ $‰D$覉Çëuô‰uàë¶U‰åWVSè÷ƒì<‹E‹HƒÀÇ$‰Î‰M܉EԃƉt$è³1Ò…À‰Eä„ÉH¿‰MØÆ@"ÇEà‹EÜ9Eà… @T ‰UЋUÔ‹EྠQàƒú^–ƒù\•À!Ш„„ƒù/•ƒù"•À!Шtr‹E؈ ƒÇ‰ñ)ùƒù(öUä;uЉ$OuЉt$è1Òƒøÿt7‹EäƒÀ‰E؃Eà‹EÜ9Eà|…‹MØuäÆ"ƒÇ‰4$‰|$èÍ1ÒƒøÿEUäƒÄ<‰Ð[^_]Ãù‹E؉|$‰ $‰D$èn‰Çéxÿÿÿ‹Eä‹0ƒî…ö‰0tK“=‹EÜ‹MÔ‰T$‰D$‰ $èX1Ò…À‰Æ.t¤‰$è`ýÿÿ‰E䋃è…À‰t‹Uä뉋F‰4$ÿPëð‹Eä‹x‰$ÿWë§U‰åWVƒì‹u‹E Æ\ƒÆƒ} „ùƒ} ¥ƒ} „’ƒ} uƒ}„_}ÿÿ޹‹M‹E é‰MôÁù áÿ€Í؉ωMÆuÁï ƒÆ‰ñWWƒÆG0ƒÿ ‹} Oˆ9‰ñƒÆ‹}çÁÿƒÿ WWG0O‹} ˆ9‰ñƒÆ‹}çðÁÿƒÿ WWG0O‹} ˆ9‰ñƒÆ‹}ƒçƒÿ G0WWO‹} ˆ9‹Eô%ÿ€Ì܉EÆ>\ƒÆ‹E ÆuƒÆ‹}‰ñƒÆçðÁÿ ƒÿ WWG0O‹} ˆ9‰ñƒÆ‹}çÁÿƒÿ WWG0O‹} ˆ9‰ñƒÆ‹}çðÁÿƒÿ WWG0O‹} ˆ9‰ñƒÆ‹}ƒçG0WWƒÿ O‹} ˆ9ƒÄ‰ð^_]ËE ÆbƒÆëëƒ} …‹þÿÿ‹E Ænëè‹E Ætë߃}"t;ƒ}"ƒ} …cþÿÿ‹} Æ>rëÀƒ}/tƒ}\…Jþÿÿ‹E Æ\ë§‹E Æ/ëž‹E Æ"ë•‹M ÆfëŒencode_basestring_ascii_speedupsfirst argument must be a stringstrictè‘‹Cÿâ€CPéKùÿÿèx‹.ÿâ€.Pé2ùÿÿè_‹ÿâ€PéùÿÿèF‹ÿâ€Péùÿÿè-‹ïÿâ€ïPéçøÿÿè‹Úÿâ€ÚPéÎøÿÿ‹$Ë$Ãencode_basestring_ascii(basestring) -> str ...   ààMf˜±Êld`œ˜”Œˆ/GFG€kG„¸¤„GdÈÂGdÈÙG<èG H`H DÔÈDÖÔD× 5H$ÔÈPH€\H€h}H€îH€ùH€¢V€®V€âÀV€ãÒV€äæV€æúV€è W€éW€Ã3W€FW€€ZW€~lW€|W€‚W€Ñ§W€ƒºW€„ÐW€…æW€†ÿW€ŒX€×+X€‡AX€êRX€cX€åxX€çX€Þ£X€ˆ½X€‰ØX€ŠðX€‹ Y€ŽY€ë3Y€ìGY€í\Y€ÍY€yZ€îŽZ€ï¤Z€ð¶Z€òÉZ€ñÚZ€áìZ€[€[€ ![$DDº D¼ D½= "[Ø D¾N D¿k 4[¤ DÁ| DÖ J[$º m[ ºz[ º ˆ[@º–[$˜DI¤ DR¯ DUµ DS· DUº DV½ DSÄ DVÇ DWÐ DVÔ DW× DZÝ D\à DZå D\è D]ì D^ D_ D`F DdO DfX DkZ Dh] Dk` Dhc Dkg Dlp Dnw D]€ DqŒ Dr– Dv® Db· —[p ª[$I¤ Ç[ IÕ[€Jðÿÿÿå[€ù[€Kìÿÿÿ \@L"\@M1\€Nôÿÿÿ=\€OèÿÿÿJ\€Päÿÿÿ\€ƒ“\€\¤\€`¾\À¯ ¿\@^Ê\À Ë\à€ Ì\à± Í\€Jðÿÿÿ×\€Kìÿÿÿë\@L]@M]€Nôÿÿÿ]€Oèÿÿÿ(]€Päÿÿÿ>]Àº ?]@^J]Àº K]àÖ L]àÖ M]$4DyØ D‚é Dƒì D†ï D…ö D‚ø Dƒû D…þ D† D‡ D† D‡ DŠ DŒ DŠ DŒ" D& DŽC DM Dx D  D¢Š D¦Œ D£ D¦’ D£• D¦™ D§¢ D©© D² D¬¾ D­Á D¬Ä D­Ë D±à D‘ê Dï D” D• D—3 D•7 D—9 D™< DšG D›R N]$yØ g] yu]€zàÿÿÿ]€{Üÿÿÿ“]@|¨]@}·]€~äÿÿÿÃ]€ØÿÿÿÐ]€€Ôÿÿÿà]Àé á]@Žì]ÀI í]ಠî]àã ï]€zàÿÿÿù]€{Üÿÿÿ ^@|"^@}1^€~äÿÿÿ=^€ØÿÿÿJ^€€ÔÿÿÿZ^Àê [^@Žf^Àê g^@“s^À t^àp u^àp v^àp w^$˜Dp D{ D… D*· D,Ä D.Ç D,Ê D-Ó D/ß D-á D.ä D/è D.ë D0î D2 D1 D2 D4( D3- D49 D6K D5P D6V D7h D8v D;} D<‡ D=Š D< D=˜ D?ª D>¯ D?» DAÍ D@Ò DAÞ DCð DBõ DCû DF D#D%,D'5D&TD!mD vD"D$ˆx^$p “^ ž^  ¬^ »^@Ê^@Õ^À~ Ö^€,ôÿÿÿà^ÀÊ á^à€ â^àã^@î^Àï^à‘ð^$$ñ^&· S_€”_&Ì`Ë_€'à_d”C€Ö[€Ú0sÈ‚ÿ“ÿ¤ÿÀÿÏÿáÿûÿ ÿÿ$(+),&$(+),&%*'__dyld_func_lookupdyld_stub_binding_helper__mh_bundle_header___i686.get_pc_thunk.ax___i686.get_pc_thunk.bx_init_speedups_PyErr_SetString_PyExc_TypeError_PyString_FromStringAndSize_PyString_Type_PyType_IsSubtype_PyUnicodeUCS4_DecodeUTF8_PyUnicode_Type_Py_InitModule4__PyString_Resize_NXArgc_NXArgv_PyArg_Parse_PyArg_ParseTuple_PyArg_ParseTupleAndKeywords_PyArg_UnpackTuple_PyArg_VaParse_PyBaseObject_Type_PyBaseString_Type_PyBool_FromLong_PyBool_Type_PyBuffer_FromMemory_PyBuffer_FromObject_PyBuffer_FromReadWriteMemory_PyBuffer_FromReadWriteObject_PyBuffer_New_PyBuffer_Type_PyCFunction_Call_PyCFunction_Fini_PyCFunction_GetFlags_PyCFunction_GetFunction_PyCFunction_GetSelf_PyCFunction_New_PyCFunction_NewEx_PyCFunction_Type_PyCObject_AsVoidPtr_PyCObject_FromVoidPtr_PyCObject_FromVoidPtrAndDesc_PyCObject_GetDesc_PyCObject_Import_PyCObject_Type_PyCallIter_New_PyCallIter_Type_PyCallable_Check_PyCell_Get_PyCell_New_PyCell_Set_PyCell_Type_PyClassMethod_New_PyClassMethod_Type_PyClass_IsSubclass_PyClass_New_PyClass_Type_PyCode_Addr2Line_PyCode_New_PyCode_Type_PyCodec_BackslashReplaceErrors_PyCodec_Decode_PyCodec_Decoder_PyCodec_Encode_PyCodec_Encoder_PyCodec_IgnoreErrors_PyCodec_LookupError_PyCodec_Register_PyCodec_RegisterError_PyCodec_ReplaceErrors_PyCodec_StreamReader_PyCodec_StreamWriter_PyCodec_StrictErrors_PyCodec_XMLCharRefReplaceErrors_PyComplex_AsCComplex_PyComplex_FromCComplex_PyComplex_FromDoubles_PyComplex_ImagAsDouble_PyComplex_RealAsDouble_PyComplex_Type_PyDescr_NewClassMethod_PyDescr_NewGetSet_PyDescr_NewMember_PyDescr_NewMethod_PyDescr_NewWrapper_PyDictIter_Type_PyDictProxy_New_PyDict_Clear_PyDict_Copy_PyDict_DelItem_PyDict_DelItemString_PyDict_GetItem_PyDict_GetItemString_PyDict_Items_PyDict_Keys_PyDict_Merge_PyDict_MergeFromSeq2_PyDict_New_PyDict_Next_PyDict_SetItem_PyDict_SetItemString_PyDict_Size_PyDict_Type_PyDict_Update_PyDict_Values_PyEnum_Type_PyErr_BadArgument_PyErr_BadInternalCall_PyErr_CheckSignals_PyErr_Clear_PyErr_Display_PyErr_ExceptionMatches_PyErr_Fetch_PyErr_Format_PyErr_GivenExceptionMatches_PyErr_NewException_PyErr_NoMemory_PyErr_NormalizeException_PyErr_Occurred_PyErr_Print_PyErr_PrintEx_PyErr_ProgramText_PyErr_Restore_PyErr_SetFromErrno_PyErr_SetFromErrnoWithFilename_PyErr_SetFromErrnoWithFilenameObject_PyErr_SetInterrupt_PyErr_SetNone_PyErr_SetObject_PyErr_SyntaxLocation_PyErr_Warn_PyErr_WarnExplicit_PyErr_WriteUnraisable_PyEval_AcquireLock_PyEval_AcquireThread_PyEval_CallFunction_PyEval_CallMethod_PyEval_CallObject_PyEval_CallObjectWithKeywords_PyEval_EvalCode_PyEval_EvalCodeEx_PyEval_GetBuiltins_PyEval_GetCallStats_PyEval_GetFrame_PyEval_GetFuncDesc_PyEval_GetFuncName_PyEval_GetGlobals_PyEval_GetLocals_PyEval_GetRestricted_PyEval_InitThreads_PyEval_MergeCompilerFlags_PyEval_ReInitThreads_PyEval_ReleaseLock_PyEval_ReleaseThread_PyEval_RestoreThread_PyEval_SaveThread_PyEval_SetProfile_PyEval_SetTrace_PyExc_ArithmeticError_PyExc_AssertionError_PyExc_AttributeError_PyExc_DeprecationWarning_PyExc_EOFError_PyExc_EnvironmentError_PyExc_Exception_PyExc_FloatingPointError_PyExc_FutureWarning_PyExc_IOError_PyExc_ImportError_PyExc_IndentationError_PyExc_IndexError_PyExc_KeyError_PyExc_KeyboardInterrupt_PyExc_LookupError_PyExc_MemoryError_PyExc_MemoryErrorInst_PyExc_NameError_PyExc_NotImplementedError_PyExc_OSError_PyExc_OverflowError_PyExc_OverflowWarning_PyExc_PendingDeprecationWarning_PyExc_ReferenceError_PyExc_RuntimeError_PyExc_RuntimeWarning_PyExc_StandardError_PyExc_StopIteration_PyExc_SyntaxError_PyExc_SyntaxWarning_PyExc_SystemError_PyExc_SystemExit_PyExc_TabError_PyExc_UnboundLocalError_PyExc_UnicodeDecodeError_PyExc_UnicodeEncodeError_PyExc_UnicodeError_PyExc_UnicodeTranslateError_PyExc_UserWarning_PyExc_ValueError_PyExc_Warning_PyExc_ZeroDivisionError_PyFPE_counter_PyFPE_dummy_PyFPE_jbuf_PyFile_AsFile_PyFile_FromFile_PyFile_FromString_PyFile_GetLine_PyFile_Name_PyFile_SetBufSize_PyFile_SetEncoding_PyFile_SoftSpace_PyFile_Type_PyFile_WriteObject_PyFile_WriteString_PyFloat_AsDouble_PyFloat_AsReprString_PyFloat_AsString_PyFloat_AsStringEx_PyFloat_Fini_PyFloat_FromDouble_PyFloat_FromString_PyFloat_Type_PyFrame_BlockPop_PyFrame_BlockSetup_PyFrame_FastToLocals_PyFrame_Fini_PyFrame_LocalsToFast_PyFrame_New_PyFrame_Type_PyFunction_GetClosure_PyFunction_GetCode_PyFunction_GetDefaults_PyFunction_GetGlobals_PyFunction_GetModule_PyFunction_New_PyFunction_SetClosure_PyFunction_SetDefaults_PyFunction_Type_PyGC_Collect_PyGILState_Ensure_PyGILState_GetThisThreadState_PyGILState_Release_PyGrammar_AddAccelerators_PyGrammar_FindDFA_PyGrammar_LabelRepr_PyGrammar_RemoveAccelerators_PyImport_AddModule_PyImport_AppendInittab_PyImport_Cleanup_PyImport_ExecCodeModule_PyImport_ExecCodeModuleEx_PyImport_ExtendInittab_PyImport_FrozenModules_PyImport_GetMagicNumber_PyImport_GetModuleDict_PyImport_Import_PyImport_ImportFrozenModule_PyImport_ImportModule_PyImport_ImportModuleEx_PyImport_Inittab_PyImport_ReloadModule_PyInstance_New_PyInstance_NewRaw_PyInstance_Type_PyInt_AsLong_PyInt_AsUnsignedLongLongMask_PyInt_AsUnsignedLongMask_PyInt_Fini_PyInt_FromLong_PyInt_FromString_PyInt_FromUnicode_PyInt_GetMax_PyInt_Type_PyInterpreterState_Clear_PyInterpreterState_Delete_PyInterpreterState_Head_PyInterpreterState_New_PyInterpreterState_Next_PyInterpreterState_ThreadHead_PyIter_Next_PyListIter_Type_PyList_Append_PyList_AsTuple_PyList_GetItem_PyList_GetSlice_PyList_Insert_PyList_New_PyList_Reverse_PyList_SetItem_PyList_SetSlice_PyList_Size_PyList_Sort_PyList_Type_PyLong_AsDouble_PyLong_AsLong_PyLong_AsLongLong_PyLong_AsUnsignedLong_PyLong_AsUnsignedLongLong_PyLong_AsUnsignedLongLongMask_PyLong_AsUnsignedLongMask_PyLong_AsVoidPtr_PyLong_FromDouble_PyLong_FromLong_PyLong_FromLongLong_PyLong_FromString_PyLong_FromUnicode_PyLong_FromUnsignedLong_PyLong_FromUnsignedLongLong_PyLong_FromVoidPtr_PyLong_Type_PyMapping_Check_PyMapping_GetItemString_PyMapping_HasKey_PyMapping_HasKeyString_PyMapping_Length_PyMapping_SetItemString_PyMapping_Size_PyMarshal_Init_PyMarshal_ReadLastObjectFromFile_PyMarshal_ReadLongFromFile_PyMarshal_ReadObjectFromFile_PyMarshal_ReadObjectFromString_PyMarshal_ReadShortFromFile_PyMarshal_WriteLongToFile_PyMarshal_WriteObjectToFile_PyMarshal_WriteObjectToString_PyMem_Free_PyMem_Malloc_PyMem_Realloc_PyMember_Get_PyMember_GetOne_PyMember_Set_PyMember_SetOne_PyMethod_Class_PyMethod_Fini_PyMethod_Function_PyMethod_New_PyMethod_Self_PyMethod_Type_PyModule_AddIntConstant_PyModule_AddObject_PyModule_AddStringConstant_PyModule_GetDict_PyModule_GetFilename_PyModule_GetName_PyModule_GetWarningsModule_PyModule_New_PyModule_Type_PyNode_AddChild_PyNode_Compile_PyNode_CompileFlags_PyNode_CompileSymtable_PyNode_Free_PyNode_Future_PyNode_New_PyNumber_Absolute_PyNumber_Add_PyNumber_And_PyNumber_Check_PyNumber_Coerce_PyNumber_CoerceEx_PyNumber_Divide_PyNumber_Divmod_PyNumber_Float_PyNumber_FloorDivide_PyNumber_InPlaceAdd_PyNumber_InPlaceAnd_PyNumber_InPlaceDivide_PyNumber_InPlaceFloorDivide_PyNumber_InPlaceLshift_PyNumber_InPlaceMultiply_PyNumber_InPlaceOr_PyNumber_InPlacePower_PyNumber_InPlaceRemainder_PyNumber_InPlaceRshift_PyNumber_InPlaceSubtract_PyNumber_InPlaceTrueDivide_PyNumber_InPlaceXor_PyNumber_Int_PyNumber_Invert_PyNumber_Long_PyNumber_Lshift_PyNumber_Multiply_PyNumber_Negative_PyNumber_Or_PyNumber_Positive_PyNumber_Power_PyNumber_Remainder_PyNumber_Rshift_PyNumber_Subtract_PyNumber_TrueDivide_PyNumber_Xor_PyOS_AfterFork_PyOS_FiniInterrupts_PyOS_GetLastModificationTime_PyOS_InitInterrupts_PyOS_InputHook_PyOS_InterruptOccurred_PyOS_Readline_PyOS_ReadlineFunctionPointer_PyOS_StdioReadline_PyOS_getsig_PyOS_setsig_PyOS_snprintf_PyOS_strtol_PyOS_strtoul_PyOS_vsnprintf_PyObject_AsCharBuffer_PyObject_AsFileDescriptor_PyObject_AsReadBuffer_PyObject_AsWriteBuffer_PyObject_Call_PyObject_CallFunction_PyObject_CallFunctionObjArgs_PyObject_Cmp_main_PyObject_CallMethod_PyObject_CallMethodObjArgs_PyObject_CallObject_PyObject_CheckReadBuffer_PyObject_ClearWeakRefs_PyObject_Compare_PyObject_DelItem_PyObject_DelItemString_PyObject_Dir_PyObject_Free_PyObject_GC_Del_PyObject_GC_Track_PyObject_GC_UnTrack_PyObject_GenericGetAttr_PyObject_GenericSetAttr_PyObject_GetAttr_PyObject_GetAttrString_PyObject_GetItem_PyObject_GetIter_PyObject_HasAttr_PyObject_HasAttrString_PyObject_Hash_PyObject_Init_PyObject_InitVar_PyObject_IsInstance_PyObject_IsSubclass_PyObject_IsTrue_PyObject_Length_PyObject_Malloc_PyObject_Not_PyObject_Print_PyObject_Realloc_PyObject_Repr_PyObject_RichCompare_PyObject_RichCompareBool_PyObject_SelfIter_PyObject_SetAttr_PyObject_SetAttrString_PyObject_SetItem_PyObject_Size_PyObject_Str_PyObject_Type_PyObject_Unicode_PyParser_AddToken_PyParser_Delete_PyParser_New_PyParser_ParseFile_PyParser_ParseFileFlags_PyParser_ParseString_PyParser_ParseStringFlags_PyParser_ParseStringFlagsFilename_PyParser_SetError_PyParser_SimpleParseFile_PyParser_SimpleParseFileFlags_PyParser_SimpleParseString_PyParser_SimpleParseStringFilename_PyParser_SimpleParseStringFlags_PyParser_SimpleParseStringFlagsFilename_PyProperty_Type_PyRange_New_PyRange_Type_PyRun_AnyFile_PyRun_AnyFileEx_PyRun_AnyFileExFlags_PyRun_AnyFileFlags_PyRun_File_PyRun_FileEx_PyRun_FileExFlags_PyRun_FileFlags_PyRun_InteractiveLoop_PyRun_InteractiveLoopFlags_PyRun_InteractiveOne_PyRun_InteractiveOneFlags_PyRun_SimpleFile_PyRun_SimpleFileEx_PyRun_SimpleFileExFlags_PyRun_SimpleString_PyRun_SimpleStringFlags_PyRun_String_PyRun_StringFlags_PySeqIter_New_PySeqIter_Type_PySequence_Check_PySequence_Concat_PySequence_Contains_PySequence_Count_PySequence_DelItem_PySequence_DelSlice_PySequence_Fast_PySequence_GetItem_PySequence_GetSlice_PySequence_In_PySequence_InPlaceConcat_PySequence_InPlaceRepeat_PySequence_Index_PySequence_Length_PySequence_List_PySequence_Repeat_PySequence_SetItem_PySequence_SetSlice_PySequence_Size_PySequence_Tuple_PySlice_GetIndices_PySlice_GetIndicesEx_PySlice_New_PySlice_Type_PyStaticMethod_New_PyStaticMethod_Type_PyString_AsDecodedObject_PyString_AsDecodedString_PyString_AsEncodedObject_PyString_AsEncodedString_PyString_AsString_PyString_AsStringAndSize_PyString_Concat_PyString_ConcatAndDel_PyString_Decode_PyString_DecodeEscape_PyString_Encode_PyString_Fini_PyString_Format_PyString_FromFormat_PyString_FromFormatV_PyString_FromString_PyString_InternFromString_PyString_InternImmortal_PyString_InternInPlace_PyString_Repr_PyString_Size_PyStructSequence_InitType_PyStructSequence_New_PyStructSequence_UnnamedField_PySuper_Type_PySymtableEntry_New_PySymtableEntry_Type_PySymtable_Free_PySys_AddWarnOption_PySys_GetFile_PySys_GetObject_PySys_ResetWarnOptions_PySys_SetArgv_PySys_SetObject_PySys_SetPath_PySys_WriteStderr_PySys_WriteStdout_PyThreadState_Clear_PyThreadState_Delete_PyThreadState_DeleteCurrent_PyThreadState_Get_PyThreadState_GetDict_PyThreadState_New_PyThreadState_Next_PyThreadState_SetAsyncExc_PyThreadState_Swap_PyThread__exit_thread_PyThread_acquire_lock_PyThread_allocate_lock_PyThread_create_key_PyThread_delete_key_PyThread_delete_key_value_PyThread_exit_thread_PyThread_free_lock_PyThread_get_key_value_PyThread_get_thread_ident_PyThread_init_thread_PyThread_release_lock_PyThread_set_key_value_PyThread_start_new_thread_PyToken_OneChar_PyToken_ThreeChars_PyToken_TwoChars_PyTokenizer_Free_PyTokenizer_FromFile_PyTokenizer_FromString_PyTokenizer_Get_PyTraceBack_Here_PyTraceBack_Print_PyTraceBack_Type_PyTupleIter_Type_PyTuple_Fini_PyTuple_GetItem_PyTuple_GetSlice_PyTuple_New_PyTuple_SetItem_PyTuple_Size_PyTuple_Type_PyType_GenericAlloc_PyType_GenericNew_PyType_Ready_PyType_Type_PyUnicodeDecodeError_Create_PyUnicodeDecodeError_GetEncoding_PyUnicodeDecodeError_GetEnd_PyUnicodeDecodeError_GetObject_PyUnicodeDecodeError_GetReason_PyUnicodeDecodeError_GetStart_PyUnicodeDecodeError_SetEnd_PyUnicodeDecodeError_SetReason_PyUnicodeDecodeError_SetStart_PyUnicodeEncodeError_Create_PyUnicodeEncodeError_GetEncoding_PyUnicodeEncodeError_GetEnd_PyUnicodeEncodeError_GetObject_PyUnicodeEncodeError_GetReason_PyUnicodeEncodeError_GetStart_PyUnicodeEncodeError_SetEnd_PyUnicodeEncodeError_SetReason_PyUnicodeEncodeError_SetStart_PyUnicodeTranslateError_Create_PyUnicodeTranslateError_GetEnd_PyUnicodeTranslateError_GetObject_PyUnicodeTranslateError_GetReason_PyUnicodeTranslateError_GetStart_PyUnicodeTranslateError_SetEnd_PyUnicodeTranslateError_SetReason_PyUnicodeTranslateError_SetStart_PyUnicodeUCS4_AsASCIIString_PyUnicodeUCS4_AsCharmapString_PyUnicodeUCS4_AsEncodedString_PyUnicodeUCS4_AsLatin1String_PyUnicodeUCS4_AsRawUnicodeEscapeString_PyUnicodeUCS4_AsUTF16String_PyUnicodeUCS4_AsUTF8String_PyUnicodeUCS4_AsUnicode_PyUnicodeUCS4_AsUnicodeEscapeString_PyUnicodeUCS4_AsWideChar_PyUnicodeUCS4_Compare_PyUnicodeUCS4_Concat_PyUnicodeUCS4_Contains_PyUnicodeUCS4_Count_PyUnicodeUCS4_Decode_PyUnicodeUCS4_DecodeASCII_PyUnicodeUCS4_DecodeCharmap_PyUnicodeUCS4_DecodeLatin1_PyUnicodeUCS4_DecodeRawUnicodeEscape_PyUnicodeUCS4_DecodeUTF16_PyUnicodeUCS4_DecodeUnicodeEscape_PyUnicodeUCS4_Encode_PyUnicodeUCS4_EncodeASCII_PyUnicodeUCS4_EncodeCharmap_PyUnicodeUCS4_EncodeDecimal_PyUnicodeUCS4_EncodeLatin1_PyUnicodeUCS4_EncodeRawUnicodeEscape_PyUnicodeUCS4_EncodeUTF16_PyUnicodeUCS4_EncodeUTF8_PyUnicodeUCS4_EncodeUnicodeEscape_PyUnicodeUCS4_Find_PyUnicodeUCS4_Format_PyUnicodeUCS4_FromEncodedObject_PyUnicodeUCS4_FromObject_PyUnicodeUCS4_FromOrdinal_PyUnicodeUCS4_FromUnicode_PyUnicodeUCS4_FromWideChar_PyUnicodeUCS4_GetDefaultEncoding_PyUnicodeUCS4_GetMax_PyUnicodeUCS4_GetSize_PyUnicodeUCS4_Join_PyUnicodeUCS4_Replace_PyUnicodeUCS4_Resize_PyUnicodeUCS4_SetDefaultEncoding_PyUnicodeUCS4_Split_PyUnicodeUCS4_Splitlines_PyUnicodeUCS4_Tailmatch_PyUnicodeUCS4_Translate_PyUnicodeUCS4_TranslateCharmap_PyUnicode_DecodeUTF7_PyUnicode_EncodeUTF7_PyWeakref_GetObject_PyWeakref_NewProxy_PyWeakref_NewRef_PyWrapperDescr_Type_PyWrapper_New_Py_AddPendingCall_Py_AtExit_Py_BuildValue_Py_CompileString_Py_CompileStringFlags_Py_DebugFlag_Py_DivisionWarningFlag_Py_EndInterpreter_Py_Exit_Py_FatalError_Py_FdIsInteractive_Py_FileSystemDefaultEncoding_Py_Finalize_Py_FindMethod_Py_FindMethodInChain_Py_FlushLine_Py_FrozenFlag_Py_GetArgcArgv_Py_GetBuildInfo_Py_GetCompiler_Py_GetCopyright_Py_GetExecPrefix_Py_GetPath_Py_GetPlatform_Py_GetPrefix_Py_GetProgramFullPath_Py_GetProgramName_Py_GetPythonHome_Py_GetRecursionLimit_Py_GetVersion_Py_IgnoreEnvironmentFlag_Py_Initialize_Py_InteractiveFlag_Py_IsInitialized_Py_Main_Py_MakePendingCalls_Py_NewInterpreter_Py_NoSiteFlag_Py_OptimizeFlag_Py_ReprEnter_Py_ReprLeave_Py_SetProgramName_Py_SetPythonHome_Py_SetRecursionLimit_Py_SymtableString_Py_TabcheckFlag_Py_UnicodeFlag_Py_UniversalNewlineFgets_Py_UniversalNewlineFread_Py_UseClassExceptionsFlag_Py_VaBuildValue_Py_VerboseFlag__PyBuiltin_Init__PyCodec_Lookup__PyErr_BadInternalCall__PyEval_CallTracing__PyEval_SliceIndex__PyExc_Fini__PyExc_Init__PyFloat_Pack4__PyFloat_Pack8__PyFloat_Unpack4__PyFloat_Unpack8__PyFrame_Init__PyGC_Dump__PyGC_generation0__PyGILState_Fini__PyGILState_Init__PyImportHooks_Init__PyImport_DynLoadFiletab__PyImport_Filetab__PyImport_FindExtension__PyImport_Fini__PyImport_FixupExtension__PyImport_GetDynLoadFunc__PyImport_Init__PyImport_Inittab__PyImport_LoadDynamicModule__PyInstance_Lookup__PyInt_Init__PyLong_AsByteArray__PyLong_AsScaledDouble__PyLong_Copy__PyLong_FromByteArray__PyLong_New__PyLong_NumBits__PyLong_Sign__PyModule_Clear__PyOS_GetOpt__PyOS_optarg__PyOS_opterr__PyOS_optind__PyObject_Del__PyObject_Dump__PyObject_GC_Del__PyObject_GC_Malloc__PyObject_GC_New__PyObject_GC_NewVar__PyObject_GC_Resize__PyObject_GC_Track__PyObject_GC_UnTrack__PyObject_GetDictPtr__PyObject_New__PyObject_NewVar__PyObject_SlotCompare__PyParser_Grammar__PyParser_TokenNames__PySequence_IterSearch__PyString_Eq__PyString_FormatLong__Py_Mangle__PyString_Join__PySys_Init__PyThreadState_Current__PyThreadState_GetFrame__PyThread_Started__PyTrash_delete_later__PyTrash_delete_nesting__PyTrash_deposit_object__PyTrash_destroy_chain__PyTuple_Resize__PyType_Lookup__PyUnicodeUCS4_AsDefaultEncodedString__PyUnicodeUCS4_Fini__PyUnicodeUCS4_Init__PyUnicodeUCS4_IsAlpha__PyUnicodeUCS4_IsDecimalDigit__PyUnicodeUCS4_IsDigit__PyUnicodeUCS4_IsLinebreak__PyUnicodeUCS4_IsLowercase__PyUnicodeUCS4_IsNumeric__PyUnicodeUCS4_IsTitlecase__PyUnicodeUCS4_IsUppercase__PyUnicodeUCS4_IsWhitespace__PyUnicodeUCS4_ToDecimalDigit__PyUnicodeUCS4_ToDigit__PyUnicodeUCS4_ToLowercase__PyUnicodeUCS4_ToNumeric__PyUnicodeUCS4_ToTitlecase__PyUnicodeUCS4_ToUppercase__PyUnicode_TypeRecords__PyUnicode_XStrip__PyWeakref_CallableProxyType__PyWeakref_ClearRef__PyWeakref_GetWeakrefCount__PyWeakref_ProxyType__PyWeakref_RefType__Py_CheckInterval__Py_EllipsisObject__Py_HashDouble__Py_HashPointer__Py_NoneStruct__Py_NotImplementedStruct__Py_PackageContext__Py_QnewFlag__Py_ReadyTypes__Py_ReleaseInternedStrings__Py_Ticker__Py_TrueStruct__Py_ZeroStruct__Py_abstract_hack__Py_c_diff__Py_c_neg__Py_c_pow__Py_c_prod__Py_c_quot__Py_c_sum__Py_cobject_hack___darwin_gcc3_preregister_frame_info___progname__cplus_init__mh_execute_header__objcInit_catch_exception_raise_catch_exception_raise_state_catch_exception_raise_state_identity_clock_alarm_reply_do_mach_notify_dead_name_do_mach_notify_no_senders_do_mach_notify_port_deleted_do_mach_notify_send_once_do_seqnos_mach_notify_dead_name_do_seqnos_mach_notify_no_senders_do_seqnos_mach_notify_port_deleted_do_seqnos_mach_notify_send_once_environ_init_codecs_init_sre_init_symtable_initerrno_initgc_initimp_initposix_initsignal_initthread_initxxsubtype_initzipimport_receive_samplesstartdyld__mh_bundle_headerdyld_lazy_symbol_binding_entry_pointdyld_func_lookup_pointer/mnt/gmirror/ports/devel/py-simplejson/work/simplejson-1.7.3/simplejson/_speedups.cgcc2_compiled._pydoc_encode_basestring_ascii_speedups_methods_py_encode_basestring_asciiinit_speedups:F(0,1)=(0,1)void:t(0,1)PyObject:t(0,2)=(0,3)=xs_object:_object:T(0,3)=s8ob_refcnt:(0,4)=r(0,4);-2147483648;2147483647;,0,32;ob_type:(0,5)=*(0,6)=xs_typeobject:,32,32;;int:t(0,4)_typeobject:T(0,6)=s192ob_refcnt:(0,4),0,32;ob_type:(0,5),32,32;ob_size:(0,4),64,32;tp_name:(0,7)=*(0,8)=r(0,8);0;127;,96,32;tp_basicsize:(0,4),128,32;tp_itemsize:(0,4),160,32;tp_dealloc:(0,9)=(0,10)=*(0,11)=f(0,1),192,32;tp_print:(0,12)=(0,13)=*(0,14)=f(0,4),224,32;tp_getattr:(0,15)=(0,16)=*(0,17)=f(0,18)=*(0,2),256,32;tp_setattr:(0,19)=(0,20)=*(0,21)=f(0,4),288,32;tp_compare:(0,22)=(0,23)=*(0,24)=f(0,4),320,32;tp_repr:(0,25)=(0,26)=*(0,27)=f(0,18),352,32;tp_as_number:(0,28)=*(0,29)=(0,30)=s152nb_add:(0,31)=(0,32)=*(0,33)=f(0,18),0,32;nb_subtract:(0,31),32,32;nb_multiply:(0,31),64,32;nb_divide:(0,31),96,32;nb_remainder:(0,31),128,32;nb_divmod:(0,31),160,32;nb_power:(0,34)=(0,35)=*(0,36)=f(0,18),192,32;nb_negative:(0,37)=(0,26),224,32;nb_positive:(0,37),256,32;nb_absolute:(0,37),288,32;nb_nonzero:(0,38)=(0,39)=*(0,40)=f(0,4),320,32;nb_invert:(0,37),352,32;nb_lshift:(0,31),384,32;nb_rshift:(0,31),416,32;nb_and:(0,31),448,32;nb_xor:(0,31),480,32;nb_or:(0,31),512,32;nb_coerce:(0,41)=(0,42)=*(0,43)=f(0,4),544,32;nb_int:(0,37),576,32;nb_long:(0,37),608,32;nb_float:(0,37),640,32;nb_oct:(0,37),672,32;nb_hex:(0,37),704,32;nb_inplace_add:(0,31),736,32;nb_inplace_subtract:(0,31),768,32;nb_inplace_multiply:(0,31),800,32;nb_inplace_divide:(0,31),832,32;nb_inplace_remainder:(0,31),864,32;nb_inplace_power:(0,34),896,32;nb_inplace_lshift:(0,31),928,32;nb_inplace_rshift:(0,31),960,32;nb_inplace_and:(0,31),992,32;nb_inplace_xor:(0,31),1024,32;nb_inplace_or:(0,31),1056,32;nb_floor_divide:(0,31),1088,32;nb_true_divide:(0,31),1120,32;nb_inplace_floor_divide:(0,31),1152,32;nb_inplace_true_divide:(0,31),1184,32;;,384,32;tp_as_sequence:(0,44)=*(0,45)=(0,46)=s40sq_length:(0,38),0,32;sq_concat:(0,31),32,32;sq_repeat:(0,47)=(0,48)=*(0,49)=f(0,18),64,32;sq_item:(0,47),96,32;sq_slice:(0,50)=(0,51)=*(0,52)=f(0,18),128,32;sq_ass_item:(0,53)=(0,54)=*(0,55)=f(0,4),160,32;sq_ass_slice:(0,56)=(0,57)=*(0,58)=f(0,4),192,32;sq_contains:(0,59)=(0,23),224,32;sq_inplace_concat:(0,31),256,32;sq_inplace_repeat:(0,47),288,32;;,416,32;tp_as_mapping:(0,60)=*(0,61)=(0,62)=s12mp_length:(0,38),0,32;mp_subscript:(0,31),32,32;mp_ass_subscript:(0,63)=(0,64)=*(0,65)=f(0,4),64,32;;,448,32;tp_hash:(0,66)=(0,67)=*(0,68)=f(0,69)=r(0,69);-2147483648;2147483647;,480,32;tp_call:(0,34),512,32;tp_str:(0,25),544,32;tp_getattro:(0,70)=(0,32),576,32;tp_setattro:(0,71)=(0,64),608,32;tp_as_buffer:(0,72)=*(0,73)=(0,74)=s16bf_getreadbuffer:(0,75)=(0,76)=*(0,77)=f(0,4),0,32;bf_getwritebuffer:(0,78)=(0,76),32,32;bf_getsegcount:(0,79)=(0,80)=*(0,81)=f(0,4),64,32;bf_getcharbuffer:(0,82)=(0,83)=*(0,84)=f(0,4),96,32;;,640,32;tp_flags:(0,69),672,32;tp_doc:(0,7),704,32;tp_traverse:(0,85)=(0,86)=*(0,87)=f(0,4),736,32;tp_clear:(0,38),768,32;tp_richcompare:(0,88)=(0,89)=*(0,90)=f(0,18),800,32;tp_weaklistoffset:(0,69),832,32;tp_iter:(0,91)=(0,26),864,32;tp_iternext:(0,92)=(0,26),896,32;tp_methods:(0,93)=*(0,94)=xsPyMethodDef:,928,32;tp_members:(0,95)=*(0,96)=xsPyMemberDef:,960,32;tp_getset:(0,97)=*(0,98)=xsPyGetSetDef:,992,32;tp_base:(0,5),1024,32;tp_dict:(0,18),1056,32;tp_descr_get:(0,99)=(0,35),1088,32;tp_descr_set:(0,100)=(0,64),1120,32;tp_dictoffset:(0,69),1152,32;tp_init:(0,101)=(0,64),1184,32;tp_alloc:(0,102)=(0,103)=*(0,104)=f(0,18),1216,32;tp_new:(0,105)=(0,106)=*(0,107)=f(0,18),1248,32;tp_free:(0,108)=(0,109)=*(0,110)=f(0,1),1280,32;tp_is_gc:(0,38),1312,32;tp_bases:(0,18),1344,32;tp_mro:(0,18),1376,32;tp_cache:(0,18),1408,32;tp_subclasses:(0,18),1440,32;tp_weaklist:(0,18),1472,32;tp_del:(0,9),1504,32;;char:t(0,8)destructor:t(0,9)printfunc:t(0,12)getattrfunc:t(0,15)setattrfunc:t(0,19)cmpfunc:t(0,22)reprfunc:t(0,25)PyNumberMethods:t(0,29)binaryfunc:t(0,31)ternaryfunc:t(0,34)unaryfunc:t(0,37)inquiry:t(0,38)coercion:t(0,41)PySequenceMethods:t(0,45)intargfunc:t(0,47)intintargfunc:t(0,50)intobjargproc:t(0,53)intintobjargproc:t(0,56)objobjproc:t(0,59)PyMappingMethods:t(0,61)objobjargproc:t(0,63)hashfunc:t(0,66)long int:t(0,69)getattrofunc:t(0,70)setattrofunc:t(0,71)PyBufferProcs:t(0,73)getreadbufferproc:t(0,75)getwritebufferproc:t(0,78)getsegcountproc:t(0,79)getcharbufferproc:t(0,82)traverseproc:t(0,85)richcmpfunc:t(0,88)getiterfunc:t(0,91)iternextfunc:t(0,92)PyMethodDef:T(0,94)=s16ml_name:(0,7),0,32;ml_meth:(0,111)=(0,32),32,32;ml_flags:(0,4),64,32;ml_doc:(0,7),96,32;;PyGetSetDef:T(0,98)=s20name:(0,7),0,32;get:(0,112)=(0,113)=*(0,114)=f(0,18),32,32;set:(0,115)=(0,116)=*(0,117)=f(0,4),64,32;doc:(0,7),96,32;closure:(0,118)=*(0,1),128,32;;descrgetfunc:t(0,99)descrsetfunc:t(0,100)initproc:t(0,101)allocfunc:t(0,102)newfunc:t(0,105)freefunc:t(0,108)PyCFunction:t(0,111)getter:t(0,112)setter:t(0,115)_ascii_escape_str_ascii_escape_unicodepy_encode_basestring_ascii:f(0,18)self:p(0,18)pystr:p(0,18)pystr:r(0,18)_ascii_escape_charascii_escape_unicode:f(0,18)pystr:p(0,18)i:(0,119)=(0,4)Py_ssize_t:t(0,119)input_chars:(0,119)output_size:r(0,119)chars:r(0,119)rval:(0,18)output:(0,7)input_unicode:(0,120)=*(0,121)=(0,122)=(0,123)=(0,4)Py_UNICODE:t(0,121)wchar_t:t(0,122)__darwin_wchar_t:t(0,123)c:r(0,121)i:(0,119)input_chars:(0,119)output_size:r(0,119)chars:r(0,119)rval:(0,18)output:(0,7)input_unicode:(0,120)c:r(0,121)ascii_escape_str:f(0,18)pystr:p(0,18)i:(0,119)input_chars:(0,119)output_size:r(0,119)chars:r(0,119)rval:(0,18)output:(0,7)input_str:(0,7)c:r(0,121)i:(0,119)input_chars:(0,119)output_size:r(0,119)chars:r(0,119)rval:(0,18)output:(0,7)input_str:(0,7)c:r(0,121)uni:r(0,18)ascii_escape_char:f(0,119)c:p(0,121)output:p(0,7)chars:p(0,119)chars:r(0,119)x:r(0,121)v:(0,121)x:r(0,121)pydoc_encode_basestring_ascii:S(0,124)=ar(0,125)=r(0,125);0000000000000;0037777777777;;0;47;(0,8)long unsigned int:t(0,126)=r(0,126);0000000000000;0037777777777;speedups_methods:S(0,127)=ar(0,125);0;1;(0,128)=(0,94)PyMethodDef:t(0,128)PKP¦C8øâhFr r simplejson/jsonfilter.pyc;ò ghÐCc@s5dkZdkZdefd„ƒYZd„ZdS(Ns JSONFiltercBstZdd„Zd„ZRS(Ns text/x-jsoncCs||_||_dS(N(sappsselfs mime_type(sselfsapps mime_type((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys__init__s c s¾hdd<dg<‰‡d†}|i|d<|iddƒdjo‘|id dƒ|ijoqgi}|id ƒgD]} | o|| ƒq€q€~}|d i t t |ƒŒ} ti| ƒ|d $   (s__name__s __module__s__init__s__call__(((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys JSONFilters cKst||SdS(N(s JSONFiltersappskw(sapps global_confskw((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pysfactory's(s simplejsonscgisobjects JSONFiltersfactory(scgis JSONFilters simplejsonsfactory((s:build/bdist.darwin-8.0.1-i386/egg/simplejson/jsonfilter.pys?s  #PKN¦C83/3/simplejson/__init__.pyc;ò ÍGc@sdZdZddddddgZdklZd klZed ed ed ed ede de ddƒZ eeeee e e dd„Z eeeee e e dd„Z ede de ƒZ e e e d„Ze e e d„Zd„Zd„ZdS(s A simple, fast, extensible JSON encoder and decoder JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. simplejson exposes an API familiar to uses of the standard library marshal and pickle modules. Encoding basic Python object hierarchies:: >>> import simplejson >>> simplejson.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print simplejson.dumps("\"foo\bar") "\"foo\bar" >>> print simplejson.dumps(u'\u1234') "\u1234" >>> print simplejson.dumps('\\') "\\" >>> print simplejson.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> simplejson.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import simplejson >>> simplejson.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import simplejson >>> print simplejson.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4) { "4": 5, "6": 7 } Decoding JSON:: >>> import simplejson >>> simplejson.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> simplejson.loads('"\\"foo\\bar"') u'"foo\x08ar' >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> simplejson.load(io) [u'streaming API'] Specializing JSON object decoding:: >>> import simplejson >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> simplejson.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) Extending JSONEncoder:: >>> import simplejson >>> class ComplexEncoder(simplejson.JSONEncoder): ... def default(self, obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... return simplejson.JSONEncoder.default(self, obj) ... >>> dumps(2 + 1j, cls=ComplexEncoder) '[2.0, 1.0]' >>> ComplexEncoder().encode(2 + 1j) '[2.0, 1.0]' >>> list(ComplexEncoder().iterencode(2 + 1j)) ['[', '2.0', ', ', '1.0', ']'] Note that the JSON produced by this module's default settings is a subset of YAML, so it may be used as a serializer for that as well. s1.7.3sdumpsdumpssloadsloadss JSONDecoders JSONEncoder(s JSONDecoder(s JSONEncodersskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingsutf-8c Ksû|tjo`|tjoS|tjoF|tjo9|tjo,|tjo|tjo| djo| ot i |ƒ} nW|tjo t}n|d|d|d|d|d|d|d| | i |ƒ} x| D]} |i| ƒqàWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the some chunks written to ``fp`` may be ``unicode`` instances, subject to normal Python ``str`` to ``unicode`` coercion rules. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter()``) this is likely to cause an error. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. sutf-8sskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingN(sskipkeyssFalses ensure_asciisTruescheck_circulars allow_nansclssNonesindents separatorssencodingskws_default_encoders iterencodesobjsiterables JSONEncoderschunksfpswrite( sobjsfpsskipkeyss ensure_asciischeck_circulars allow_nansclssindents separatorssencodingskwschunksiterable((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysdumpls'p  c KsÙ|tjo`|tjoS|tjoF|tjo9|tjo,|tjo|tjo|djo| ot i |ƒSn|tjo t}n|d|d|d|d|d|d|d|| i |ƒSd S( sy Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is ``True`` then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is ``False``, then the return value will be a ``unicode`` instance subject to normal Python ``str`` to ``unicode`` coercion rules instead of being escaped to an ASCII ``str``. If ``check_circular`` is ``False``, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is ``False``, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg. sutf-8sskipkeyss ensure_asciischeck_circulars allow_nansindents separatorssencodingN(sskipkeyssFalses ensure_asciisTruescheck_circulars allow_nansclssNonesindents separatorssencodingskws_default_encodersencodesobjs JSONEncoder( sobjsskipkeyss ensure_asciischeck_circulars allow_nansclssindents separatorssencodingskw((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysdumps¦s%p  s object_hookc Ks)t|iƒd|d|d||SdS(sx Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg. sencodingsclss object_hookN(sloadssfpsreadsencodingsclss object_hookskw(sfpsencodingsclss object_hookskw((s8build/bdist.darwin-8.0.1-i386/egg/simplejson/__init__.pysloadÜs cKs|tjo|tjo|tjo| oti|ƒSn|tjo t}n|tj o||d encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s__init__sdefaultsencodes iterencodes, s: sutf-8c Cso||_||_||_||_||_||_d|_|t j o|\|_ |_ n||_ dS(sf Constructor for JSONEncoder, with sensible defaults. If skipkeys is False, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is True, the output is guaranteed to be str objects with all incoming unicode characters escaped. If ensure_ascii is false, the output will be unicode object. If check_circular is True, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is True, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is True, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. iN( sskipkeyssselfs ensure_asciischeck_circulars allow_nans sort_keyssindentscurrent_indent_levels separatorssNonesitem_separators key_separatorsencoding( sselfsskipkeyss ensure_asciischeck_circulars allow_nans sort_keyssindents separatorssencoding((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys__init__ps(        cCsdd|i|iSdS(Ns s (sselfsindentscurrent_indent_level(sself((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys_newline_indent¥sc csB| o dVdSn|tj o7t|ƒ}||jotdƒ‚n|||          ccs| o dVdSn|tj o7t|ƒ}||jotdƒ‚n|||>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo":["bar", "baz"]}' sutf-8sN(s isinstancesos basestringsstrsselfsencodings _encodingsNones _need_utf8sdecodesencode_basestring_asciislists iterencodeschunkssjoin(sselfsos _encodingschunks((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pysencodeNs "cCs.|io h}nt}|i||ƒSdS(sô Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) N(sselfscheck_circularsmarkerssNones _iterencodeso(sselfsosmarkers((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys iterencodecs   (s__name__s __module__s__doc__s__all__sitem_separators key_separatorsFalsesTruesNones__init__s_newline_indents_iterencode_lists_iterencode_dicts _iterencodes_iterencode_defaultsdefaultsencodes iterencode(((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys JSONEncoderPs !5  ! G &   (s__doc__sres simplejsons _speedupss ImportErrorsNonescompilesESCAPEs ESCAPE_ASCIIs ESCAPE_DCTsrangesis setdefaultschrsfloatsINFINITYsTruesfloatstrsencode_basestringsencode_basestring_asciis _need_utf8sAttributeErrorsFalsesobjects JSONEncoders__all__( sfloatstrs _need_utf8s ESCAPE_ASCIIs__all__sESCAPEsres _speedupssINFINITYsencode_basestring_asciis ESCAPE_DCTs JSONEncodersisencode_basestring((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/encoder.pys?s.  N !       ÿ$PKM¦C8TÞæk-k-simplejson/decoder.pyc;ò ·ÖüEc@sdZdkZdklZlZeieiBeiBZd„Z e ƒ\Z Z Z d„Z ed„Zhde <de <de <d e<d e<d e decoder Performs the following translations in decoding: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. s__init__sdecodes raw_decodecCs||_||_dS(s‰ ``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). N(sencodingsselfs object_hook(sselfsencodings object_hook((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys__init__ås  cCs|i|d||dƒiƒƒ\}}|||ƒiƒ}|t|ƒjo%ttd||t|ƒƒƒ‚n|SdS(s‚ Return the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) sidxis Extra dataN( sselfs raw_decodesss_wsendsobjslens ValueErrorserrmsg(sselfsss_wsendsobj((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pysdecodeös *%cKse|id|ƒy%|ii||iƒ\}}Wnt j ot dƒ‚nX||fSdS(sT Decode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. scontextsNo JSON object could be decodedN( skws setdefaultsselfs_scannersiterscansssnextsobjsends StopIterations ValueError(sselfssskwsobjsend((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys raw_decodes%( s__name__s __module__s__doc__sScannersANYTHINGs_scanners__all__sNones__init__s WHITESPACEsmatchsdecodes raw_decode(((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys JSONDecoderÄs   ($s__doc__sressimplejson.scannersScannerspatternsVERBOSEs MULTILINEsDOTALLsFLAGSs_floatconstantssNaNsPosInfsNegInfslinecolsNoneserrmsgsTruesFalses _CONSTANTSs JSONConstants JSONNumberscompiles STRINGCHUNKs BACKSLASHsDEFAULT_ENCODINGsmatchs scanstrings JSONStrings WHITESPACEs JSONObjects JSONArraysANYTHINGs JSONScannersobjects JSONDecoders__all__(s JSONDecodersNegInfs _CONSTANTSs__all__slinecolspatterns JSONConstantsNaNs BACKSLASHsres JSONScanners scanstringsFLAGSsPosInfs WHITESPACEs STRINGCHUNKs JSONStringsScannersANYTHINGs JSONArrays JSONObjectsDEFAULT_ENCODINGs_floatconstantsserrmsgs JSONNumber((s7build/bdist.darwin-8.0.1-i386/egg/simplejson/decoder.pys?s6    <  N+ ( MPKbxŒ4‰Û¯ÞÞ simplejson/tests/test_attacks.pydef test_script_close_attack(): import simplejson res = simplejson.dumps('') assert '' not in res res = simplejson.dumps(simplejson.loads('""')) assert '' not in res PKQ¦C8qÃ4ªª$simplejson/tests/test_separators.pyo;ò Þ³ªEc@s d„ZdS(c Cs¸dk}dk}dgdggdddhdd|tjo|io tgSq*dSntii|ƒdS(Ns TestObject(sos TestObjectsselfsrecurses simplejsons JSONEncodersdefault(sselfso((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pysdefault-s    (s__name__s __module__sFalsesrecursesdefault(((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pysRecursiveJSONEncoder+scCs=tƒ}t|_y|itƒWntj onXdS(N(sRecursiveJSONEncodersencsTruesrecursesencodes TestObjects ValueError(senc((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pystest_defaultrecursion5s  (s simplejsonstest_listrecursionstest_dictrecursions TestObjects JSONEncodersRecursiveJSONEncoderstest_defaultrecursion(sRecursiveJSONEncoders simplejsonstest_listrecursionstest_defaultrecursions TestObjectstest_dictrecursion((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pys?s    PKÔy|6•¦êÔÉÉsimplejson/tests/test_dump.pyfrom cStringIO import StringIO import simplejson as S def test_dump(): sio = StringIO() S.dump({}, sio) assert sio.getvalue() == '{}' def test_dumps(): assert S.dumps({}) == '{}' PKO¦C8Õ­ØØ simplejson/tests/test_indent.pyc;ò Œ³ªEc@s d„ZdS(c Csôdk}dk}dgdggdddhdds ""(s simplejsonsdumpssressAssertionErrorsloads(sress simplejson((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_attacks.pystest_script_close_attacks  N(stest_script_close_attack(stest_script_close_attack((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_attacks.pys?sPKQ¦C8†‚w<ŽŽsimplejson/tests/__init__.pyo;ò •ô¶Cc@sdS(N((((s>build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/__init__.pys?sPKR¦C8" \9‰‰ simplejson/tests/test_indent.pyo;ò Œ³ªEc@s d„ZdS(c Cs¸dk}dk}dgdggdddhdd|tjo|io tgSq*dSntii|ƒdS(Ns TestObject(sos TestObjectsselfsrecurses simplejsons JSONEncodersdefault(sselfso((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pysdefault-s    (s__name__s __module__sFalsesrecursesdefault(((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pysRecursiveJSONEncoder+scCsktƒ}|itƒdjpt‚t|_y|itƒWntj onXtp td‚dS(Ns "TestObject"s,didn't raise ValueError on default recursion( sRecursiveJSONEncodersencsencodes TestObjectsAssertionErrorsTruesrecurses ValueErrorsFalse(senc((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pystest_defaultrecursion5s  (s simplejsonstest_listrecursionstest_dictrecursions TestObjects JSONEncodersRecursiveJSONEncoderstest_defaultrecursion(sRecursiveJSONEncoders simplejsonstest_listrecursionstest_defaultrecursions TestObjectstest_dictrecursion((sDbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_recursion.pys?s    PKeŽ.6s—6óó#simplejson/tests/test_separators.py def test_separators(): import simplejson import textwrap h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', {'nifty': 87}, {'field': 'yes', 'morefield': False} ] expect = textwrap.dedent("""\ [ [ "blorpie" ] , [ "whoops" ] , [] , "d-shtaeou" , "d-nthiouh" , "i-vhbjkhnth" , { "nifty" : 87 } , { "field" : "yes" , "morefield" : false } ]""") d1 = simplejson.dumps(h) d2 = simplejson.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : ')) h1 = simplejson.loads(d1) h2 = simplejson.loads(d2) assert h1 == h assert h2 == h assert d2 == expect PKN¦C8¥é—ç**!simplejson/tests/test_unicode.pyc;ò å¸èEc@sdkZd„Zd„ZdS(NcCs]tiddƒ}d}|idƒ}|i|ƒ}|i|ƒ}||jpt‚dS(Nsencodingsutf-8uαΩ( sSs JSONEncodersencodersusencodesssjusjssAssertionError(sjusssjssusencoder((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pystest_encoding1s cCsWd}|idƒ}ti|ddƒ}ti|ddƒ}||jpt‚dS(NuαΩsutf-8sencoding(susencodesssSsdumpssjusjssAssertionError(sjusssusjs((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pystest_encoding2 s (s simplejsonsSstest_encoding1stest_encoding2(stest_encoding2sSstest_encoding1((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pys?s  PK¤–b6uVµ“áá simplejson/tests/test_unicode.pyimport simplejson as S def test_encoding1(): encoder = S.JSONEncoder(encoding='utf-8') u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' s = u.encode('utf-8') ju = encoder.encode(u) js = encoder.encode(s) assert ju == js def test_encoding2(): u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' s = u.encode('utf-8') ju = S.dumps(u, encoding='utf-8') js = S.dumps(s, encoding='utf-8') assert ju == js PKU‚Ÿ3–mDf””simplejson/tests/test_pass3.py# from http://json.org/JSON_checker/test/pass3.json JSON = r''' { "JSON Test Pattern pass3": { "The outermost value": "must be an object or array.", "In this test": "It is an object." } } ''' def test_parse(): # test in/out equivalence and parsing import simplejson res = simplejson.loads(JSON) out = simplejson.dumps(res) assert res == simplejson.loads(out) PKT‚Ÿ3<`ÆÞ55simplejson/tests/test_pass2.py# from http://json.org/JSON_checker/test/pass2.json JSON = r''' [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] ''' def test_parse(): # test in/out equivalence and parsing import simplejson res = simplejson.loads(JSON) out = simplejson.dumps(res) assert res == simplejson.loads(out) PKO¦C8”°g¶¶simplejson/tests/test_pass3.pyc;ò ³õ¶Cc@sdZd„ZdS(s• { "JSON Test Pattern pass3": { "The outermost value": "must be an object or array.", "In this test": "It is an object." } } cCsHdk}|itƒ}|i|ƒ}||i|ƒjpt‚dS(N(s simplejsonsloadssJSONsressdumpssoutsAssertionError(sress simplejsonsout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass3.pys test_parse s N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass3.pys?s PKS¦C857¼¼simplejson/tests/test_pass1.pyo;ò ¯õ¶Cc@sdZd„ZdS(sm [ "JSON Test Pattern pass1", {"object with 1 member":["array with 1 element"]}, {}, [], -42, true, false, null, { "integer": 1234567890, "real": -9876.543210, "e": 0.123456789e-12, "E": 1.234567890E+34, "": 23456789012E666, "zero": 0, "one": 1, "space": " ", "quote": "\"", "backslash": "\\", "controls": "\b\f\n\r\t", "slash": "/ & \/", "alpha": "abcdefghijklmnopqrstuvwyz", "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", "digit": "0123456789", "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", "true": true, "false": false, "null": null, "array":[ ], "object":{ }, "address": "50 St. James Street", "url": "http://www.JSON.org/", "comment": "// /* */": " ", " s p a c e d " :[1,2 , 3 , 4 , 5 , 6 ,7 ], "compact": [1,2,3,4,5,6,7], "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", "quotes": "" \u0022 %22 0x22 034 "", "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" : "A key can be any string" }, 0.5 ,98.6 , 99.44 , 1066 ,"rosebud"] cCsXdk}|itƒ}|i|ƒ}y|i|dtƒWntj onXdS(Ns allow_nan(s simplejsonsloadssJSONsressdumpssoutsFalses ValueError(s simplejsonsressout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass1.pys test_parse=s N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass1.pys?s;PK8Ž.6"Nf ââsimplejson/tests/test_indent.py def test_indent(): import simplejson import textwrap h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', {'nifty': 87}, {'field': 'yes', 'morefield': False} ] expect = textwrap.dedent("""\ [ [ "blorpie" ], [ "whoops" ], [], "d-shtaeou", "d-nthiouh", "i-vhbjkhnth", { "nifty": 87 }, { "field": "yes", "morefield": false } ]""") d1 = simplejson.dumps(h) d2 = simplejson.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) h1 = simplejson.loads(d1) h2 = simplejson.loads(d2) assert h1 == h assert h2 == h assert d2 == expect PKP¦C8ÒÞÓ`ûûsimplejson/tests/test_float.pyc;ò ßÌGc@s d„ZdS(cCsDdk}x4dgD])}|i|ƒt|ƒjpt‚qWdS(Nf1617161771.7650001(s simplejsonsnumsdumpssreprsAssertionError(snums simplejson((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_float.pys test_floatss  N(s test_floats(s test_floats((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_float.pys?sPKN¦C8cïbf@@simplejson/tests/test_dump.pyc;ò  ¾ Fc@s,dklZdkZd„Zd„ZdS((sStringIONcCs7tƒ}tih|ƒ|iƒdjpt‚dS(Ns{}(sStringIOssiosSsdumpsgetvaluesAssertionError(ssio((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys test_dumps cCs!tihƒdjpt‚dS(Ns{}(sSsdumpssAssertionError(((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys test_dumps s(s cStringIOsStringIOs simplejsonsSs test_dumps test_dumps(s test_dumpsSs test_dumpssStringIO((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys?s   PKQ¦C8Ÿõ¬¸¸simplejson/tests/test_dump.pyo;ò  ¾ Fc@s,dklZdkZd„Zd„ZdS((sStringIONcCstƒ}tih|ƒdS(N(sStringIOssiosSsdump(ssio((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys test_dumps cCsdS(N((((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys test_dumps s(s cStringIOsStringIOs simplejsonsSs test_dumps test_dumps(s test_dumpsSs test_dumpssStringIO((s?build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_dump.pys?s   PKU¦C8$ÿ<©©simplejson/tests/test_fail.pyo;ò i;PDc@ssdddddddddd d d d d ddddddddddgZhdd<dd?", "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", "true": true, "false": false, "null": null, "array":[ ], "object":{ }, "address": "50 St. James Street", "url": "http://www.JSON.org/", "comment": "// /* */": " ", " s p a c e d " :[1,2 , 3 , 4 , 5 , 6 ,7 ], "compact": [1,2,3,4,5,6,7], "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", "quotes": "" \u0022 %22 0x22 034 "", "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" : "A key can be any string" }, 0.5 ,98.6 , 99.44 , 1066 ,"rosebud"] ''' def test_parse(): # test in/out equivalence and parsing import simplejson res = simplejson.loads(JSON) out = simplejson.dumps(res) assert res == simplejson.loads(out) try: simplejson.dumps(res, allow_nan=False) except ValueError: pass else: assert False, "23456789012E666 should be out of range" PKO¦C8ÎÛIƒWWsimplejson/tests/test_pass2.pyc;ò ±õ¶Cc@sdZd„ZdS(s6 [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] cCsHdk}|itƒ}|i|ƒ}||i|ƒjpt‚dS(N(s simplejsonsloadssJSONsressdumpssoutsAssertionError(sress simplejsonsout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass2.pys test_parses N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass2.pys?sPKN¦C8†‚w<ŽŽsimplejson/tests/__init__.pyc;ò •ô¶Cc@sdS(N((((s>build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/__init__.pys?sPK1—B7´rð€€simplejson/tests/test_float.pydef test_floats(): import simplejson for num in [1617161771.7650001]: assert simplejson.dumps(num) == repr(num) PKP¦C8|¸‰6((simplejson/tests/test_pass1.pyc;ò ¯õ¶Cc@sdZd„ZdS(sm [ "JSON Test Pattern pass1", {"object with 1 member":["array with 1 element"]}, {}, [], -42, true, false, null, { "integer": 1234567890, "real": -9876.543210, "e": 0.123456789e-12, "E": 1.234567890E+34, "": 23456789012E666, "zero": 0, "one": 1, "space": " ", "quote": "\"", "backslash": "\\", "controls": "\b\f\n\r\t", "slash": "/ & \/", "alpha": "abcdefghijklmnopqrstuvwyz", "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", "digit": "0123456789", "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", "true": true, "false": false, "null": null, "array":[ ], "object":{ }, "address": "50 St. James Street", "url": "http://www.JSON.org/", "comment": "// /* */": " ", " s p a c e d " :[1,2 , 3 , 4 , 5 , 6 ,7 ], "compact": [1,2,3,4,5,6,7], "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", "quotes": "" \u0022 %22 0x22 034 "", "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" : "A key can be any string" }, 0.5 ,98.6 , 99.44 , 1066 ,"rosebud"] cCs†dk}|itƒ}|i|ƒ}||i|ƒjpt‚y|i|dtƒWntj onXtp td‚dS(Ns allow_nans&23456789012E666 should be out of range( s simplejsonsloadssJSONsressdumpssoutsAssertionErrorsFalses ValueError(s simplejsonsressout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass1.pys test_parse=s N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass1.pys?s;PKQ¦C8Žð+ÜÜ!simplejson/tests/test_unicode.pyo;ò å¸èEc@sdkZd„Zd„ZdS(NcCsItiddƒ}d}|idƒ}|i|ƒ}|i|ƒ}dS(Nsencodingsutf-8uαΩ(sSs JSONEncodersencodersusencodesssjusjs(sjusssjssusencoder((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pystest_encoding1s cCsCd}|idƒ}ti|ddƒ}ti|ddƒ}dS(NuαΩsutf-8sencoding(susencodesssSsdumpssjusjs(sjusssusjs((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pystest_encoding2 s (s simplejsonsSstest_encoding1stest_encoding2(stest_encoding2sSstest_encoding1((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_unicode.pys?s  PKR¦C8Ø:´º''simplejson/tests/test_pass2.pyo;ò ±õ¶Cc@sdZd„ZdS(s6 [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] cCs+dk}|itƒ}|i|ƒ}dS(N(s simplejsonsloadssJSONsressdumpssout(sress simplejsonsout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass2.pys test_parses N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass2.pys?sPKV‚Ÿ3¥¡?”‘‘"simplejson/tests/test_recursion.pyimport simplejson def test_listrecursion(): x = [] x.append(x) try: simplejson.dumps(x) except ValueError: pass else: assert False, "didn't raise ValueError on list recursion" x = [] y = [x] x.append(y) try: simplejson.dumps(x) except ValueError: pass else: assert False, "didn't raise ValueError on alternating list recursion" y = [] x = [y, y] # ensure that the marker is cleared simplejson.dumps(x) def test_dictrecursion(): x = {} x["test"] = x try: simplejson.dumps(x) except ValueError: pass else: assert False, "didn't raise ValueError on dict recursion" x = {} y = {"a": x, "b": x} # ensure that the marker is cleared simplejson.dumps(x) class TestObject: pass class RecursiveJSONEncoder(simplejson.JSONEncoder): recurse = False def default(self, o): if o is TestObject: if self.recurse: return [TestObject] else: return 'TestObject' simplejson.JSONEncoder.default(o) def test_defaultrecursion(): enc = RecursiveJSONEncoder() assert enc.encode(TestObject) == '"TestObject"' enc.recurse = True try: enc.encode(TestObject) except ValueError: pass else: assert False, "didn't raise ValueError on default recursion" PKQ¦C8š5Åû††simplejson/tests/test_pass3.pyo;ò ³õ¶Cc@sdZd„ZdS(s• { "JSON Test Pattern pass3": { "The outermost value": "must be an object or array.", "In this test": "It is an object." } } cCs+dk}|itƒ}|i|ƒ}dS(N(s simplejsonsloadssJSONsressdumpssout(sress simplejsonsout((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass3.pys test_parse s N(sJSONs test_parse(sJSONs test_parse((s@build/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_pass3.pys?s PKQ¦C8 ê²!simplejson/tests/test_attacks.pyo;ò éN=Dc@s d„ZdS(cCs4dk}|idƒ}|i|idƒƒ}dS(Ns s ""(s simplejsonsdumpssressloads(sress simplejson((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_attacks.pystest_script_close_attacks  N(stest_script_close_attack(stest_script_close_attack((sBbuild/bdist.darwin-8.0.1-i386/egg/simplejson/tests/test_attacks.pys?sPKP¦C8ÈuÌ  simplejson/tests/test_fail.pyc;ò i;PDc@ssdddddddddd d d d d ddddddddddgZhdd<dd>¤õšsimplejson/_speedups.pyoPKU¦C8&F¿Á>>¤isimplejson/_speedups.pycPKL—B7+§Ks"*"*¤ÝŸsimplejson/__init__.pyPKM¦C8;ÀþS S ¤3Êsimplejson/scanner.pycPKQ¦C83/3/¤ºÖsimplejson/__init__.pyoPKQ¦C8;ÀþS S ¤"simplejson/scanner.pyoPKU¦C8ò"¤©simplejson/_speedups.pyPKù–B7 Øà2à2¤âsimplejson/encoder.pyPKU¦C8øâhFr r ¤õFsimplejson/jsonfilter.pyoPKô4)8˜\ðŒŽŒŽížQsimplejson/_speedups.soPKP¦C8øâhFr r ¤_àsimplejson/jsonfilter.pycPKN¦C83/3/¤ësimplejson/__init__.pycPKW¼34¦·~~¤psimplejson/jsonfilter.pyPKN¦C8öï’Õà6à6¤$!simplejson/encoder.pycPKM¦C8TÞæk-k-¤8Xsimplejson/decoder.pycPKbxŒ4‰Û¯ÞÞ ¤×…simplejson/tests/test_attacks.pyPKQ¦C8qÃ4ªª$¤ó†simplejson/tests/test_separators.pyoPK¼Ÿ3¤ß‹simplejson/tests/__init__.pyPKU¦C8ÁAVx x #¤Œsimplejson/tests/test_recursion.pyoPKÔy|6•¦êÔÉɤҕsimplejson/tests/test_dump.pyPKO¦C8Õ­ØØ ¤Ö–simplejson/tests/test_indent.pycPKN¦C8ƒse4KK!¤ì›simplejson/tests/test_attacks.pycPKQ¦C8†‚w<ŽŽ¤vžsimplejson/tests/__init__.pyoPKR¦C8" \9‰‰ ¤?Ÿsimplejson/tests/test_indent.pyoPKN¦C8ñ÷µõùù$¤¤simplejson/tests/test_separators.pycPKP¦C8÷=:r  #¤A©simplejson/tests/test_recursion.pycPKeŽ.6s—6óó#¤Š´simplejson/tests/test_separators.pyPKN¦C8¥é—ç**!¤¾·simplejson/tests/test_unicode.pycPK¤–b6uVµ“áá ¤'¼simplejson/tests/test_unicode.pyPKU‚Ÿ3–mDf””¤F¾simplejson/tests/test_pass3.pyPKT‚Ÿ3<`ÆÞ55¤Àsimplejson/tests/test_pass2.pyPKO¦C8”°g¶¶¤‡Ásimplejson/tests/test_pass3.pycPKS¦C857¼¼¤zÄsimplejson/tests/test_pass1.pyoPK8Ž.6"Nf ââ¤sÌsimplejson/tests/test_indent.pyPKP¦C8ÒÞÓ`ûû¤’Ïsimplejson/tests/test_float.pycPKN¦C8cïbf@@¤ÊÑsimplejson/tests/test_dump.pycPKQ¦C8Ÿõ¬¸¸¤FÕsimplejson/tests/test_dump.pyoPKU¦C8$ÿ<©©¤:Øsimplejson/tests/test_fail.pyoPKU¦C82÷i²²¤ßsimplejson/tests/test_float.pyoPKS‚Ÿ3Ì»Yü¤ásimplejson/tests/test_pass1.pyPKO¦C8ÎÛIƒWW¤[èsimplejson/tests/test_pass2.pycPKN¦C8†‚w<ŽŽ¤ïêsimplejson/tests/__init__.pycPK1—B7´rð€€¤¸ësimplejson/tests/test_float.pyPKP¦C8|¸‰6((¤tìsimplejson/tests/test_pass1.pycPKQ¦C8Žð+ÜÜ!¤Ùôsimplejson/tests/test_unicode.pyoPKR¦C8Ø:´º''¤ôøsimplejson/tests/test_pass2.pyoPKV‚Ÿ3¥¡?”‘‘"¤Xûsimplejson/tests/test_recursion.pyPKQ¦C8š5Åû††¤)simplejson/tests/test_pass3.pyoPKQ¦C8 ê²!¤ìsimplejson/tests/test_attacks.pyoPKP¦C8ÈuÌ  ¤;simplejson/tests/test_fail.pycPK¼š4É«€ € ¤ simplejson/tests/test_fail.pyPK>>Û<