Your IP : 3.137.159.163


Current Path : /opt/alt/python312/lib64/python3.12/tomllib/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/tomllib/__pycache__/_parser.cpython-312.opt-2.pyc

�

�Q�fgX�
�H�ddlmZddlmZddlZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZddlmZmZmZed	�ed
�D��eed��zZeed�z
Zeed
�z
ZeZeZeZed�Zeed�zZ eejBejDzdz�Z#e#ed�zZ$eejJ�Z&edddddddd��Z'Gd�de(�Z)e*d�d<d�Z+e*d�d=d�Z,Gd�d�Z-Gd�d �Z.Gd!�d"e
�Z/d>d#�Z0												d?d$�Z1d@d%�Z2d@d&�Z3dAd'�Z4dAd(�Z5												dBd)�Z6								dCd*�Z7dDd+�Z8dEd,�Z9dEd-�Z:dFd.�Z;dGd/�Z<d0d1�							dHd2�Z=dEd3�Z>dId4�Z?dEd5�Z@dJd6�ZAdHd7�ZB								dKd8�ZCdLd9�ZDdMd:�ZEdNd;�ZFy)O�)�annotations)�IterableN)�MappingProxyType)�Any�BinaryIO�
NamedTuple�)�RE_DATETIME�RE_LOCALTIME�	RE_NUMBER�match_to_datetime�match_to_localtime�match_to_number)�Key�
ParseFloat�Posc#�2K�|]}t|����y�w�N)�chr)�.0�is  �6/opt/alt/python312/lib64/python3.12/tomllib/_parser.py�	<genexpr>rs����1�y�!�s�1�v�y�s�� ��	z	
z 	�
z-_z"'���
�"�\)z\bz\tz\nz\fz\rz\"z\\c��eZdZy)�TOMLDecodeErrorN)�__name__�
__module__�__qualname__��rr$r$5s��:r)r$��parse_floatc��	|j�}	|j�}t	||��S#t$r
td�d�wxYw)NzEFile must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`r*)�read�decode�AttributeError�	TypeError�loads)�fpr+�b�ss    r�loadr59sS��/�
���	�A��
�H�H�J��
���,�,��	���S�
��	��s	�0�Ac��	|jdd�}d}tt�t��}d}t	|�}	t||t�}	||}|dk(r|dz
}�#|tvr!t|||||�}t||t�}nr|dk(r[	||dz}|jj�|dk(rt|||�\}}nt|||�\}}t||t�}n|dk7r
t||d��t||�}	||}|dk7r
t||d	��|dz
}��#t$rY|j j"SwxYw#t$rd}Y��wxYw#t$rY|j j"SwxYw)
Nz
rrr(r	�[�#zInvalid statementz5Expected newline or end of document after a statement)�replace�Output�
NestedDict�Flags�make_safe_parse_float�
skip_chars�TOML_WS�
IndexError�KEY_INITIAL_CHARS�key_value_rule�flags�finalize_pending�create_list_rule�create_dict_rule�suffixed_err�skip_comment�data�dict)r4r+�src�pos�out�header�char�second_chars        rr1r1Es���#��)�)�F�D�
!�C�
�C�
���u�w�
'�C��F�'��4�K����c�7�+��	��s�8�D��4�<��1�H�C���$�$� ��c�3���D�C��S�#�w�/�C�
�S�[�
#�*-�c�A�g�,��
�I�I�&�&�(��c�!�.�s�C��=���V�.�s�C��=���V��S�#�w�/�C�
�S�[��s�C�)<�=�=��3��$��	��s�8�D��4�<���S�Q��
�	�q���a���	��F�8�8�=�=��I	���
#�"��
#��"�	���8�8�=�=��	�s6�D'�E�
E�'	E�E�E�E�	E=�<E=c�F�eZdZ	dZdZd
d�Zdd�Zd
d�Zdd�Zd
d�Z	dd�Z
y	)r<rr	c�0�i|_t�|_yr)�_flags�set�_pending_flags��selfs r�__init__zFlags.__init__�s��')���47�E��r)c�>�|jj||f�yr)rU�add�rW�key�flags   r�add_pendingzFlags.add_pending�s��������d��,r)c��|jD]\}}|j||d���|jj�y)NF��	recursive)rUrT�clearr[s   rrDzFlags.finalize_pending�s:���,�,�I�C���H�H�S�$�%�H�0�-����!�!�#r)c�v�|j}|ddD]}||vry||d}�|j|dd�y)N����nested)rS�pop)rWr\�cont�ks    r�	unset_allzFlags.unset_all�sG���{�{���S�b��A���}����7�8�$�D��	
����R��$�r)c��|j}|dd|d}}|D]'}||vrt�t�id�||<||d}�)||vrt�t�id�||<|||rdndj|�y)Nrd)rC�recursive_flagsrererkrC)rSrTrZ)rWr\r]rarg�
key_parent�key_stemrhs        rrTz	Flags.set�s����{�{��"�3�B�x��R��H�
��A���}�$'�E�c�e�r�R��Q����7�8�$�D���4��'*�u���RT�U�D��N��X��I�(�7�C�G�G��Mr)c��|sy|j}|ddD]}||vry||}||dvry|d}�|d}||vr||}||dvxs||dvSy)NFrdrkTrerC)rS)rWr\r]rgrh�
inner_contrms       r�is_z	Flags.is_�s������{�{���S�b��A���}���a��J��z�"3�4�4���h�'�D�
��r�7���t����>�D��4��=�(�K�D�D�9J�4K�,K�K�r)N��return�None)r\rr]�intrrrs�r\rrrrs)r\rr]rtra�boolrrrs)r\rr]rtrrrv)r%r&r'�FROZEN�
EXPLICIT_NESTrXr^rDrirTrpr(r)rr<r<�s2��3��F��M�:�-�$�
 �	N�r)r<c�4�eZdZdd�Zdd�					dd�Zd	d�Zy)
r;c��i|_yr)rJrVs rrXzNestedDict.__init__�s	��$&��	r)T��access_listsc��|j}|D]B}||vri||<||}|rt|t�r|d}t|t�r�9td��|S)Nrdz There is no nest behind this key)rJ�
isinstance�list�KeyError)rWr\r|rgrhs     r�get_or_create_nestzNestedDict.get_or_create_nest�sb���I�I���A���}���Q����7�D��
�4�� 6��B�x���d�D�)��A�B�B���r)c��|j|dd�}|d}||vr2||}t|t�std��|j	i�yig||<y)Nrdz/An object other than list found behind this key)r�r~rr��append)rWr\rg�last_key�list_s     r�append_nest_to_listzNestedDict.append_nest_to_list�s_���&�&�s�3�B�x�0���r�7���t����N�E��e�T�*��P�Q�Q��L�L��� �T�D��Nr)Nrq)r\rr|rvrrrJru)r%r&r'rXr�r�r(r)rr;r;�s2��'�"�	�
���	�

��"	"r)r;c�"�eZdZUded<ded<y)r:r;rIr<rCN)r%r&r'�__annotations__r(r)rr:r:�s
��
���Lr)r:c�P�	|||vr
|dz
}|||vr�
|S#t$rY|SwxYw)Nr	)r@)rKrL�charss   rr>r>�sJ��
��#�h�%���1�H�C��#�h�%���J���
���J�
�s��	%�%c��	|j||�}|j	|||�s'|||vr
|dz
}|||vr�
t||d||����|S#t$r!t|�}|rt||d|���d�Y�fwxYw)Nz	Expected r	zFound invalid character )�index�
ValueError�lenrG�
isdisjoint)rKrL�expect�error_on�error_on_eof�new_poss      r�
skip_untilr��s���O��)�)�F�C�(�����s�3�w�/�0��#�h�h�&��1�H�C��#�h�h�&��3��'?��C��|�%L�M�M��N���O��c�(����s�G�y��
�-C�D�$�N��O�s�A�'A;�:A;c�l�	||}|dk(rt||dzdtd��S|S#t$rd}Y�+wxYw)Nr8r	rF�r�r�)r@r��ILLEGAL_COMMENT_CHARS)rKrLrOs   rrHrHsS����s�8���s�{����q��$�)>�U�
�	
��J��
�����s�%�3�3c�R�	|}t||t�}t||�}||k(r|S�'r)r>�TOML_WS_AND_NEWLINErH)rKrL�pos_before_skips   r�skip_comments_and_array_wsr�s7��
�����c�#6�7���3��$���/�!��J�r)c�(�|dz
}t||t�}t||�\}}|jj	|t
j�s*|jj	|t
j�rt||d|�d���|jj|t
jd��	|jj|�|jd|�s
t||d��|dz|fS#t$rt||d�d�wxYw)	Nr	zCannot declare z twiceFr`�Cannot overwrite a value�]z.Expected ']' at the end of a table declaration)r>r?�	parse_keyrCrpr<rxrwrGrTrIr�r��
startswith�rKrLrMr\s    rrFrFs����1�H�C�
�S�#�w�
'�C���c�"�H�C��
�y�y�}�}�S�%�-�-�.�#�)�)�-�-��U�\�\�2R��3���s�e�6�%B�C�C��I�I�M�M�#�u�*�*�e�M�<�K����#�#�C�(��>�>�#�s�#��3��%U�V�V���7�C�<����K��3��%?�@�d�J�K�s�8C9�9Dc��|dz
}t||t�}t||�\}}|jj	|t
j�rt||d|����|jj|�|jj|t
jd��	|jj|�|jd|�s
t||d��|dz|fS#t$rt||d�d�wxYw)N��"Cannot mutate immutable namespace Fr`r�z]]z0Expected ']]' at the end of an array declaration)r>r?r�rCrpr<rwrGrirTrxrIr�r�r�r�s    rrErE.s����1�H�C�
�S�#�w�
'�C���c�"�H�C��
�y�y�}�}�S�%�,�,�'��3��'I�#��%O�P�P��I�I������I�I�M�M�#�u�*�*�e�M�<�K����$�$�S�)��>�>�$��$��3��%W�X�X���7�C�<����K��3��%?�@�d�J�K�s�(C)�)Dc����t|||�\}�}�dd�d}}�|z}��fd�tdt���D�}	|	D]f}
|jj	|
t
j�rt||d|
����|jj|
t
j��h|jj	|t
j�rt||d|����	|jj|�}||vr
t||d��t|ttf�r/|jj!��zt
jd��|||<|S#t$rt||d�d�wxYw)	Nrdc3�.�K�|]}��d|z���y�wrr()rrrNr\s  ��rrz!key_value_rule.<locals>.<genexpr>Js�����L�9K�A�v��B�Q��/�9K�s�r	zCannot redefine namespace r�r�Tr`)�parse_key_value_pair�ranger�rCrpr<rxrGr^rwrIr�r�r~rJrrT)
rKrLrMrNr+�valuerlrm�abs_key_parent�relative_path_cont_keys�cont_key�nestr\s
   `        @rrBrBCsi���+�3��[�A�O�C��e��s��8�S��W��J��j�(�N�L��q�#�c�(�9K�L��+���9�9�=�=��5�#6�#6�7��s�C�+E�h�Z�)P�Q�Q�	�	�	���h��(;�(;�<�
,��y�y�}�}�^�U�\�\�2����:�>�:J�K�
�	
�K��x�x�*�*�>�:���4���3��%?�@�@��%�$���&��	�	�
�
�f�s�l�E�L�L�D�
�A��D��N��J���K��3��%?�@�d�J�K�s�(E � E8c���t||�\}}	||}|dk7r
t||d��|dz
}t||t�}t|||�\}}|||fS#t$rd}Y�JwxYw)N�=z,Expected '=' after a key in a key/value pairr	)r�r@rGr>r?�parse_value)rKrLr+r\rOr�s      rr�r�es�����c�"�H�C����s�8���s�{��3��%S�T�T��1�H�C�
�S�#�w�
'�C��S�#�{�3�J�C����U�?��������s�A�A!� A!c��t||�\}}|f}t||t�}		||}|dk7r||fS|dz
}t||t�}t||�\}}||fz
}t||t�}�L#t$rd}Y�SwxYw)N�.r	)�parse_key_partr>r?r@)rKrL�key_partr\rOs     rr�r�us���"�3��,�M�C���{�C�
�S�#�w�
'�C�
�	�"�3�x�D��3�;���8�O��q�����c�7�+��&�s�C�0�
��X���{�����c�7�+�����	��D�	�s�A1�1A?�>A?c���	||}|tvr|}t||t�}||||fS|dk(rt||�S|dk(rt	||�St||d��#t$rd}Y�^wxYw)N�'r!z(Invalid initial character for a key part)r@�BARE_KEY_CHARSr>�parse_literal_str�parse_one_line_basic_strrG)rKrLrO�	start_poss    rr�r��s�����s�8���~���	���c�>�2���C�	�#�&�&�&��s�{� ��c�*�*��s�{�'��S�1�1�
�s�C�!K�
L�L�������s�A�A&�%A&c�(�|dz
}t||d��S)Nr	F��	multiline)�parse_basic_str�rKrLs  rr�r��s���1�H�C��3��u�5�5r)c�X�|dz
}g}t||�}|jd|�r|dz|fS	t|||�\}}|j|�t||�}|||dz}|dk(r|dz|fS|dk7r
t	||d��|dz
}t||�}|jd|�r|dz|fS�~)Nr	r��,zUnclosed array)r�r�r�r�rG)rKrLr+�array�val�cs      r�parse_arrayr��s����1�H�C��E�
$�S�#�
.�C�
�~�~�c�3���Q�w��~��
��s�C��5���S�
���S��(��c�2����c�A�g�����8���7�E�>�!���8��s�C�)9�:�:��q���(��c�2���>�>�#�s�#���7�E�>�!�r)c���|dz
}t�}t�}t||t�}|j	d|�r|dz|j
fS	t
|||�\}}}|dd|d}}|j|tj�rt||d|����	|j|d��}	||	vrt||d	|����||	|<t||t�}|||dz}
|
dk(r|dz|j
fS|
d
k7r
t||d��t|t
tf�r"|j|tjd��|dz
}t||t�}��	#t$rt||d�d�wxYw)
Nr	�}Trdr�Fr{r�zDuplicate inline table key r�zUnclosed inline tabler`)r;r<r>r?r�rJr�rprwrGr�r�r~rrT)rKrLr+�nested_dictrCr\r�rlrmr�r�s           r�parse_inline_tabler��s����1�H�C��,�K��G�E�
�S�#�w�
'�C�
�~�~�c�3���Q�w��(�(�(�(�
�.�s�C��E���S�%�"�3�B�x��R��H�
��9�9�S�%�,�,�'��s�C�+M�c�U�)S�T�T�	O��1�1�*�5�1�Q�D��t���s�C�+F�x�l�)S�T�T���X����c�7�+����c�A�g�����8���7�K�,�,�,�,���8��s�C�)@�A�A��e�d�D�\�*��I�I�c�5�<�<�4�I�8��q�����c�7�+��+���	O��s�C�)C�D�$�N�	O�s�E�E0Fr�c�t�|||dz}|dz
}|rL|dvrH|dk7r.t||t�}	||}|dk7r
t||d��|dz
}t||t�}|dfS|dk(r
t||d	�S|d
k(r
t||d�S	|t|fS#t$r|dfcYSwxYw#t$rt||d�d�wxYw)Nr�>�\	�\ �\
r��rzUnescaped '\' in a stringr	z\u�z\U�)r>r?r@rGr��parse_hex_char�BASIC_STR_ESCAPE_REPLACEMENTSr�)rKrLr��	escape_idrOs     r�parse_basic_str_escaper��s���C�#��'�"�I��1�H�C��Y�"9�9�����S�#�w�/�C�
��3�x���t�|�"�3��-I�J�J��1�H�C���c�#6�7���B�w���E���c�3��*�*��E���c�3��*�*�M��1�)�<�<�<���
��B�w��
���M��3��%A�B��L�M�s�B�
B�
B�B�B7c��t||d��S)NTr�)r�r�s  r� parse_basic_str_escape_multiliner��s��!�#�s�d�;�;r)c���||||z}t|�|k7stj|�s
t||d��||z
}t	|d�}t|�s
t||d��|t
|�fS)NzInvalid hex value�z/Escaped character is not a Unicode scalar value)r��HEXDIGIT_CHARS�
issupersetrGrt�is_unicode_scalar_valuer)rKrL�hex_len�hex_str�hex_ints     rr�r��sw���#��g�
�&�G�
�7�|�w��n�&?�&?��&H��3��%8�9�9��7�N�C��'�2��G�"�7�+��3��%V�W�W���G���r)c�L�|dz
}|}t||dtd��}|dz|||fS)Nr	r�Tr�)r��ILLEGAL_LITERAL_STR_CHARS)rKrLr�s   rr�r�s>���1�H�C��I�
��S�#� 9���C���7�C�	�#�&�&�&r)c�,�|dz
}|jd|�r|dz
}|r!d}t||dtd��}|||}|dz}nd}t||d�	�\}}|j||�s||fS|dz
}|j||�s|||zfS|dz
}|||d
zzfS)N�rr	r��'''Tr�r!r�r�)r�r��#ILLEGAL_MULTILINE_LITERAL_STR_CHARSr�)rKrL�literal�delim�end_pos�results      r�parse_multiline_strr�	s����1�H�C�
�~�~�d�C� ��q����������8��
���S��!����k����%�c�3�$�?���V��>�>�%��%��F�{���1�H�C��>�>�%��%��F�U�N�"�"��1�H�C���%�!�)�$�$�$r)c�l�|r
t}t}nt}t}d}|}		||}|dk(r4|s
|dz||||zfS|j
d|�r
|dz||||zfS|dz
}�@|dk(r||||z
}|||�\}}||z
}|}�a||vrt||d|����|dz
}�z#t$rt||d�d�wxYw)	Nr�zUnterminated stringr!r	�"""r�r"zIllegal character )�!ILLEGAL_MULTILINE_BASIC_STR_CHARSr��ILLEGAL_BASIC_STR_CHARSr�r@rGr�)	rKrLr�r��
parse_escapesr�r�rO�
parsed_escapes	         rr�r�(s���4��8�
�*��.�
�
�F��I�
�	J��s�8�D��3�;���Q�w���Y�s�);� ;�;�;��~�~�e�S�)��Q�w���Y�s�);� ;�;�;��1�H�C���4�<��c�)�C�(�(�F�!.�s�C�!8��C���m�#�F��I���8���s�C�+=�d�X�)F�G�G��q���)���	J��s�C�)>�?�T�I�	J�s�B�B3c��	||}|dk(r,|jd|�rt||d��St||�S|dk(r,|jd|�rt||d��St	||�S|dk(r|jd	|�r|d
zdfS|dk(r|jd|�r|d
zdfS|dk(r
t|||�S|dk(r
t
|||�Stj||�}|r	t|�}|j�|fStj||�}|r|j�t|�fStj||�}|r|j�t!||�fS|||dz}	|	dvr
|dz||	�fS|||d
z}
|
dvr
|d
z||
�fSt||d��#t$rd}Y���wxYw#t$r}t||d�|�d}~wwxYw)Nr!r�F)r�r�r�T�t�truer��f�false�r7�{zInvalid date or datetimer�>�inf�nan>�+inf�+nan�-inf�-nanz
Invalid value)r@r�r�r�r�r�r�r
�matchr
r�rG�endrrrr)rKrLr+rO�datetime_match�datetime_obj�e�localtime_match�number_match�first_three�
first_fours           rr�r�Hs1����s�8���s�{��>�>�%��%�&�s�C��?�?�'��S�1�1��s�{��>�>�%��%�&�s�C��>�>� ��c�*�*��s�{��>�>�&�#�&���7�D�=� ��s�{��>�>�'�3�'���7�E�>�!��s�{��3��[�1�1��s�{�!�#�s�K�8�8�!�&�&�s�C�0�N��	L�,�^�<�L��!�!�#�\�1�1�"�(�(��c�2�O���"�"�$�&8��&I�I�I�
�?�?�3��,�L�����!�?�<��#M�M�M��c�C�!�G�$�K��n�$��Q�w��K�0�0�0��S�3��7�#�J��5�5��Q�w��J�/�/�/�
�s�C��
1�1��y������L�	L��s�C�)C�D�!�K��	L�s)�F%�"F7�%F4�3F4�7	G�G�Gc�<�	dd�}t|�d|||��d��S)Nc��|t|�k\ry|jdd|�dz}|dk(r|dz}n||jdd|�z
}d|�d|��S)Nzend of documentrrr	zline z	, column )r��count�rindex)rKrL�line�columns    r�
coord_reprz suffixed_err.<locals>.coord_repr�sa���#�c�(�?�$��y�y��q�#�&��*���1�9��1�W�F��3�:�:�d�A�s�3�3�F��t�f�I�f�X�.�.r)z (at �))rK�strrLrrrr)r$)rKrL�msgrs    rrGrG�s.���/��c�U�%�
�3��(<�'=�Q�?�@�@r)c�F�d|cxkxrdkncxsd|cxkxrdkScS)Nri��i�i��r()�	codepoints rr�r��s'��
��#�e�#�G��)�)F�w�)F�G�)F�Gr)c�2��	�turtSd�fd�}|S)Nc�Z���|�}t|ttf�rtd��|S)Nz*parse_float must not return dicts or lists)r~rJrr�)�	float_str�float_valuer+s  �r�safe_parse_floatz/make_safe_parse_float.<locals>.safe_parse_float�s-���!�)�,���k�D�$�<�0��I�J�J��r))rrrrr)�float)r+rs` rr=r=�s$�����e������r))r2rr+rrr�dict[str, Any])r4rr+rrrr)rKrrLrr�z
Iterable[str]rrr)rKrrLrr�rr�zfrozenset[str]r�rvrrr)rKrrLrrrr)rKrrLrrMr:rr�tuple[Pos, Key])rKrrLrrMr:rNrr+rrrr)rKrrLrr+rrrztuple[Pos, Key, Any])rKrrLrrrr)rKrrLrrr�tuple[Pos, str])rKrrLrr+rrrztuple[Pos, list])rKrrLrr+rrrztuple[Pos, dict])rKrrLrr�rvrrr)rKrrLrr�rtrrr)rKrrLrr�rvrrr)rKrrLrr+rrrztuple[Pos, Any])rKrrLrrrrrr$)rrtrrrv)r+rrrr)G�
__future__r�collections.abcr�string�typesr�typingrrr�_rer
rrr
rr�_typesrrr�	frozensetr�r�
ASCII_CTRLr�r�r�r�r�r?r��
ascii_letters�digitsr�rA�	hexdigitsr�r�r�r$rr5r1r<r;r:r>r�rHr�rFrErBr�r�r�r�r�r�r�r�r�r�r�r�r�rGr�r=r(r)r�<module>r's���
#�$�
�"�,�,���)�(�
�1�u�R�y�1�
1�I�c�#�h�4G�
G�
�%�y���6��$.��6�1B�$B�!�3��&G�#�/��
�E�
���	�$��/���6�/�/�&�-�-�?�$�F�G��"�Y�u�%5�5���6�+�+�,�� 0���������
!��;�j�;�8=�	-�38�?�D7�7�t"�"�D�Z��
��	��	��
��
���
�	��,	���$�*�	����#��-0��?I����D
�	�
��
�%/�
��
� ,�$
M� 6�
"�0,�B.3�M�	�M��M�&*�M��M�:<��'�%�>�@A2�	�A2��A2�%/�A2��A2�HA�"H�r)

?>