Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/site-packages/simplejson/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/simplejson/__pycache__/decoder.cpython-37.pyc

B

VX�Y�8�	@sRdZddlmZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlm
Z
mZdd�Ze�Zd	gZejejBejBZd
d�Ze�\ZZZeeed�Ze�d
e�Zed�ed�ed�ed�ed�ed�ed�ed�d�ZdZddeejed�j e
ej!fdd�Z"e�p
e"Z#e�de�Z$dZ%de$je%fdd�Z&e$je%fd d!�Z'Gd"d	�d	e(�Z)dS)#zImplementation of JSONDecoder
�)�absolute_importN�)�u�	text_type�binary_type�PY3�unichr)�make_scanner�JSONDecodeErrorcCs*yddlm}|Stk
r$dSXdS)Nr)�
scanstring)Z	_speedupsr�ImportError)r�r
�E/opt/alt/python37/lib64/python3.7/site-packages/simplejson/decoder.py�_import_c_scanstring
s
r�JSONDecodercCsBtjdkr&d�d�}t�d|�\}}ntd�}td�}|||fS)N)��Z 7FF80000000000007FF0000000000000�hexz>dd�nan�inf)�sys�version_info�decode�struct�unpack�float)Z_BYTESrrr
r
r�_floatconstantss

r)z	-Infinity�Infinity�NaNz(.*?)(["\\\x00-\x1f])�"�\�/���
�
�	)rr r!�b�f�n�r�tzutf-8T�c	Cs�|dkrt}g}	|	j}
|d}�xz|||�}|dkr@td||��|��}|��\}
}|
rx|spt|
t�spt|
|�}
|
|
�|dkr�Pn(|dkr�|r�d}t|||��n
|
|�q"y||}Wn tk
r�td||��YnX|dk�r$y||}Wn&tk
�rd}t|||��YnX|d7}�nld	}||d|d
�}|dd�}t	|�dk�sj|d
k�sj|dk�rzt|||d��yt
|d�}Wn&tk
�r�t|||d��YnX|d
7}|dk�r�|d@dk�r�|||d�dk�r�||d|d�}|dd�}t	|�dk�r�|d
k�s�|dk�s�yt
|d�}Wn"tk
�rXt|||��YnX|d@dk�r�d|dd>|dB}|d7}t|�}|
|�q"W||	�|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.NrzUnterminated string starting atrr zInvalid control character %r atrzInvalid \X escape sequence %rzInvalid \uXXXX escape sequence�r��x�X�i��i�i�z\uri�i�
)
�DEFAULT_ENCODING�appendr
�end�groups�
isinstancer�
IndexError�KeyError�len�int�
ValueErrorr)�sr5�encoding�strict�_b�_mZ_join�_PY3Z_maxunicode�chunks�_append�begin�chunk�content�
terminator�msg�esc�charZescX�uniZesc2�uni2r
r
r�
py_scanstring1s~



"
"rNz
[ \t\n\r]*z 	

c	Cs�|\}	}
|dkri}|j}g}|	|
|
d�}
|
dkr�|
|kr\||	|
���}
|	|
|
d�}
|
dkr�|dk	r�||�}||
dfSi}|dk	r�||�}||
dfS|
dkr�td|	|
��|
d7}
�x�t|	|
||�\}}
|||�}|	|
|
d�dk�r"||	|
���}
|	|
|
d�dk�r"td|	|
��|
d7}
y:|	|
|k�rb|
d7}
|	|
|k�rb||	|
d���}
Wntk
�rzYnX||	|
�\}}
|�||f�y0|	|
}
|
|k�r�||	|
d���}
|	|
}
Wntk
�r�d}
YnX|
d7}
|
dk�r�Pn|
dk�rtd	|	|
d��yJ|	|
}
|
|k�r\|
d7}
|	|
}
|
|k�r\||	|
d���}
|	|
}
Wntk
�rxd}
YnX|
d7}
|
dkr�td|	|
d��q�W|dk	�r�||�}||
fSt|�}|dk	�r�||�}||
fS)
Nrr�}z1Expecting property name enclosed in double quotes�:zExpecting ':' delimiterr,�,zExpecting ',' delimiter or '}')�
setdefaultr5r
rr8r4�dict)�stater>r?�	scan_once�object_hook�object_pairs_hook�memo�_w�_wsr=r5�memo_get�pairs�nextchar�result�key�valuer
r
r�
JSONObject�s�









rac
CsP|\}}g}|||d�}||krF|||d���}|||d�}|dkrZ||dfS|dkrntd||��|j}x�|||�\}	}||	�|||d�}||kr�|||d���}|||d�}|d7}|dkr�Pn|dkr�td||d��y:|||k�r*|d7}|||k�r*|||d���}Wqvtk
�rBYqvXqvW||fS)Nr�]r,zExpecting value or ']'rQzExpecting ',' delimiter or ']')r5r
r4r8)
rTrUrYrZr=r5�valuesr]rDr`r
r
r�	JSONArray�s>
rdc@s<eZdZdZddd�Zejefdd�Zdejefd	d
�Z	dS)raSimple JSON <http://json.org> 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.

    NTcCsj|dkrt}||_||_||_|p$t|_|p.t|_|p:tj	|_
||_t|_
t|_t|_i|_t|�|_dS)a	
        *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)r3r>rVrWr�parse_floatr;�	parse_int�
_CONSTANTS�__getitem__�parse_constantr?ra�parse_objectrd�parse_arrayr�parse_stringrXr	rU)�selfr>rVrerfrir?rWr
r
r�__init__.s.

zJSONDecoder.__init__cCsX|rt|t�r|�|j�}|�|�\}}|||���}|t|�krTtd||t|���|S)zzReturn the Python representation of ``s`` (a ``str`` or ``unicode``
        instance containing a JSON document)

        z
Extra data)r7rrr>�
raw_decoder5r:r
)rmr=rYrB�objr5r
r
rrkszJSONDecoder.decodercCs�|dkrtd||��|r*t|t�s*td��t|�|krxt||�}|dkrT|d7}n$|dkrx|||d�dkrx|d7}|j||||���d	�S)
a�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.

        rzExpecting valuez$Input string must be text, not bytesi��r���u)�idx)r
r7r�	TypeErrorr:�ordrUr5)rmr=rsrYrBZord0r
r
rroxs
zJSONDecoder.raw_decode)NNNNNTN)
�__name__�
__module__�__qualname__�__doc__rn�
WHITESPACE�matchrrror
r
r
rrs
;
)*ry�
__future__r�rerr�compatrrrrr�scannerr	r
r�c_scanstring�__all__�VERBOSE�	MULTILINE�DOTALL�FLAGSrr�PosInf�NegInfrg�compile�STRINGCHUNK�	BACKSLASHr3r{�join�
maxunicoderNrrz�WHITESPACE_STRrard�objectrr
r
r
r�<module>s:	$V
\$

Hacked By AnonymousFox1.0, Coded By AnonymousFox