ó ÖÉÎSc@@sdZddlmZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z ddlmZmZd„ZeƒZdgZejejBejBZd „Zeƒ\ZZZied 6ed 6ed 6Zejd eƒZie dƒd6e dƒd6e dƒd6e dƒd6e dƒd6e dƒd6e dƒd6e dƒd6ZdZ de"eej#e dƒj$e ej%d„Z&ep¨e&Z'ejdeƒZ(d Z)de(j#e)d!„Z*e(j#e)d"„Z+de,fd#„ƒYZ-dS($sImplementation of JSONDecoder i(tabsolute_importNi(tfromhextbtut text_typet binary_typetPY3tunichr(t make_scannertJSONDecodeErrorcC@s1yddlm}|SWntk r,dSXdS(Ni(t scanstring(t _speedupsR t ImportErrortNone(R ((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt_import_c_scanstring s  t JSONDecodercC@sptdƒ}tjdkrJ|d ddd…|dddd…}ntjd|ƒ\}}||| fS(Nt 7FF80000000000007FF0000000000000tbigiiÿÿÿÿtdd(Rtsyst byteordertstructtunpack(t_BYTEStnantinf((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt_floatconstantss  /s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])t"s\u005cs\t/sRs tfs tns trs ttsutf-8tc C@s`|dkrt}ng} | j} |d} x|||ƒ} | dkratd|| ƒ‚n| jƒ}| jƒ\} }| r»| r®t| tƒ r®t| |ƒ} n| | ƒn|dkrËPn=|dkr|rød}t|||ƒ‚q| |ƒq1ny||}Wn#tk r;td|| ƒ‚nX|dkry||}Wn)t k rd}t|||ƒ‚nX|d7}n´d}||d|d !}|dd !}t |ƒd ksá|d ksá|d krút|||dƒ‚nyt |dƒ}Wn't k r6t|||dƒ‚nX|d 7}|dkr7|d@dkr7|||d !dkr7||d |d!}|dd !}t |ƒd kr7|d kp½|d k r7yt |dƒ}Wn#t k rùt|||ƒ‚nX|d@dkr4d|dd>|dB}|d7}q4q7nt |ƒ}| |ƒq1|| ƒ|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 atRs\sInvalid control character %r atRsInvalid \X escape sequence %rsInvalid \uXXXX escape sequenceiiitxtXiiÿÿiüiØs\uiiÜii N(R tDEFAULT_ENCODINGtappendR tendtgroupst isinstanceRt IndexErrortKeyErrortlentintt ValueErrorR(tsR(tencodingtstrictt_bt_mt_joint_PY3t _maxunicodetchunkst_appendtbegintchunktcontentt terminatortmsgtesctchartescXtunitesc2tuni2((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt py_scanstring1s~               *    +    s [ \t\n\r]*s c C@sÎ|\} } |dkr!i}n|j} g} | | | d!} | dkr| |kr‚|| | ƒjƒ} | | | d!} n| dkrã|dk r´|| ƒ}|| dfSi} |dk rÕ|| ƒ} n| | dfS| dkrtd| | ƒ‚qn| d7} xgtrzt| | ||ƒ\}} | ||ƒ}| | | d!dkrŸ|| | ƒjƒ} | | | d!dkrŸtd| | ƒ‚qŸn| d7} yM| | |krõ| d7} | | |krõ|| | dƒjƒ} qõnWntk r nX|| | ƒ\}} | j||fƒy@| | } | |krq|| | dƒjƒ} | | } nWntk r‹d} nX| d7} | dkr¦Pn%| dkrËtd | | dƒ‚nyc| | } | |kr-| d7} | | } | |kr-|| | dƒjƒ} | | } q-nWntk rGd} nX| d7} | dkrtd| | dƒ‚qqW|dk r|| ƒ}|| fSt| ƒ} |dk rÄ|| ƒ} n| | fS( NiRt}s1Expecting property name enclosed in double quotest:sExpecting ':' delimiterR#t,sExpecting ',' delimiter or '}'( R t setdefaultR(R tTrueR R+R'tdict(tstateR1R2t scan_oncet object_hooktobject_pairs_hooktmemot_wt_wsR0R(tmemo_gettpairstnextchartresulttkeytvalue((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt JSONObjectŽs”               #                      c C@sÀ|\}}g}|||d!}||kr\|||dƒjƒ}|||d!}n|dkrv||dfS|dkr—td||ƒ‚n|j}xtrµ|||ƒ\} }|| ƒ|||d!}||kr|||dƒjƒ}|||d!}n|d7}|dkr,Pn%|dkrQtd||dƒ‚nyM|||kr|d7}|||kr|||dƒjƒ}qnWq£tk r±q£Xq£W||fS(Nit]R#sExpecting value or ']'RHsExpecting ',' delimiter or ']'(R(R R'RJR+( RLRMRQRRR0R(tvaluesRUR9RX((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt JSONArrayìs>            # cB@sSeZdZdddddedd„Zejed„Z dejed„Z RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str, 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. cC@s |dkrt}n||_||_||_|p9t|_|pHt|_|pZt j |_ ||_ t |_t|_t|_i|_t|ƒ|_dS(s *encoding* determines the encoding used to interpret any :class:`str` objects decoded by this instance (``'utf-8'`` by default). It has no effect when decoding :class:`unicode` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as :class:`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 :class:`dict`. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). *object_pairs_hook* is an optional function that will be called with the result of any object literal decode with an ordered list of pairs. The return value of *object_pairs_hook* will be used instead of the :class:`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, :func:`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. :class:`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. :class:`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. *strict* controls the parser's behavior when it encounters an invalid control character in a string. The default setting of ``True`` means that unescaped control characters are parse errors, if ``False`` then control characters will be allowed in strings. N(R R&R1RNROtfloatt parse_floatR.t parse_intt _CONSTANTSt __getitem__tparse_constantR2RYt parse_objectR\t parse_arrayR t parse_stringRPRRM(tselfR1RNR^R_RbR2RO((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyt__init__.s.          cC@sˆ|r*t|tƒr*|j|jƒ}n|j|ƒ\}}|||ƒjƒ}|t|ƒkr„td||t|ƒƒ‚n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) s Extra data(R*RtdecodeR1t raw_decodeR(R-R (RfR0RQR6tobjR(((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyRhksicC@sÖ|dkr!td||ƒ‚n|rFt|tƒ rFtdƒ‚nt|ƒ|kr´t||ƒ}|dkr|d7}q´|dkr´|||d!dkr´|d7}q´n|j|d |||ƒjƒƒS( sº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. Optionally, ``idx`` can be used to specify an offset in ``s`` where the JSON document begins. This can be used to decode a JSON document from a string that may have extraneous data at the end. isExpecting values$Input string must be text, not bytesiÿþiiïistidx(R R*Rt TypeErrorR-tordRMR((RfR0RkRQR6tord0((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyRixs   #N( t__name__t __module__t__doc__R RJRgt WHITESPACEtmatchRRhRi(((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyRs    ; (.Rqt __future__RtreRRtcompatRRRRRRRtscannerRR Rt c_scanstringt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRRtPosInftNegInfR`tcompilet STRINGCHUNKt BACKSLASHR&R RJRstjoint maxunicodeRER RrtWHITESPACE_STRRYR\tobjectR(((s8/usr/lib/python2.7/vendor-packages/simplejson/decoder.pyts>   4     'DV \$