a
XC?h�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 �1/opt/alt/python39/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_mZchunks�_appendZbegin�chunkZcontent�
terminatorr r0 �charZuniZuni2r r r �
py_scanstringE sV
��
2
rD 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 ZpairsZpairs_appendZmemo_get�nextchar�result�keyrL �errr r r �
JSONObject� s� �
&
�
rY 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 �]rG rH rI )r8 r7 rK r rL r; )rN rO rS rT r/ r8 �valuesrU r@ rL rX r r r � JSONArray� s> &
r\ c @ s@ e Zd ZdZddddddd�dd�Zejfdd�Zdd
d�ZdS )
r a Simple JSON