%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/tomllib/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/tomllib/__pycache__/_parser.cpython-312.pyc

�

���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  �&/usr/lib/python3.12/tomllib/_parser.py�	<genexpr>rs����1�!�s�1�v�1�s�� ��	z	
z 	�
z-_z"'���
�"�\)z\bz\tz\nz\fz\rz\"z\\c��eZdZdZy)�TOMLDecodeErrorz0An error raised if a document is not valid TOML.N)�__name__�
__module__�__qualname__�__doc__��rr$r$5s��:r*r$��parse_floatc��|j�}	|j�}t	||��S#t$r
td�d�wxYw)z%Parse TOML from a binary file object.zEFile must be opened in binary mode, e.g. use `open('foo.toml', 'rb')`Nr+)�read�decode�AttributeError�	TypeError�loads)�fpr,�b�ss    r�loadr69sP��
���	�A��
�H�H�J��
���,�,��	���S�
��	��s	�/�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)zParse TOML from a string.z
rrr)r	�[N�#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)r5r,�src�pos�out�header�char�second_chars        rr2r2Es���
�)�)�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�H�eZdZdZdZdZdd�Zdd�Zdd�Zd
d�Z	dd�Z
dd	�Zy
)r=z)Flags that map to parsed keys/namespaces.rr	c�0�i|_t�|_yr)�_flags�set�_pending_flags��selfs r�__init__zFlags.__init__�s��')���47�E��r*c�>�|jj||f�yr)rV�add�rX�key�flags   r�add_pendingzFlags.add_pending�s��������d��,r*c��|jD]\}}|j||d���|jj�y)NF��	recursive)rVrU�clearr\s   rrEzFlags.finalize_pending�s?���,�,�	1�I�C���H�H�S�$�%�H�0�	1����!�!�#r*c�v�|j}|ddD]}||vry||d}�|j|dd�y)N����nested)rT�pop)rXr]�cont�ks    r�	unset_allzFlags.unset_all�sL���{�{���S�b��	%�A���}����7�8�$�D�	%�	
����R��$�r*c��|j}|dd|d}}|D]'}||vrt�t�id�||<||d}�)||vrt�t�id�||<|||rdndj|�y)Nre)rD�recursive_flagsrfrfrlrD)rTrUr[)rXr]r^rbrh�
key_parent�key_stemris        rrUz	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)NFrerlTrfrD)rT)rXr]r^rhri�
inner_contrns       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^�intrsrt�r]rrsrt)r]rr^rurb�boolrsrt)r]rr^rursrw)r%r&r'r(�FROZEN�
EXPLICIT_NESTrYr_rErjrUrqr)r*rr=r=�s2��3��F��M�:�-�$�
 �	N�r*r=c�4�eZdZdd�Zdd�					dd�Zd	d�Zy)
r<c��i|_yr)rKrWs rrYzNestedDict.__init__�s	��$&��	r*T��access_listsc��|j}|D]B}||vri||<||}|rt|t�r|d}t|t�r�9td��|S)Nrez There is no nest behind this key)rK�
isinstance�list�KeyError)rXr]r}rhris     r�get_or_create_nestzNestedDict.get_or_create_nest�si���I�I���	C�A���}���Q����7�D��
�4�� 6��B�x���d�D�)��A�B�B�	C��r*c��|j|dd�}|d}||vr2||}t|t�std��|j	i�yig||<y)Nrez/An object other than list found behind this key)r�rr�r��append)rXr]rh�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*Nrr)r]rr}rwrsrKrv)r%r&r'rYr�r�r)r*rr<r<�s2��'�"�	�
���	�

