/usr/lib64/python3.9/json/__pycache__
Edit: /usr/lib64/python3.9/json/__pycache__/decoder.cpython-39.pyc (9808B)
a
´i¸0 ã @ s d Z ddlZddlmZ zddlmZ W n ey> dZY n0 ddgZej ej
B ejB Ze
dƒZe
dƒZe
d ƒZG d
d„ deƒZeeedœZe de¡Zd
ddddddddœZdd„ Zdeejfdd„ZepÐeZe de¡ZdZdejefdd„Zejefdd „ZG d!d„ deƒZdS )"zImplementation of JSONDecoder
é N)Úscanner)Ú
scanstringÚJSONDecoderÚJSONDecodeErrorÚnanÚinfz-infc @ s e Zd ZdZdd„ Zdd„ ZdS )r a Subclass of ValueError with the following additional properties:
msg: The unformatted error message
doc: The JSON document being parsed
pos: The start index of doc where parsing failed
lineno: The line corresponding to pos
colno: The column corresponding to pos
c C sb | dd|¡d }|| dd|¡ }d||||f }t | |¡ || _|| _|| _|| _|| _d S )NÚ
r é z%s: line %d column %d (char %d)) ÚcountÚrfindÚ
ValueErrorÚ__init__ÚmsgÚdocÚposÚlinenoÚcolno)Úselfr r r r r Úerrmsg© r ú$/usr/lib64/python3.9/json/decoder.pyr
s zJSONDecodeError.__init__c C s | j | j| j| jffS )N)Ú __class__r r r )r r r r Ú
__reduce__* s zJSONDecodeError.__reduce__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
r r r r r r s
)z -InfinityZInfinityÚNaNz(.*?)(["\\\x00-\x1f])ú"ú\ú/úúr ú
ú )r r r ÚbÚfÚnÚrÚtc C s` | |d |d … }t |ƒdkrL|d dvrLzt|dƒW S tyJ Y n0 d}t|| |ƒ‚d S )Nr é é ZxXé zInvalid \uXXXX escape)ÚlenÚintr r )Úsr Úescr r r r Ú
_decode_uXXXX; s r1 Tc C s² g }|j }|d }|| |ƒ}|du r0td| |ƒ‚| ¡ }| ¡ \} }
| rP|| ƒ |
dkr^�q¤n.|
dkrŒ|r‚d |
¡}t|| |ƒ‚n
||
ƒ qz| | }W n ty¸ td| |ƒd‚Y n0 |dk�rz|| }
W n( tyø d |¡}t|| |ƒ‚Y n0 |d7 }n–t| |ƒ}|d 7 }d
| k�r.dk�r’n n`| ||d … d
k�r’t| |d ƒ}d| k�rndk�r’n n d|d
d> |d B }|d7 }t|ƒ}
||
ƒ qd |¡|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.r NzUnterminated string starting atr r z"Invalid control character {0!r} atÚuzInvalid \escape: {0!r}r* i Ø iÿÛ é z\ui Ü iÿß i é
é Ú )
Úappendr ÚendÚgroupsÚformatÚ
IndexErrorÚKeyErrorr1 ÚchrÚjoin)r/ r8 ÚstrictZ_bZ_mÚchunksÚ_appendZbeginÚchunkZcontentÚ
terminatorr r0 ÚcharZuniZuni2r r r Ú
py_scanstringE sV
ÿÿ
2
rE z
[ \t\n\r]*z
c
C sÈ | \}} g }
|
j }|d u ri }|j}|| | d … }
|
dkrº|
|v rb||| ƒ ¡ } || | d … }
|
dkr¦|d ur†||
ƒ}|| d fS i }
|d urš||
ƒ}
|
| d fS |
dkrºtd|| ƒ‚| d7 } t|| |ƒ\}} |||ƒ}|| | d … dk�r"||| ƒ ¡ } || | d … dk�r"td|| ƒ‚| d7 } z:|| |v �rb| d7 } || |v �rb||| d ƒ ¡ } W n t�yx Y n0 z||| ƒ\}} W n6 t�y } ztd||jƒd ‚W Y d }~n
d }~0 0 |||fƒ z0|| }
|
|v �rþ||| d ƒ ¡ } || }
W n t�y d}
Y n0 | d7 } |
dk�r2�qŒn|
d k�rLtd
|| d ƒ‚||| ƒ ¡ } || | d … }
| d7 } |
dkrÂtd|| d ƒ‚qÂ|d u�r¦||
ƒ}|| fS t|
ƒ}
|d u�rÀ||
ƒ}
|
| fS )Nr r ú}z1Expecting property name enclosed in double quotesú:zExpecting ':' delimiterúExpecting valuer6 ú,úExpecting ',' delimiter) r7 Ú
setdefaultr8 r r r; Ú
StopIterationÚvalueÚdict)Ú s_and_endr? Ú scan_onceÚobject_hookÚobject_pairs_hookÚmemoÚ_wÚ_wsr/ r8 ÚpairsZpairs_appendZmemo_getÚnextcharÚresultÚkeyrM Úerrr r r Ú
JSONObjectˆ sŠ ÿ
&
ÿ
r[ c
C sv | \}}g }|||d … }||v rF|||d ƒ ¡ }|||d … }|dkrZ||d fS |j}z|||ƒ\} }W n4 ty¦ }
ztd||
jƒd ‚W Y d }
~
n
d }
~
0 0 || ƒ |||d … }||v rê|||d ƒ ¡ }|||d … }|d7 }|dk�r�qnn|dk�rtd||d ƒ‚z:|| |v �rT|d7 }|| |v �rT|||d ƒ ¡ }W q` t�yj Y q`0 q`||fS )Nr ú]rH rI rJ )r8 r7 rL r rM r; )rO rP rT rU r/ r8 ÚvaluesrW rA rM rZ r r r Ú JSONArrayÙ s> &
r^ c @ s@ e Zd ZdZdddddddœdd„Zejfdd„Zdd
d„ZdS )
r a Simple JSON
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.
NT)rQ Úparse_floatÚ parse_intÚparse_constantr? rR c C sZ || _ |pt| _|pt| _|p"tj| _|| _|| _ t
| _t| _
t| _i | _t | ¡| _dS )a§ ``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.
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)rQ Úfloatr_ r. r` Ú
_CONSTANTSÚ__getitem__ra r? rR r[ Zparse_objectr^ Zparse_arrayr Zparse_stringrS r Zmake_scannerrP )r rQ r_ r` ra r? rR r r r r
s #
zJSONDecoder.__init__c C sF | j |||dƒ ¡ d�\}}|||ƒ ¡ }|t|ƒkrBtd||ƒ‚|S )zlReturn the Python representation of ``s`` (a ``str`` instance
containing a JSON document).
r )Úidxz
Extra data)Ú
raw_decoder8 r- r )r r/ rT Úobjr8 r r r ÚdecodeL s
zJSONDecoder.decoder c
C sR z| ||¡\}}W n4 tyH } ztd||jƒd‚W Y d}~n
d}~0 0 ||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.
rH N)rP rL r rM )r r/ re rg r8 rZ r r r rf W s
&zJSONDecoder.raw_decode)r ) r r r r r
Ú
WHITESPACEÚmatchrh rf r r r r r þ s þ0) r ÚreZjsonr Z_jsonr Zc_scanstringÚImportErrorÚ__all__ÚVERBOSEÚ MULTILINEÚDOTALLÚFLAGSrb r ZPosInfZNegInfr r rc ÚcompileZSTRINGCHUNKZ BACKSLASHr1 rj rE ri ZWHITESPACE_STRr[ r^ Úobjectr r r r r Ú s>
ý
þ
ÿ
=ÿ
Q%