ó u®¸Qc@s£dZddlZddlZddlZddlmZyddlmZWne k rgdZnXdgZ ej ej BejBZd„Zeƒ\ZZZd„Zdd„Zied 6ed 6ed 6Zejd eƒZid d6dd6dd6dd6dd6dd6dd6dd6ZdZdeeejd„ZepJeZejdeƒZd Zejed!„Z ejed"„Z!de"fd#„ƒYZ#dS($sImplementation of JSONDecoder iÿÿÿÿN(tscanner(t scanstringt JSONDecodercCssdjdƒ}tjdkrM|d ddd…|dddd…}ntjd|ƒ\}}||| fS(Nt 7FF80000000000007FF0000000000000thextbigiiÿÿÿÿtdd(tdecodetsyst byteordertstructtunpack(t_BYTEStnantinf((s"/sys/lib/python2.7/json/decoder.pyt_floatconstantss /cCsU|jdd|ƒd}|dkr2|d}n||jdd|ƒ}||fS(Ns ii(tcounttrindex(tdoctpostlinenotcolno((s"/sys/lib/python2.7/json/decoder.pytlinecols   c Cswt||ƒ\}}|dkr=d}|j||||ƒSt||ƒ\}}d}|j|||||||ƒS(Ns#{0}: line {1} column {2} (char {3})s?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(RtNonetformat( tmsgRRtendRRtfmtt endlinenotendcolno((s"/sys/lib/python2.7/json/decoder.pyterrmsg$s s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbu tfu tnu tru ttsutf-8cCs$|dkrt}ng}|j}|d}xà|||ƒ} | dkrgttd||ƒƒ‚n| jƒ}| jƒ\} } | r¹t| tƒs¬t| |ƒ} n|| ƒn| dkrÉPnL| dkr|rdj | ƒ} tt| ||ƒƒ‚q|| ƒq1ny||} Wn)t k rNttd||ƒƒ‚nX| dkr²y|| }Wn9t k r¤dt | ƒ} tt| ||ƒƒ‚nX|d7}nR||d|d!} |d}t | ƒd krd } tt| ||ƒƒ‚nt| d ƒ}d |ko*d knròtjdkròd} ||d|d!dksztt| ||ƒƒ‚n||d|d!}t |ƒd kr¼tt| ||ƒƒ‚nt|d ƒ}d|d d>|dB}|d7}nt|ƒ}|}||ƒq1dj|ƒ|fS(s®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.isUnterminated string starting atR!s\s"Invalid control character {0!r} attusInvalid \escape: iisInvalid \uXXXX escapeiiØiÿÛiÿÿs#Invalid \uXXXX\uXXXX surrogate pairis\ui ii iÜiuN(RtDEFAULT_ENCODINGtappendt ValueErrorRRtgroupst isinstancetunicodeRt IndexErrortKeyErrortreprtlentintRt maxunicodetunichrtjoin(tsRtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt terminatorRtesctchartnext_endtunitesc2tuni2((s"/sys/lib/python2.7/json/decoder.pyt py_scanstringAsp               +   s [ \t\n\r]*s cCsï|\}} g} | j} || | d!} | dkrø| |krm||| ƒjƒ} || | d!} n| dkrÎ|dk rŸ|| ƒ} | | dfSi} |dk rÀ|| ƒ} n| | dfS| dkrøttd|| ƒƒ‚qøn| d7} x—tr›t|| ||ƒ\}} || | d!dkr‡||| ƒjƒ} || | d!dkr‡ttd|| ƒƒ‚q‡n| d7} yM|| |krÝ| d7} || |krÝ||| dƒjƒ} qÝnWntk rñnXy||| ƒ\}} Wn)tk r6ttd|| ƒƒ‚nX| ||fƒy@|| } | |kr†||| dƒjƒ} || } nWntk r d} nX| d7} | dkr»Pn+| d krættd || dƒƒ‚nyc|| } | |krH| d7} || } | |krH||| dƒjƒ} || } qHnWntk rbd} nX| d7} | dkrttd|| dƒƒ‚qqW|dk r¾|| ƒ} | | fSt | ƒ} |dk rå|| ƒ} n| | fS( NiR!t}s1Expecting property name enclosed in double quotest:sExpecting ':' delimitersExpecting objecttt,sExpecting ',' delimiter( R*RRR+RtTrueRR/t StopIterationtdict(t s_and_endR8R9t scan_oncet object_hooktobject_pairs_hookt_wt_wsR7Rtpairst pairs_appendtnextchartresulttkeytvalue((s"/sys/lib/python2.7/json/decoder.pyt JSONObject•s             #                       c CsÑ|\}}g}|||d!}||kr\|||dƒjƒ}|||d!}n|dkrv||dfS|j}xEtrÆy|||ƒ\} }Wn)tk rÌttd||ƒƒ‚nX|| ƒ|||d!}||kr!|||dƒjƒ}|||d!}n|d7}|dkr;Pn'|dkrbttd||ƒƒ‚nyM|||kr®|d7}|||kr®|||dƒjƒ}q®nWq‚tk rÂq‚Xq‚W||fS(Nit]sExpecting objectRLsExpecting ',' delimiter(RR*RMRNR+RR/( RPRQRTRUR7RtvaluesRXR=R[((s"/sys/lib/python2.7/json/decoder.pyt JSONArrayís@            # cBsGeZdZdddddedd„Zejd„Zdd„Z RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | 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. cCs…||_||_||_|p$t|_|p3t|_|pEtj|_ ||_ t |_ t |_t|_tj|ƒ|_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). ``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(R8RRRStfloatt parse_floatR3t parse_intt _CONSTANTSt __getitem__tparse_constantR9R\t parse_objectR_t parse_arrayRt parse_stringRt make_scannerRQ(tselfR8RRRaRbReR9RS((s"/sys/lib/python2.7/json/decoder.pyt__init__/s-       cCsy|j|d||dƒjƒƒ\}}|||ƒjƒ}|t|ƒkruttd||t|ƒƒƒ‚n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) tidxis Extra data(t raw_decodeRR2R+R(RjR7RTtobjR((s"/sys/lib/python2.7/json/decoder.pyRhs *$icCsFy|j||ƒ\}}Wntk r;tdƒ‚nX||fS(sLDecode 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. sNo JSON object could be decoded(RQRNR+(RjR7RlRnR((s"/sys/lib/python2.7/json/decoder.pyRmss  N( t__name__t __module__t__doc__RRMRkt WHITESPACEtmatchRRm(((s"/sys/lib/python2.7/json/decoder.pyRs    7 ($RqtreRR tjsonRt_jsonRt c_scanstringt ImportErrorRt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRR tPosInftNegInfRRRctcompilet STRINGCHUNKt BACKSLASHR)RMRsRHRrtWHITESPACE_STRR\R_tobjectR(((s"/sys/lib/python2.7/json/decoder.pyts>         &N W$