��"	"r*r<c�"�eZdZUded<ded<y)r;r<rJr=rDN)r%r&r'�__annotations__r)r*rr;r;�s
��
���Lr*r;c�P�	|||vr
|dz
}|||vr�
|S#t$rY|SwxYw)Nr	)rA)rLrM�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�lenrH�
isdisjoint)rLrM�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)Nr9r	rF�r�r�)rAr��ILLEGAL_COMMENT_CHARS)rLrMrPs   rrIrIsS����s�8���s�{����q��$�)>�U�
�	
��J��
�����s�%�3�3c�R�	|}t||t�}t||�}||k(r|S�'r)r?�TOML_WS_AND_NEWLINErI)rLrM�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 twiceFra�Cannot overwrite a value�]z.Expected ']' at the end of a table declaration)r?r@�	parse_keyrDrqr=ryrxrHrUrJr�r��
startswith�rLrMrNr]s    rrGrGs����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 Frar�z]]z0Expected ']]' at the end of an array declaration)r?r@r�rDrqr=rxrHrjrUryrJr�r�r�r�s    rrFrF.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)	Nrec3�.�K�|]}��d|z���y�wrr))rrrOr]s  ��rrz!key_value_rule.<locals>.<genexpr>Js�����L�A�v��B�Q��/�L�s�r	zCannot redefine namespace r�r�Tra)�parse_key_value_pair�ranger�rDrqr=ryrHr_rxrJr�r�rrKr�rU)
rLrMrNrOr,�valuermrn�abs_key_parent�relative_path_cont_keys�cont_key�nestr]s
   `        @rrCrCCsn���+�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�rArHr?r@�parse_value)rLrMr,r]rPr�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@rA)rLrM�key_partr]rPs     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)rA�BARE_KEY_CHARSr?�parse_literal_str�parse_one_line_basic_strrH)rLrMrP�	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�rLrMs  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�rH)rLrMr,�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	�}Trer�Fr|r�zDuplicate inline table key r�zUnclosed inline tablera)r<r=r?r@r�rKr�rqrxrHr�r�rr�rU)rLrMr,�nested_dictrDr]r�rmrnr�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@rArHr��parse_hex_char�BASIC_STR_ESCAPE_REPLACEMENTSr�)rLrMr��	escape_idrPs     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�
issupersetrHru�is_unicode_scalar_valuer)rLrM�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)rLrMr�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�)rLrM�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�rArHr�)	rLrMr�r��
parse_escapesr�r�rP�
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�r8�{zInvalid date or datetimer�>�inf�nan>�+inf�+nan�-inf�-nanz
Invalid value)rAr�r�r�r�r�r�r
�matchr
r�rH�endrrrr)rLrMr,rP�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)zZReturn a `TOMLDecodeError` where error message is suffixed with
    coordinates in source.c��|t|�k\ry|jdd|�dz}|dk(r|dz}n||jdd|�z
}d|�d|��S)Nzend of documentrrr	zline z	, column )r��count�rindex)rLrM�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 �))rL�strrMrrsr)r$)rLrM�msgr
s    rrHrH�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�0���turtSd�fd�}|S)a%A decorator to make `parse_float` safe.

    `parse_float` must not return dicts or lists, because these types
    would be mixed with parsed TOML tables and arrays, thus confusing
    the parser. The returned decorated callable raises `ValueError`
    instead of returning illegal types.
    c�Z���|�}t|ttf�rtd��|S)Nz*parse_float must not return dicts or lists)rrKr�r�)�	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*)rrrsr)�float)r,rs` rr>r>�s����e������r*)r3rr,rrs�dict[str, Any])r5rr,rrsr)rLrrMrr�z
Iterable[str]rsr)rLrrMrr�rr�zfrozenset[str]r�rwrsr)rLrrMrrsr)rLrrMrrNr;rs�tuple[Pos, Key])rLrrMrrNr;rOrr,rrsr)rLrrMrr,rrsztuple[Pos, Key, Any])rLrrMrrsr)rLrrMrrs�tuple[Pos, str])rLrrMrr,rrsztuple[Pos, list])rLrrMrr,rrsztuple[Pos, dict])rLrrMrr�rwrsr)rLrrMrr�rursr)rLrrMrr�rwrsr)rLrrMrr,rrsztuple[Pos, Any])rLrrMrrrrsr$)rrursrw)r,rrsr)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�rB�	hexdigitsr�r�r�r$rr6r2r=r<r;r?r�rIr�rGrFrCr�r�r�r�r�r�r�r�r�r�r�r�r�rHr�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*

Zerion Mini Shell 1.0