ž ¦ÿf›2c@sÈdZddlZddlZddlZddlZddlmZyddlmZ Wne k rtdZ YnXdgZ ej ejBejBZdd„Zeƒ\ZZZdd „Zdd d „Zied 6ed 6ed6ZejdeƒZidd6dd6dd6dd6dd6dd6dd6dd6Zdd„Zd(eejdd „Ze pfeZejd!eƒZd"Z deje d#d$„Z!eje d%d&„Z"Gd'd„de#ƒZ$dS()uImplementation of JSONDecoder iN(uscanner(u scanstringu JSONDecodercCstjdƒ}tjdkrY|dd…ddd…|dd…ddd…}ntjd|ƒ\}}||| fS(Ns 7FF80000000000007FF0000000000000ubigiiuddiÿÿÿÿiÿÿÿÿ(ubinasciiu unhexlifyusysu byteorderustructuunpack(u_BYTESunanuinf((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu_floatconstantss ;u_floatconstantscCsst|tƒrd}nd}|j|d|ƒd}|dkrP|d}n||j|d|ƒ}||fS(Ns u ii(u isinstanceubytesucounturindex(udocuposunewlineulinenoucolno((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyulinecols   ulinecolc Cswt||ƒ\}}|dkr=d}|j||||ƒSt||ƒ\}}d}|j|||||||ƒS(Nu#{0}: line {1} column {2} (char {3})u?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(ulinecoluNoneuformat( umsgudocuposuendulinenoucolnoufmtu endlinenouendcolno((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyuerrmsg)s uerrmsgu -InfinityuInfinityuNaNu(.*?)(["\\\x00-\x1f])u"u\u/uubu ufu unu uru utcCs…||d|d…}t|ƒdkrc|ddkrcyt|dƒSWqctk r_YqcXnd}tt|||ƒƒ‚dS(NiiiuxXiuInvalid \uXXXX escape(ulenuintu ValueErroruerrmsg(usuposuescumsg((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu _decode_uXXXXEs" u _decode_uXXXXcCsQg}|j}|d}x"|||ƒ}|dkrRttd||ƒƒ‚n|jƒ}|jƒ\} } | rƒ|| ƒn| dkr“PnL| dkrß|rÏdj| ƒ} tt| ||ƒƒ‚qß|| ƒqny||} Wn*tk rttd||ƒƒ‚YnX| dkr}y|| } Wn9tk rodj| ƒ} tt| ||ƒƒ‚YnX|d7}n´t ||ƒ}|d7}d |ko­d knr%|||d …d kr%t ||dƒ}d |koödknr%d|d d>|d B}|d7}q%nt |ƒ} || ƒqdj |ƒ|fS(u®Scan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.iuUnterminated string starting atu"u\u"Invalid control character {0!r} atuuuInvalid \escape: {0!r}iiØiÿÛiu\uiÜiÿßii iuN( uappenduNoneu ValueErroruerrmsguendugroupsuformatu IndexErroruKeyErroru _decode_uXXXXuchrujoin(usuendustrictu_bu_muchunksu_appendubeginuchunkucontentu terminatorumsguescucharuuniuuni2((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu py_scanstringOsT              6  u py_scanstringu [ \t\n\r]*u cCsÍ|\}} g} | j} |dkr0i}n|j} || | d…} | dkr| |kr‘||| ƒjƒ} || | d…} n| dkrò|dk rÃ|| ƒ}|| dfSi} |dk rä|| ƒ} n| | dfS| dkrttd|| ƒƒ‚qn| d7} xQt|| |ƒ\}} | ||ƒ}|| | d…dkr·||| ƒjƒ} || | d…dkr·ttd|| ƒƒ‚q·n| d7} yM|| |kr | d7} || |kr ||| dƒjƒ} q nWntk r"YnXy||| ƒ\}} Wn*tk rhttd|| ƒƒ‚YnX| ||fƒy@|| } | |kr¸||| dƒjƒ} || } nWntk rÓd} YnX| d7} | dkrîPn+| d krttd || dƒƒ‚n||| ƒjƒ} || | d…} | d7} | dkr)ttd|| dƒƒ‚q)q)|dk rœ|| ƒ}|| fSt | ƒ} |dk rÃ|| ƒ} n| | fS( Niu"u}u1Expecting property name enclosed in double quotesu:uExpecting ':' delimiteruExpecting objectuu,uExpecting ',' delimiter( uappenduNoneu setdefaultuendu ValueErroruerrmsgu scanstringu IndexErroru StopIterationudict(u s_and_endustrictu scan_onceu object_hookuobject_pairs_hookumemou_wu_wsusuendupairsu pairs_appendumemo_getunextcharuresultukeyuvalue((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu JSONObject“sˆ               #                u JSONObjectc CsØ|\}}g}|||d…}||krb|||dƒjƒ}|||d…}n|dkr|||dfS|j}xFy|||ƒ\} }Wn*tk rÍttd||ƒƒ‚YnX|| ƒ|||d…}||kr(|||dƒjƒ}|||d…}n|d7}|dkrBPn'|dkrittd||ƒƒ‚nyM|||krµ|d7}|||krµ|||dƒjƒ}qµnWqˆtk rÊYqˆXqˆ||fS(Niu]uExpecting objectu,uExpecting ',' delimiter(uenduappendu StopIterationu ValueErroruerrmsgu IndexError( u s_and_endu scan_onceu_wu_wsusuenduvaluesunextcharu_appenduvalue((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu JSONArrayäs@           # u JSONArraycBsY|EeZdZdZd d d d d d dd„Zejdd„Z ddd„Z d S( u JSONDecoderuSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | 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. cCs…||_|pt|_|p!t|_|p3tj|_||_||_ t |_ t |_ t|_i|_tj|ƒ|_dS(uD``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). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N(u object_hookufloatu parse_floatuintu parse_intu _CONSTANTSu __getitem__uparse_constantustrictuobject_pairs_hooku JSONObjectu parse_objectu JSONArrayu parse_arrayu scanstringu parse_stringumemouscanneru make_scanneru scan_once(uselfu object_hooku parse_floatu parse_intuparse_constantustrictuobject_pairs_hook((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu__init__'s&       uJSONDecoder.__init__cCsy|j|d||dƒjƒƒ\}}|||ƒjƒ}|t|ƒkruttd||t|ƒƒƒ‚n|S(ulReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). uidxiu Extra data(u raw_decodeuendulenu ValueErroruerrmsg(uselfusu_wuobjuend((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyudecodeZs *$uJSONDecoder.decodeic CsGy|j||ƒ\}}Wntk r<tdƒ‚YnX||fS(u=Decode a JSON document from ``s`` (a ``str`` 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. uNo JSON object could be decoded(u scan_onceu StopIterationu ValueError(uselfusuidxuobjuend((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu raw_decodees  uJSONDecoder.raw_decodeNT( u__name__u __module__u __qualname__u__doc__uNoneuTrueu__init__u WHITESPACEumatchudecodeu raw_decode(u __locals__((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyu JSONDecoder s  1 T(%u__doc__ubinasciiureusysustructujsonuscanneru_jsonu scanstringu c_scanstringu ImportErroruNoneu__all__uVERBOSEu MULTILINEuDOTALLuFLAGSu_floatconstantsuNaNuPosInfuNegInfulinecoluerrmsgu _CONSTANTSucompileu STRINGCHUNKu BACKSLASHu _decode_uXXXXuTrueumatchu py_scanstringu WHITESPACEuWHITESPACE_STRu JSONObjectu JSONArrayuobjectu JSONDecoder(((u1/opt/alt/python33/lib64/python3.3/json/decoder.pyus@          & = P%