AlkantarClanX12

Your IP : 18.119.161.216


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/tomlkit/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/tomlkit/__pycache__/container.cpython-311.pyc

�

�܋f n��F�ddlmZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddl
mZdd	l
m
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZe��ZGd�de��ZGd�de��Zdd�ZdS)�)�annotationsN)�Any)�Iterator)�decode)�merge_dicts)�KeyAlreadyPresent)�NonExistentKey)�TOMLKitError)�AoT)�Comment)�Item)�Key)�Null)�	SingleKey)�Table)�Trivia)�
Whitespace)�_CustomDict)�itemc���eZdZdZdNdOd�ZedPd	���ZdQd�ZedQd���ZdRd�Z	dSdTd�Z
dUd�ZdVd�ZdWd�Z
dXd�ZdYd�ZdZd!�Zd[d$�Zd\d%�Zd]d&�Zd^d'�Zd_d)�ZdSd`d.�ZdSd/�ZdSdad0�ZdSd1�ZdVd2�Zdbd4�Zdcd6�Zddd7�Zded8�Zdf�fd:�Zdgd<�Z dhd>�Z!d_d?�Z"d_d@�Z#didC�Z$dD�Z%dE�Z&dF�Z'dG�Z(djdH�Z)djdI�Z*de+ffdkdL�Z,de+ffdldM�Z-�xZ.S)m�	Containerz�
    A container for items within a TOMLDocument.

    This class implements the `dict` interface with copy/deepcopy protocol.
    F�parsed�bool�return�Nonec�>�i|_g|_||_g|_dS�N)�_map�_body�_parsed�_table_keys)�selfrs  �b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/tomlkit/container.py�__init__zContainer.__init__$s%��<>��	�46��
����������list[tuple[Key | None, Item]]c��|jSr�r�r"s r#�bodyzContainer.body*s
���z�r%�dict[str, Any]c��i}|���D]h\}}|��t|t��r|j}t	|d��r|���}||vrt
|||���c|||<�i|S)N�unwrap)�items�
isinstancer�key�hasattrr-r)r"�	unwrapped�k�vs    r#r-zContainer.unwrap.s����	��J�J�L�L�
	!�
	!�D�A�q��y���!�S�!�!�
��E���q�(�#�#�
��H�H�J�J���I�~�~��I�a�L�!�,�,�,�,� �	�!����r%c��i}|jD]R\}}|��|j}|j}t|t��r|j}||vrt|||���M|||<�S|Sr)rr0�valuer/rr)r"�dr3r4s    r#r6zContainer.valueAs{�����J�
	�
	�D�A�q��y����A���A��!�Y�'�'�
��G���A�v�v��A�a�D�!�$�$�$�$���!����r%�parsingc��||_|jD]n\}}t|t��r|j�|���5t|t��r$|jD]}|j�|����odSr)r rr/rr6r8rr*)r"r8�_r4�ts     r#r8zContainer.parsingUs�������J�	-�	-�D�A�q��!�U�#�#�
-������(�(�(�(��A�s�#�#�
-���-�-�A��G�O�O�G�,�,�,�,��	-�	-r%Nr0�Key | Item | strr�Item | Nonec��|�/t|ttf��std���d|}}|�||��S)z�
        Adds an item to the current Container.

        :Example:

        >>> # add a key-value pair
        >>> doc.add('key', 'value')
        >>> # add a comment or whitespace or newline
        >>> doc.add(comment('# comment'))
        Nz8Non comment/whitespace items must have an associated key)r/rr�
