ž ¦ÿf°;c@sdZddlZyddlmZWnek r@dZYnXyddlmZWnek rodZYnXej dƒZ ej dƒZ ej dƒZ idd 6d d 6d d 6dd6dd6dd6dd6Z x3edƒD]%Ze jeeƒdjeƒƒqáWedƒZeZdd„Zdd„Zep=eZGdd„deƒZeeeeeee e!e"dd „ Z#dS(!uImplementation of JSONEncoder iN(uencode_basestring_ascii(u make_encoderu[\x00-\x1f\\"\b\f\n\r\t]u([\\"]|[^\ -~])s[€-ÿ]u\\u\u\"u"u\buu\fu u\nu u\ru u\tu i u \u{0:04x}uinfcCs$dd„}dtj||ƒdS(u5Return a JSON representation of a Python string cSst|jdƒS(Ni(u ESCAPE_DCTugroup(umatch((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyureplace%su"encode_basestring..replaceu"(uESCAPEusub(usureplace((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyuencode_basestring!s uencode_basestringcCs$dd„}dtj||ƒdS(uAReturn an ASCII-only JSON representation of a Python string c Ss“|jdƒ}y t|SWnqtk rŽt|ƒ}|dkrPdj|ƒS|d8}d|d?d@B}d|d@B}dj||ƒSYnXdS( Niiu \u{0:04x}iØi iÿiÜu\u{0:04x}\u{1:04x}(ugroupu ESCAPE_DCTuKeyErroruorduformat(umatchusunus1us2((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyureplace.s      u+py_encode_basestring_ascii..replaceu"(u ESCAPE_ASCIIusub(usureplace((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyupy_encode_basestring_ascii*s upy_encode_basestring_asciic Bsq|EeZdZdZdZdZd dddd d d d dd„Z dd„Z dd „Z d d d „Z d S(u JSONEncoderuZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, 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``). u, u: c Css||_||_||_||_||_||_|dk rW|\|_|_n|dk ro||_ ndS(uHConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, 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 non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. 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. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. 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 specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N( uskipkeysu ensure_asciiucheck_circularu allow_nanu sort_keysuindentuNoneuitem_separatoru key_separatorudefault( uselfuskipkeysu ensure_asciiucheck_circularu allow_nanu sort_keysuindentu separatorsudefault((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu__init__bs-        uJSONEncoder.__init__cCstt|ƒdƒ‚dS(ulImplement 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) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) u is not JSON serializableN(u TypeErrorurepr(uselfuo((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyudefaultšsuJSONEncoder.defaultcCsut|tƒr/|jr"t|ƒSt|ƒSn|j|ddƒ}t|ttfƒsht|ƒ}ndj |ƒS(u¦Return a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' u _one_shotuT( u isinstanceustru ensure_asciiuencode_basestring_asciiuencode_basestringu iterencodeuTrueulistutupleujoin(uselfuouchunks((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyuencode¯s   uJSONEncoder.encodec Csï|jri}nd}|jr*t}nt}|jttt dd„}|r©tdk r©|j dkr©t||j ||j |j |j |j |j|jƒ }n9t||j ||j ||j |j |j |j|ƒ }||dƒS(uØEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) cSsl||krd}n4||kr*d}n||kr?d}n ||ƒS|shtdt|ƒƒ‚n|S(NuNaNuInfinityu -Infinityu2Out of range float values are not JSON compliant: (u ValueErrorurepr(uou allow_nanu_repru_infu_neginfutext((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyufloatstr×s       u(JSONEncoder.iterencode..floatstriN(ucheck_circularuNoneu ensure_asciiuencode_basestring_asciiuencode_basestringu allow_nanu FLOAT_REPRuINFINITYuc_make_encoderuindentudefaultu key_separatoruitem_separatoru sort_keysuskipkeysu_make_iterencode(uselfuou _one_shotumarkersu_encoderufloatstru _iterencode((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu iterencodeÄs&    uJSONEncoder.iterencodeNFT( u__name__u __module__u __qualname__u__doc__uitem_separatoru key_separatoruFalseuTrueuNoneu__init__udefaultuencodeu iterencode(u __locals__((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu JSONEncoderCs 6  u JSONEncodercsùˆdk r)ˆˆˆƒ r)dˆ‰n‡‡‡‡‡‡‡‡‡ ‡ ‡‡‡‡‡‡‡fdd†‰‡‡‡‡‡‡‡‡‡ ‡ ‡ ‡ ‡ ‡‡‡‡‡‡‡fdd†‰‡‡‡‡‡‡‡‡ ‡ ‡‡‡‡‡‡‡fdd†‰ˆS(Nu c 3s*|sdVdSˆdk rOˆ |ƒ}|ˆkrBˆdƒ‚n|ˆ|._iterencode_listc 3s|sdVdSˆdk rOˆ |ƒ}|ˆkrBˆdƒ‚n|ˆ|Usu<_make_iterencode.._iterencode_dict..utrueufalseunullukey u is not a stringu}TF(uNoneuTrueusorteduitemsuFalseu TypeErrorurepr( udctu_current_indent_levelumarkeridunewline_indentuitem_separatorufirstuitemsukeyuvalueuchunksuchunk(u ValueErroru_encoderu _floatstru_indentu_item_separatoru _iterencodeu_iterencode_dictu_iterencode_listu_key_separatoru _skipkeysu _sort_keysudictufloatuiduintu isinstanceulistumarkersustrutuple(u1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_iterencode_dictAs„       !                 u*_make_iterencode.._iterencode_dictc3s€ˆ |ˆƒrˆ|ƒVn_|dkr1dVnK|dkrEdVn7|dkrYdVn#ˆ |ˆ ƒrvˆ|ƒVnˆ |ˆƒr“ˆ|ƒVnéˆ |ˆ ˆfƒrÊxш||ƒD] }|Vq¸Wn²ˆ |ˆƒrûx ˆ||ƒD] }|VqéWnˆ dk r;ˆ |ƒ}|ˆ kr.ˆdƒ‚n|ˆ |._iterencode(uNone(umarkersu_defaultu_encoderu_indentu _floatstru_key_separatoru_item_separatoru _sort_keysu _skipkeysu _one_shotu ValueErrorudictufloatuiduintu isinstanceulistustrutuple((u ValueErroru_defaultu_encoderu _floatstru_indentu_item_separatoru _iterencodeu_iterencode_dictu_iterencode_listu_key_separatoru _skipkeysu _sort_keysudictufloatuiduintu isinstanceulistumarkersustrutupleu1/opt/alt/python33/lib64/python3.3/json/encoder.pyu_make_iterencodeûs  B5KL?u_make_iterencode($u__doc__ureu_jsonuencode_basestring_asciiuc_encode_basestring_asciiu ImportErroruNoneu make_encoderuc_make_encoderucompileuESCAPEu ESCAPE_ASCIIuHAS_UTF8u ESCAPE_DCTurangeuiu setdefaultuchruformatufloatuINFINITYurepru FLOAT_REPRuencode_basestringupy_encode_basestring_asciiuobjectu JSONEncoderu ValueErrorudictuiduintu isinstanceulistustrutupleu_make_iterencode(((u1/opt/alt/python33/lib64/python3.3/json/encoder.pyusJ      #   »