Your IP : 18.191.208.124


Current Path : /lib64/python2.7/json/
Upload File :
Current File : //lib64/python2.7/json/decoder.pyo

�
�mec@s�dZddlZddlZddlZddlmZyddlmZWne	k
rgdZnXdgZejej
BejBZd�Ze�\ZZZd�Zdd�Zied	6ed
6ed6Zejde�Zid
d6dd6dd6dd6dd6dd6dd6dd6ZdZd�Zdeeejd�ZepSeZejd e�Zd!Z eje d"�Z!eje d#�Z"de#fd$��YZ$dS(%sImplementation of JSONDecoder
i����N(tscanner(t
scanstringtJSONDecodercCssdjd�}tjdkrM|d ddd�|dddd�}ntjd|�\}}|||fS(Nt 7FF80000000000007FF0000000000000thextbigii����tdd(tdecodetsyst	byteordertstructtunpack(t_BYTEStnantinf((s$/usr/lib64/python2.7/json/decoder.pyt_floatconstantss
/cCsU|jdd|�d}|dkr2|d}n||jdd|�}||fS(Ns
ii(tcounttrindex(tdoctpostlinenotcolno((s$/usr/lib64/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$/usr/lib64/python2.7/json/decoder.pyterrmsg$ss	-InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbutfu
tnu
tru	ttsutf-8cCs�||d|d!}t|�dkr_|ddkr_yt|d�SWq_tk
r[q_Xnd}tt|||���dS(NiiitxXisInvalid \uXXXX escape(tlentintt
ValueErrorR(tsRtescR((s$/usr/lib64/python2.7/json/decoder.pyt
_decode_uXXXXAs"
cCs�|dkrt}ng}|j}|d}xN|||�}	|	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||
}Wn9tk
r�dt|
�}tt|||���nX|d7}n�t
||�}|d7}tjd	krfd
|ko�dknrf|||d!d
krft
||d�}d|ko7dknrfd|d
d>|dB}|d7}qfnt|�}||�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: ii��i�i��is\ui�i��ii
iuN(RtDEFAULT_ENCODINGtappendR+RRtgroupst
isinstancetunicodeRt
IndexErrortKeyErrortreprR.Rt
maxunicodetunichrtjoin(R,Rtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt
terminatorRR-tchartunituni2((s$/usr/lib64/python2.7/json/decoder.pyt
py_scanstringKs^
		






3
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(
R1RRR+RtTrueRR5t
StopIterationtdict(t	s_and_endR;R<t	scan_oncetobject_hooktobject_pairs_hookt_wt_wsR,Rtpairstpairs_appendtnextchartresulttkeytvalue((s$/usr/lib64/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(RR1RMRNR+RR5(
RPRQRTRUR,RtvaluesRXR@R[((s$/usr/lib64/python2.7/json/decoder.pyt	JSONArray�s@		



#
cBsGeZdZdddddedd�Zejd�Zdd�Z	RS(sSimple JSON <http://json.org> 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(R;RRRStfloattparse_floatR*t	parse_intt
_CONSTANTSt__getitem__tparse_constantR<R\tparse_objectR_tparse_arrayRtparse_stringRtmake_scannerRQ(tselfR;RRRaRbReR<RS((s$/usr/lib64/python2.7/json/decoder.pyt__init__0s-							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_decodeRR)R+R(RjR,RTtobjR((s$/usr/lib64/python2.7/json/decoder.pyRis
*$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+(RjR,RlRnR((s$/usr/lib64/python2.7/json/decoder.pyRmts
	
N(
t__name__t
__module__t__doc__RRMRkt
WHITESPACEtmatchRRm(((s$/usr/lib64/python2.7/json/decoder.pyRs		7(%RqtreRR
tjsonRt_jsonRtc_scanstringtImportErrorRt__all__tVERBOSEt	MULTILINEtDOTALLtFLAGSRR tPosInftNegInfRRRctcompiletSTRINGCHUNKt	BACKSLASHR0R.RMRsRHRrtWHITESPACE_STRR\R_tobjectR(((s$/usr/lib64/python2.7/json/decoder.pyt<module>s@

				
&	
EW$