ValueError�append)r"r0rs   r#�addz
Container.add_sT���<��c�G�Z�#8�9�9�
� �N�����c��C��{�{�3��%�%�%r%rr6r
c���t|ttf��rtd���|�^}}}d|_ttd��t
��dd���x}}|D]M}d|_ttd��t
��dd���}	|�||	��|	}�N|j|_|�||��|�||��dS)Nz!Can't add a table to a dotted keyTF)�is_super_table)	r/rrr
�_dottedrrr@�sep)
r"r0r6�name�mid�last�table�current�_name�	new_tables
          r#�_handle_dotted_keyzContainer._handle_dotted_keyts����e�e�S�\�*�*�	D��B�C�C�C����s�D�����	�$������5�QU�V�V�V�V����	 �	 �E� �E�M��i��o�o�v�x�x��t�T�T�T�I��N�N�5�)�,�,�,��G�G��7������t�U�#�#�#����D�%� � � ��r%�intc�2�d}t|j��D]|\}\}}t|t��r�t|t��r|���s�Ht|ttf��r|���sn|}�}|dzS�N����)	�	enumeraterr/rr�is_fixedrr�	is_dotted)r"�
last_index�ir3r4s     r#�_get_last_index_before_tablez&Container._get_last_index_before_table�s����
�"�4�:�.�.�		�		�I�A�v��1��!�T�"�"�
���!�Z�(�(�
������
���!�e�S�\�*�*�
�1�;�;�=�=�
����J�J��A�~�r%�Key | str | Nonec��t|t��s|�t|��}t|t��st	|��}|�,|���r|�||��|St|ttf��r|j	�|j
|_	|���}t|t��pt|��}t|t��rW|js|���|jr5|js.|jjs"|s |���sd|j_t|t��r_|jrX|jsQ|���|r;d|djjvs'|s%d|djjz|dj_|���||v�r�|j|}t|t*��r|j|d}n
|j|}|d}t|t���r�t|ttf��st-|���|���r\t|t��s0t||g|j���}|�|||��n|�|��|S|���r:|���st-|���|�|��|S|����r�|����rY|jd|dks.|���s|d���r�|���r|js|���}nt=|j��}|t=|j��kr|�|||��n|� ||��tC||j|��|StEj#|��}|j$j%D]\}	}
|�|	|
���|d|f|jt|t*��r|dn|<|S|d���rtMd���n�|���st-|���nit|t��rEt|t��st-|���|j%D]}|�|���|St-|���t|ttf��}|��|jr�|js�|r|���r�|���}
|
t=|j��kr|�|
||��S|jdd}t|t��s2t|��s#d|jj'vs|jxj'dz
c_'|� ||��|S)z<Similar to :meth:`add` but both key and value must be given.N�
rrQrR)rz!Redefinition of an existing table)(r/rrr
�_item�is_multirMrrrFr0�_previous_itemr�ends_with_whitespacer �invalidate_display_namer�trivia�indentrUr�tupler�is_aot_element�_replacer@�is_aotrCr!rX�len�
_insert_at�_raw_append�OutOfOrderTableProxy�copy�deepcopyr6r*r
�trail)r"r0r�prev�prev_ws�current_idx�current_body_elementrJ�idxr3r4rI�is_tablerV�
previous_items               r#r@zContainer.append�s5���#�s�#�#�	!����C�.�.�C��$��%�%�	���;�;�D��?�s�|�|�~�~�?��#�#�C��.�.�.��K��d�S�%�L�)�)�	 �d�i�.?���D�I��"�"�$�$���T�:�.�.�L�2F�t�2L�2L���d�E�"�"�	*��<�
/��,�,�.�.�.��
�
*���
*�)-��);�
*�?F�
*��
�
���
*�
&*���"��d�C� � �	E�T�Z�	E���	E��(�(�*�*�*��
E�T�T�!�W�^�%:�:�:�g�:�(,�t�A�w�~�/D�(D��Q���%��?�s�d�{�{��)�C�.�K��+�u�-�-�
?�'+�z�+�b�/�'B�$�$�'+�z�+�'>�$�*�1�-�G��$��&�&�G
-�!�'�E�3�<�8�8�1�+�C�0�0�0��&�&�(�(�81�&�g�s�3�3�-�"%�w��o�d�l�"K�"K�"K���
�
�c�3��8�8�8�8����t�,�,�,��K��^�^�%�%�-1��.�.�0�0�5�/��4�4�4��N�N�4�(�(�(��K��+�+�-�-�%1��*�*�,�,�"P�!�,�R�0�4H��4K�K�K�"�}�}���L�3�A�6�@�@�B�B�L� #�}�}���6�t�|�6�&*�&G�&G�&I�&I���&)�$�*�o�o��"�S���_�_�4�4� $����S�$� ?� ?� ?� ?� $� 0� 0��d� ;� ;� ;�1��t�y��~�F�F�F�#'�K�#'�-��"8�"8��$(�J�O�1�1�D�A�q�#�N�N�1�a�0�0�0�0�
2�!�4�g�>�	�
�)�+�u�=�=�-�K��O�O�!,�� $��-�a�0�:�:�<�<�P�*�+N�O�O�O�P��,�,�.�.�1�+�C�0�0�0�1��D�#�&�&�

-�!�'�3�/�/�1�+�C�0�0�0�!�Y�*�*�E��N�N�5�)�)�)�)���'��,�,�,��d�U�C�L�1�1���O��
�
��L�
��
�"%�����
��:�:�<�<�J��C��
�O�O�+�+����z�3��=�=�=� $�
�2��q� 1�
��}�j�9�9�7�+�M�:�:�7��}�3�9�9�9�!�(�.�.�$�6�.�.�����d�#�#�#��r%c�>�||jvr�|j|}t|t��s|f}|j|dd}|�$t|t��st|���|t
|j��fz|j|<nt
|j��|j|<|j�||f��|���r|j	�|��|�&t�||j|j
��|SrP)rr/rcrrrrgr@rsr!�dict�__setitem__r0r6)r"r0rrprJs     r#rizContainer._raw_append!s���$�)����)�C�.�K��k�5�1�1�
-�*�n���j��R��1�!�4�G���z�'�5�'A�'A��'��,�,�,�(�C��
�O�O�+=�=�D�I�c�N�N� ���_�_�D�I�c�N��
���3��+�&�&�&��=�=�?�?�	)���#�#�C�(�(�(��?����T�3�7�D�J�7�7�7��r%rrc��|j|d}|j�|��}|�t|���dt	��f|j|<t|t��rgt|��}|�|��t|��dkr|�
��}nt
|��}||j|<dSt�||j
��|j�
|��dS)NrrR)rr�getr	rr/rc�list�removerg�poprv�__delitem__r0)r"rrr0�indexs    r#�
_remove_atzContainer._remove_at8s����j��o�a� ���	�
�
�c�"�"���=� ��%�%�%�����.��
�3���e�U�#�#�
	���K�K�E��L�L������5�z�z�Q����	�	������e����"�D�I�c�N�N�N����T�3�7�+�+�+��I�M�M�#�����r%�	Key | strc�|�t|t��st|��}|j�|d��}|�t|���t|t��r|D]}dt��f|j|<�ndt��f|j|<t�
