ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/json/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/json/__pycache__/decoder.cpython-34.pyc

�
e f�1�
@s�dZddlZddlmZyddlmZWnek
rPdZYnXdgZej	ej
BejBZe
d�Ze
d�Ze
d�Zd	d
�Zddd�Zied
6ed6ed6Zejde�Zidd6dd6dd6dd6dd6dd6dd6dd6Zdd�Zd eejd!d"�ZepHeZejd#e�Zd$Zdejed%d&�Zejed'd(�ZGd)d�de�ZdS)*zImplementation of JSONDecoder
�N)�scanner)�
scanstring�JSONDecoder�nan�infz-infcCsst|t�rd}nd}|j|d|�d}|dkrP|d}n||j|d|�}||fS)Ns
�
r�)�
isinstance�bytes�count�rindex)�doc�pos�newline�lineno�colno�r�1/opt/alt/python34/lib64/python3.4/json/decoder.py�linecols	
rc	Cswt||�\}}|dkr=d}|j||||�St||�\}}d}|j|||||||�S)Nz#{0}: line {1} column {2} (char {3})z?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6}))r�format)	�msgr
r�endrrZfmtZ	endlinenoZendcolnorrr�errmsg!srz	-InfinityZInfinity�NaNz(.*?)(["\\\x00-\x1f])�"�\�/��b��fr�n�
�r�	�tc
Cs�||d|d�}t|�dkrc|ddkrcyt|d�SWqctk
r_YqcXnd}tt|||���dS)Nr��ZxX�zInvalid \uXXXX escape)�len�int�
ValueErrorr)�sr�escrrrr�
_decode_uXXXX=s"
r.TcCsRg}|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||�}|d	7}d
|ko�dknr%|||d�d
kr%t||d�}d|ko�dknr%d|d
d>|dB}|d7}q%nt	|�}
||
�qWdj
|�|fS)a�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.rNzUnterminated string starting atrrz"Invalid control character {0!r} at�uzInvalid \escape: {0!r}r&i�i���z\ui�i��i�
��)�appendr+rr�groupsr�
IndexError�KeyErrorr.�chr�join)r,r�strictZ_bZ_mZchunks�_appendZbegin�chunkZcontentZ
terminatorrr-�charZuniZuni2rrr�
py_scanstringGsT
	






6r>z
[ \t\n\r]*z 	

c$Cs�|\}}	g}
|
j}|dkr0i}n|j}||	|	d�}
|
dkr|
|kr�|||	�j�}	||	|	d�}
n|
dkr�|dk	r�||
�}||	dfSi}
|dk	r�||
�}
n|
|	dfS|
dkrttd||	���qn|	d7}	xkt||	|�\}}	|||�}||	|	d�dkr�|||	�j�}	||	|	d�dkr�ttd||	���q�n|	d7}	yM||	|kr
|	d7}	||	|kr
|||	d�j�}	q
nWntk
r"YnXy|||	�\}}	WnCtk
r�}z#ttd||j��d�WYdd}~XnX|||f�y@||	}
|
|kr�|||	d�j�}	||	}
nWntk
r�d}
YnX|	d7}	|
dkrPn+|
d	kr2ttd
||	d���n|||	�j�}	||	|	d�}
|	d7}	|
dkr)ttd||	d���q)q)W|dk	r�||
�}||	fSt	|
�}
|dk	r�||
�}
n|
|	fS)Nrr�}z1Expecting property name enclosed in double quotes�:zExpecting ':' delimiterzExpecting valuer3�,zExpecting ',' delimiter)
r4�
setdefaultrr+rrr6�
StopIteration�value�dict)�	s_and_endr:�	scan_once�object_hook�object_pairs_hook�memo�_w�_wsr,rZpairsZpairs_appendZmemo_get�nextchar�result�keyrD�errrrr�
JSONObject�s�			


#
1




rQcCs�|\}}g}|||d�}||krb|||d�j�}|||d�}n|dkr|||dfS|j}xdy|||�\}	}WnCtk
r�}
z#ttd||
j��d�WYdd}
~
XnX||	�|||d�}||krA|||d�j�}|||d�}n|d7}|dkr[Pn+|dkr�ttd||d���nyM|||kr�|d7}|||kr�|||d�j�}q�nWq�tk
r�Yq�Xq�W||fS)Nr�]zExpecting valuerAzExpecting ',' delimiter)rr4rCr+rrDr6)rFrGrKrLr,r�valuesrMr;rDrPrrr�	JSONArray�s@	1


#
	rTc@sUeZdZdZdddddddd�Zejdd�Zdd	d
�ZdS)raSimple JSON <http://json.org> 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.

    NTcCs�||_|pt|_|p!t|_|p3tj|_||_||_	t
|_t|_
t|_i|_tj|�|_dS)aD``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)rH�float�parse_floatr*�	parse_int�
_CONSTANTS�__getitem__�parse_constantr:rIrQZparse_objectrTZparse_arrayrZparse_stringrJrZmake_scannerrG)�selfrHrVrWrZr:rIrrr�__init__s&							zJSONDecoder.__init__cCsy|j|d||d�j��\}}|||�j�}|t|�kruttd||t|����n|S)zlReturn the Python representation of ``s`` (a ``str`` instance
        containing a JSON document).

        �idxrz
Extra data)�
raw_decoderr)r+r)r[r,rK�objrrrr�decodeRs
*$zJSONDecoder.decodercCsly|j||�\}}WnCtk
ra}z#ttd||j��d�WYdd}~XnX||fS)a=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.

        zExpecting valueN)rGrCr+rrD)r[r,r]r_rrPrrrr^]s
	1zJSONDecoder.raw_decode)	�__name__�
__module__�__qualname__�__doc__r\�
WHITESPACE�matchr`r^rrrrrs	1) rd�reZjsonrZ_jsonrZc_scanstring�ImportError�__all__�VERBOSE�	MULTILINE�DOTALL�FLAGSrUrZPosInfZNegInfrrrX�compileZSTRINGCHUNKZ	BACKSLASHr.rfr>reZWHITESPACE_STRrQrT�objectrrrrr�<module>s<
	

&
=P%

Zerion Mini Shell 1.0