||j��|S)z Remove a key from the container.N)r/rrrr|r	rcrrrvr}r0)r"r0rrrWs    r#r{zContainer.removeKs����#�s�#�#�	!��C�.�.�C��i�m�m�C��&�&���;� ��%�%�%��c�5�!�!�	-��
/�
/��!%�t�v�v���
�1�
�
�
/� $�T�V�V�n�D�J�s�O�����s�w�'�'�'��r%�	other_keyrc��|�td���||vrt|���t|t��st	|��}t|t��st	|��}t|��}|j|}t|t��rt|��}|j	|d}d|j
jvr|j
xjdz
c_|j���D]l\}}t|t��r?g}|D]"}	|	|kr|	dz}	|�
|	���#t|��|j|<�Y||kr
|dz|j|<�m|dz|j|<|j	�|dz||f��|�&t�||j|j��|S)Nz$Key cannot be null in insert_after()rRr[)r?r	r/rrr\rrc�maxrrarmr.r@�insertrvrwr0r6)
r"r0r�rrr�current_itemr3r4�new_indices�v_s
          r#�
_insert_afterzContainer._insert_after^s����;��C�D�D�D��d�?�?� ��%�%�%��#�s�#�#�	!��C�.�.�C��)�S�)�)�	-�!�)�,�,�I��T�{�{���i��n���c�5�!�!�	��c�(�(�C��z�#��q�)���|�*�0�0�0���%�%��-�%�%��I�O�O�%�%�	%�	%�D�A�q��!�U�#�#�

%� ���+�+�B��C�x�x��!�V���&�&�r�*�*�*�*�$�[�1�1��	�!����S��� �1�u��	�!���"�Q�w��	�)���
���#��'�I�t�#4�5�5�5��?����T�9�=�$�*�=�=�=��r%c���|t|j��dz
krtd|�����t|t��st|��}t
|��}|dkry|j|dz
d}t|t��sNt|��s?t|ttf��s#d|jjvs|jxjdz
c_|j
���D]l\}}t|t��r?g}|D]"}||kr|dz}|�|���#t|��|j
|<�Y||kr
|dz|j
|<�m||j
vr4|j
|}	t|	t��s|	f}	|	|fz|j
|<n
||j
|<|j�|||f��t$�||j|j��|S)NrRzUnable to insert at position rr[)rgrr?r/rrr\rr_rrrarmrr.rcr@r�rvrwr0r6)
r"rrr0rrtr3r4r�r�rps
          r#rhzContainer._insert_at�s����T�Z���1�$�$�$��B�S�B�B�C�C�C��#�s�#�#�	!��C�.�.�C��T�{�{����7�7� �J�s�Q�w�/��2�M��=�*�5�5�
3�'�
�6�6�
3��d�S�%�L�1�1�
3��=�/�5�5�5��$�*�*�d�2�*�*��I�O�O�%�%�	%�	%�D�A�q��!�U�#�#�

%� ���+�+�B��S�y�y��!�V���&�&�r�*�*�*�*�$�[�1�1��	�!����c��� �1�u��	�!����$�)����)�C�.�K��k�5�1�1�
-�*�n��(�C�6�1�D�I�c�N�N� �D�I�c�N��
���#��T�{�+�+�+�����s�w��
�3�3�3��r%c��t|t��st|��}|j�|��}|�t|���t|t��rt||��S|j|dS)zGet an item for the given key.NrR)	r/rrrryr	rcrjr)r"r0rrs   r#rzContainer.item�sz���#�s�#�#�	!��C�.�.�C��i�m�m�C� � ���;� ��%�%�%��c�5�!�!�	3�(��c�2�2�2��z�#��q�!�!r%c�:�|jr|jddSdS)zGet the last item.rQrRNr(r)s r#�	last_itemzContainer.last_item�s'���:�	%��:�b�>�!�$�$�	%�	%r%�strc�J�d}|jD]�\}}|�xt|t��r||�||��z
}�6t|t��r||�||��z
}�e||�||��z
}�||�||��z
}��|S)zRender as TOML string.�)rr/r�
_render_tabler�_render_aot�_render_simple_item)r"�sr3r4s    r#�	as_stringzContainer.as_string�s������J�		4�		4�D�A�q��}��a��'�'�8���+�+�A�q�1�1�1�A�A���3�'�'�8���)�)�!�Q�/�/�/�A�A���1�1�!�Q�7�7�7�A�A��T�-�-�a��3�3�3����r%rIr�prefix�
str | Nonec	��d}|j�|j}n|���}|�|dz|z}|���r7td�|jjD����r�|���s�d\}}|���rd\}}d|jj	vrt|j��dkrdnd}||jj�|�t|���|�|jj
�t|jj���|jj	�|��z
}n|jjdkr||jjz
}|jjD�]\}	}
t|
t ��r�|
���r^|	���r.|���s||�|	|
��z
}�q||�|	|
|���z
}��||�|	|
|���z
}��t|
t$��r||�|	|
|���z
}��||�|	|
|���r|nd���z
}��
|S)	Nr��.c3�nK�|]0\}}t|ttttf��V��1dSr)r/rrrr)�.0r:r4s   r#�	<genexpr>z*Container._render_table.<locals>.<genexpr>�sP�������A�q��q�5�#�z�4�"@�A�A�A������r%)�[�]�z[[z]]r[r�r�)�display_namer�rC�anyr6r*rUrdrarmrgrbr�
comment_ws�commentr/rr�rr�r�)r"r0rIr��cur�_key�open_�close�newline_in_table_triviar3r4s           r#r�zContainer._render_table�s�������)��%�D�D��=�=�?�?�D��!���|�d�*���#�#�%�%�	'����!�K�,����
�
�	'�
�M�M�O�O�	'�$�L�E�5��#�#�%�%�
*�)���u��E�L�$6�6�6�3�u�{�;K�;K�a�;O�;O���UW�
$�
��<�&�-��-��$�<�<�-��-��<�*�	-�
�%�,�.�/�/�-��<�%�
-�+�-�-�	
�C�C��\�
 �D�
(�
(��5�<�&�&�C��K�$�	�	�D�A�q��!�U�#�#�
��#�#�%�%�A��{�{�}�}�E�S�]�]�_�_�E��t�1�1�!�Q�7�7�7����t�1�1�!�Q�t�1�D�D�D����4�-�-�a��4�-�@�@�@�C�C��A�s�#�#�
��t�'�'��1�T�'�:�:�:����t�/�/��q������!B���d�0�������
r%c��|���}|�|dz|z}d}t|��}|jD]}||�||���z
}�|S)Nr�r�r�)r�rr*�_render_aot_table)r"r0�aotr�r�r�rIs       r#r�zContainer._render_aotsh���}�}�������C�<�$�&�D����d�|�|���X�	>�	>�E��4�)�)�%��)�=�=�=�C�C��
r%c	��d}|pd}d\}}||jj�|�t|���|�|jj�t|jj���|jj��z
}|jjD]�\}}t|t��rz|�
��rJ|���r||�||��z
}�\||�|||���z
}�x||�|||���z
}��t|t��r||�|||���z
}��||�||��z
}��|S)Nr�r�r�)rarbrr�r�rmr6r*r/rrCrUr�rr�r�)	r"rIr�r�r�r�r�r3r4s	         r#r�zContainer._render_aot_table&s������|���!���u���|�"�
$��
$��d�|�|�
$��
$��|�&�	
$�
�e�l�*�+�+�
$��|�!�

$�
$�	
���K�$�
	6�
	6�D�A�q��!�U�#�#�
6��#�#�%�%�A��{�{�}�}�E��t�1�1�!�Q�7�7�7����t�1�1�!�Q�t�1�D�D�D����4�-�-�a��4�-�@�@�@�C�C��A�s�#�#�
6��t�'�'��1�T�'�:�:�:����t�/�/��1�5�5�5����
r%c�V�|�|���S|���}|�|dz|z}|jj�t|���|j�t|������|jj�t|jj���|jj��S)Nr�)r�rarbrrEr�r�rm)r"r0rr�r�s     r#r�zContainer._render_simple_itemFs����;��>�>�#�#�#��}�}�������C�<�$�&�D��{�!�
#��d�|�|�
#��w�
#��d�n�n�&�&�'�'�
#��{�%�	
#�
�d�k�)�*�*�
#��{� �

#�
#�	
r%c�6�t�|��Sr�rv�__len__r)s r#r�zContainer.__len__X����|�|�D�!�!�!r%�
Iterator[str]c�P�tt�|����Sr��iterrv�keysr)s r#�__iter__zContainer.__iter__[����D�I�I�d�O�O�$�$�$r%�Item | Containerc�J�t|t��st|��}|j�|��}|�t|���t|t��rt||��S|j|d}|�	��r|j
S|S�NrR)r/rrrryr	rcrjr�
is_booleanr6)r"r0rrrs    r#�__getitem__zContainer.__getitem___s����#�s�#�#�	!��C�.�.�C��i�m�m�C� � ���;� ��%�%�%��c�5�!�!�	3�(��c�2�2�2��z�#��q�!���?�?���	��:���r%c�����B�|vr>tt�fd�|j����}|�|�|��dS|��|��dS)Nc���|�kSr�)r3r0s �r#�<lambda>z'Container.__setitem__.<locals>.<lambda>us���A��H�r%)�next�filterrrer@)r"r0r6�old_keys `  r#rwzContainer.__setitem__ssi����?�s�d�{�{��6�"4�"4�"4�"4�d�i�@�@�A�A�G��M�M�'�3��.�.�.�.�.��K�K��U�#�#�#�#�#r%c�0�|�|��dSr)r{�r"r0s  r#r}zContainer.__delitem__zs�����C�����r%�defaultc�Z��t���||���||S�N)r���super�
setdefault�r"r0r��	__class__s   �r#r�zContainer.setdefault}�*���
�����3���0�0�0��C�y�r%�new_keyc���t|t��st|��}|j�|��}|�t|���|�|||��dSr)r/rrrryr	�_replace_at)r"r0r�r6rrs     r#rezContainer._replace�sc���#�s�#�#�	!��C�.�.�C��i�m�m�C� � ���;� ��%�%�%�����g�u�-�-�-�-�-r%�int | tuple[int]c��t|��}t|t��r-|dd�D]}dt��f|j|<�|d}|j|\}}t|t
��sWt|ttf��t|ttf��ks||jkrt|��}n|}|j
|=||j
|<||krt�||��t|ttf��t|ttf��kr�|�
|��t|t|j����D]J}t|j|dttf��r|�|||��|}n�Kd}|�||��n�t|t$tf��sp|jj|j_|jjp|jj|j_|jjp|jj|j_|jj|j_||f|j|<t1|d��r|���t|t��r�|���\}}|dkr|n|}t7|��}	||ko(t|j|dzdt$��}
||kr'|
s%|	s#|�dt%d����t�||j|j��dSdS)NrRrrQr`r[)r\r/rcrrrrrr0rrrvr}r{�rangergrhr@rrarbr�r�rmr1r`�_previous_item_with_indexr_rwr6)r"rrr�r6rWr3r4rHr:�has_ws�next_wss           r#r�zContainer._replace_at�s���e�����c�5�!�!�	�����W�
/�
/��!%�t�v�v���
�1�
�
��a�&�C��z�#����1��'�3�'�'�	��5�3��,�/�/�:�a�#�u��3N�3N�N�N��a�e�#�#�#�G�,�,������I�a�L� ��	�'���a�<�<����T�1�%�%�%��e�c�5�\�*�*�j��S�%�L�.I�.I�I�I��K�K��N�N�N��3��D�J���0�0�
,�
,���d�j��m�A�.��e��=�=���O�O�A�w��6�6�6��C��E��
�����G�U�+�+�+���e�j�#�%6�7�7�
4�&'�h�o���#�*/�,�*A�*X�Q�X�EX���'�',�|�';�'O�q�x�?O���$�%&�X�^���"�&��.�D�J�s�O��5�3�4�4�	,��)�)�+�+�+��e�U�#�#�	=��4�4�6�6�G�D�!���'�'�$�$�s�C�)�%�0�0�F��D�j�S�Z��
�3��7�0C�A�0F�
�%S�%S�G��T�z�z�7�z�f�z����T�:�d�#3�#3�4�4�4����T�7�;���<�<�<�<�<�	=�	=r%c�*�t|j��Sr)r�r6r)s r#�__str__zContainer.__str__�s���4�:���r%c�*�t|j��Sr)�reprr6r)s r#�__repr__zContainer.__repr__�s���D�J���r%�otherrvc�P�t|t��stS|j|kSr)r/rv�NotImplementedr6)r"r�s  r#�__eq__zContainer.__eq__�s'���%��&�&�	"�!�!��z�U�"�"r%c��|jfSr)r �r"�protocols  r#�	_getstatezContainer._getstate�s�����r%c�,�|�d��S)N�)�
__reduce_ex__r)s r#�
__reduce__zContainer.__reduce__�s���!�!�!�$�$�$r%c�l�|j|�|��|j|j|j|jffSr)r�r�rrr r!r�s  r#r�zContainer.__reduce_ex__�s5���N��N�N�8�$�$�
�Y��
�D�L�$�2B�C�
�	
r%c���|d|_|d|_|d|_|d|_|jD]-\}}|�&t�||j|j���.dS)NrrRr��)rrr r!rvrwr0r6)r"�stater0rs    r#�__setstate__zContainer.__setstate__�sp���!�H��	��1�X��
��Q�x��� ��8�����	<�	<�I�C����� � ��s�w��
�;�;�;��	<�	<r%c�*�tj|��Sr)rkr)s r#rkzContainer.copy�s���y����r%c��|�|j��}t�|��D]!\}}t�|||���"|xj|jz
c_|j�|j��|Sr)	r�r rvr.rwrr*r�update)r"�cr3r4s    r#�__copy__zContainer.__copy__�s|���N�N�4�<�(�(���J�J�t�$�$�	&�	&�D�A�q����Q��1�%�%�%�%�	���4�9����	��
�
�d�i� � � ��r%�
int | None�tuple[int, Item] | Nonec���|�|t|j��krt|j��}t|dz
dd��D]+}|j|d}t||��s||fcS�,dS)z5Find the immediate previous item before index ``idx``NrRrQ)rgrr�r/)r"rr�ignorerWr4s     r#r�z#Container._previous_item_with_index�s����;�#��D�J���/�/��d�j�/�/�C��s�Q�w��B�'�'�	�	�A��
�1�
�b�!�A��a��(�(�
��!�t����
��tr%c�F�|�||��}|r|dndS)z{Find the immediate previous item before index ``idx``.
        If ``idx`` is not given, the last item is returned.
        rQN)r�)r"rrr�rns    r#r^zContainer._previous_items,���-�-�c�6�:�:���)�t�B�x�x�T�)r%)F)rrrr)rr&)rr+)r8rrrr)r0r<rr=rr)r0rr6r
rr�rrN)r0rYrr
rr)r0rrr
rr)rrrNrr)r0r�rr)r0r�r�r�rrrr)rrrNr0r�rrrr)r0r�rr
)rr=�rr�)r0rrIrr�r�rr�)rIrr�r�rr��rr�)r0r�rr�)r0r�r6rrr�r0r�rr�r0r�r�rrr)r0r�r�r�r6r
rr)rrr�r�r�r6r
rr)r�rvrr)rr)rrr�rr�)rrr�rr=)/�__name__�
__module__�__qualname__�__doc__r$�propertyr*r-r6r8rArMrXr@rirr{r�rhrr�r�r�r�r�r�r�r�r�rwr}r�rer�r�r�r�r�r�r�r�rkr�rr�r^�
__classcell__�r�s@r#rrs��������������������X������&�����X��&-�-�-�-�&�&�&�&�&�*����$����K�K�K�K�Z����.����&����&-�-�-�-�^,�,�,�,�\"�"�"�"�"%�%�%�%�
���� 7�7�7�7�7�r
�
�
�
������@
�
�
�
�$"�"�"�"�%�%�%�%�����($�$�$�$�����������.�.�.�.�<=�<=�<=�<=�|���� � � � �#�#�#�#����%�%�%�
�
�
�<�<�<���������!%�d�W�
�
�
�
�
�04�T�G�*�*�*�*�*�*�*�*�*r%rc�v��eZdZdd�Zdd	�Zed
���Zdd�Zdd�Zdd�Z	d d�Z
d!d�Zd"d�Zd#�fd�Z
�xZS)$rj�	containerr�indices�
tuple[int]rrc���||_td��|_g|_i|_|D]�}|jj|\}}t
|t��r�|j�|��t|j��dz
}|j
jD]M\}}|j�||��||j|<|�!t�
||j|���N��dS)NTrR)�
_containerr�_internal_container�_tables�_tables_maprr/rr@rgr6r*rvrwr0)	r"rrrWr:r�	table_idxr3r4s	         r#r$zOutOfOrderTableProxy.__init__s���#���#,�T�?�?�� ��������
	9�
	9�A��o�+�A�.�G�A�t��$��&�&�
9���#�#�D�)�)�)����-�-��1�	� �J�O�9�9�D�A�q��,�3�3�A�q�9�9�9�*3�D�$�Q�'��}��(�(��q�u�a�8�8�8���
	9�
	9r%r�c�4�|j���Sr)rr-r)s r#r-zOutOfOrderTableProxy.unwrap s���'�.�.�0�0�0r%c��|jjSr)rr6r)s r#r6zOutOfOrderTableProxy.value#s���'�-�-r%r0r�rc�L�||jvrt|���|j|Sr)rr	r�s  r#r�z OutOfOrderTableProxy.__getitem__'s,���d�.�.�.� ��%�%�%��'��,�,r%rc���||jvr|j|j|}|||<n$|jr|jd}|||<n
||j|<||j|<|�t�|||��dSdS)Nr)rr
rrrvrw)r"r0rrIs    r#rwz OutOfOrderTableProxy.__setitem__-s����$�"�"�"��L��!1�#�!6�7�E��E�#�J�J�
�\�	(��L��O�E��E�#�J�J�#'�D�O�C� �(,�� ��%��?����T�3��-�-�-�-�-��?r%rIrc���|j�|��t|jj��D],\}}|d|ur|j�|��dS�-dS)z&Remove table from the parent containerrRN)r
r{rSrrr)r"rIrrrs    r#�
_remove_tablez"OutOfOrderTableProxy._remove_table;ss������E�"�"�"�"�4�?�#8�9�9�	�	�I�C���A�w�%�����*�*�3�/�/�/���� �	�	r%c�*�||jvrS|j|j|}||=|s-t|j��dkr|�|��|j|=nt	|���|j|=|�t�||��dSdSr�)rr
rgrr	rrvr})r"r0rIs   r#r}z OutOfOrderTableProxy.__delitem__Cs����$�"�"�"��L��!1�#�!6�7�E��c�
��
*�S���.�.��2�2��"�"�5�)�)�)�� ��%�%� ��%�%�%��$�S�)��?����T�3�'�'�'�'�'��?r%r�c�P�tt�|����Srr�r)s r#r�zOutOfOrderTableProxy.__iter__Qr�r%rNc�6�t�|��Srr�r)s r#r�zOutOfOrderTableProxy.__len__Tr�r%r�c�Z��t���||���||Sr�r�r�s   �r#r�zOutOfOrderTableProxy.setdefaultWr�r%)rrrr	rrr�)r0r�rr)r0r�rrrr)rIrrrr�r�r�r�)r�rrr$r-rr6r�rwrr}r�r�r�rrs@r#rjrj
s��������9�9�9�9�$1�1�1�1��.�.��X�.�-�-�-�-�.�.�.�.�����(�(�(�(�%�%�%�%�"�"�"�"����������r%rj�itrrrc�
�t|t��o+t|j���t��pBt|t
��o-t
|��dkot|dt��S)zqReturns ``True`` if the given item ``it`` is a ``Table`` or ``AoT`` object
    ending with a ``Whitespace``.
    rrQ)r/rr6r^rrrg)rs r#r_r_\si��
	�2�u���S�*�R�X�-D�-D�-F�-F�
�"S�"S�R�
�R��
�
�
P�#�b�'�'�A�+�
P�*�R��V�Z�2P�2P�Rr%)rrrr) �
__future__rrk�typingrr�tomlkit._compatr�tomlkit._utilsr�tomlkit.exceptionsrr	r
�
tomlkit.itemsrrr
rrrrrrrrr\�object�_NOT_SETrrjr_r�r%r#�<module>r$s���"�"�"�"�"�"�����������������"�"�"�"�"�"�&�&�&�&�&�&�0�0�0�0�0�0�-�-�-�-�-�-�+�+�+�+�+�+�������!�!�!�!�!�!�������������������#�#�#�#�#�#������� � � � � � �$�$�$�$�$�$�%�%�%�%�%�%�'�'�'�'�'�'��6�8�8��m*�m*�m*�m*�m*��m*�m*�m*�`L�L�L�L�L�;�L�L�L�^R�R�R�R�R�Rr%