ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/git/objects/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/git/objects/__pycache__/tree.cpython-311.pyc

�

�܋f�7���UddlmZmZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
ddlmZdd	lmZmZdd
lmZmZmZmZmZmZmZmZmZmZmZddlm Z m!Z!erddl"m#Z#dd
l$m%Z%ee&e'e(fZ)eeedeedfZ*d�Z+ee(e(ge'fe,d<dZ-de)de)de'fd�Z.dee)dee)e)ge'fddfd�Z/Gd�de0��Z1Gd�de
ej2ej3ej4��Z5e5e5j6e5j7<dS)�)�IterableList�	join_pathN)�
to_bin_sha�)�util)�IndexObject�
IndexObjUnion)�Blob)�	Submodule)�tree_entries_from_data�tree_to_stream)�Any�Callable�Dict�Iterable�Iterator�List�Tuple�Type�Union�cast�
TYPE_CHECKING)�PathLike�Literal)�Repo)�BytesIO)�TreeN)rrc��||k||kz
S�N�)�a�bs  �a/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/objects/tree.py�<lambda>r$4s��q�1�u��Q��.?���cmp)�TreeModifierr�t1�t2�returnc���|d|d}}t|��t|��}}t||��}t|d|�|d|���}|r|S||z
S)N�)�len�minr&)r(r)r!r"�len_a�len_b�min_len�min_cmps        r#�git_cmpr39sm��
�a�5�"�Q�%�q�A��q�6�6�3�q�6�6�5�E��%����G��!�H�W�H�+�q��'��{�+�+�G������5�=�r%r!c���t|��dkrdSt|��dz}|d|�}||d�}t||��t||��d}d}d}|t|��kr{|t|��krh|||||��dkr||||<|dz}n||||<|dz}|dz}|t|��kr|t|��k�h|t|��kr(||||<|dz}|dz}|t|��k�(|t|��kr*||||<|dz}|dz}|t|��k�(dSdS)Nr,rr)r-�
merge_sort)r!r&�mid�lefthalf�	righthalf�i�j�ks        r#r5r5Fs���
�1�v�v��z�z��t�

�a�&�&�A�+�C���#��w�H��#�$�$��I��x������y�#����	�A�	�A�	�A�
�c�(�m�m�
�
��C�	�N�N� 2� 2��3�x��{�I�a�L�)�)�Q�.�.��A�;�A�a�D��A��A�A��Q�<�A�a�D��A��A�
��E���c�(�m�m�
�
��C�	�N�N� 2� 2��c�(�m�m�
�
���{��!��
��E��
��E���c�(�m�m�
�
�
�c�)�n�n�
�
���|��!��
��E��
��E���c�)�n�n�
�
�
�
�
�
r%c��eZdZdZdZdeeddfd�Zdede	fd�Z
dd	�Zddede	ded
e
ddf
d�Zdede	deddfd�Zdeddfd�ZdS)r'z�A utility class providing methods to alter the underlying cache in a list-like fashion.

    Once all adjustments are complete, the _cache, which really is a reference to
    the cache of a tree, will be sorted. Assuring it will be in a serializable state�_cache�cacher*Nc��||_dSr)r=)�selfr>s  r#�__init__zTreeModifier.__init__rs
������r%�namec�Z�t|j��D]\}}|d|kr|cS�dS)z7:return: index of an item with name, or -1 if not foundr,���)�	enumerater=)r@rBr9�ts    r#�_index_by_namezTreeModifier._index_by_nameusA���d�k�*�*�	�	�D�A�q���t�t�|�|�������rr%c�:�t|jt��|S)z�Call this method once you are done modifying the tree information.
        It may be called several times, but be aware that each call will cause
        a sort operation

        :return self:)r5r=r3�r@s r#�set_donezTreeModifier.set_dones��	�4�;��(�(�(��r%F�sha�mode�forcec��d|vrtd���|dz	tjvrtd|z���t|��}|�|��}|||f}|dkr|j�|��nD|r||j|<n7|j|}|d|ks|d|krtd|z���|S)	aAAdd the given item to the tree. If an item with the given name already
        exists, nothing will be done, but a ValueError will be raised if the
        sha and mode of the existing item do not match the one you add, unless
        force is True

        :param sha: The 20 or 40 byte sha of the item to add
        :param mode: int representing the stat compatible mode of the item
        :param force: If True, an item with your name and information will overwrite
            any existing item with the same name, no matter which information it has
        :return: self�/z$Name must not contain '/' characters�z(Invalid object type according to mode %orDrrz)Item %r existed with different properties)�
ValueErrorr�_map_id_to_typerrGr=�append)r@rKrLrBrM�index�item�ex_items        r#�addzTreeModifier.add�s����$�;�;��C�D�D�D��B�J�t�3�3�3��G�$�N�O�O�O���o�o���#�#�D�)�)���T�4� ���B�;�;��K���t�$�$�$�$��
Y�%)���E�"�"��+�e�,���1�:��$�$���
�d�(:�(:�$�%P�SW�%W�X�X�X��r%�binshac���t|t��r*t|t��rt|t��sJ�|||f}|j�|��dS)z�Add the given item to the tree, its correctness is assumed, which
        puts the caller into responsibility to assure the input is correct.
        For more information on the parameters, see ``add``

        :param binsha: 20 byte binary shaN)�
isinstance�bytes�int�strr=rS)r@rXrLrB�
tree_caches     r#�
add_uncheckedzTreeModifier.add_unchecked�sb���&�%�(�(�\�Z��c�-B�-B�\�z�RV�X[�G\�G\�\�\�\��d�D�)�
�����:�&�&�&�&�&r%c�P�|�|��}|dkr
|j|=dSdS)z0Deletes an item with the given name if it existsrDN)rGr=)r@rBrTs   r#�__delitem__zTreeModifier.__delitem__�s5���#�#�D�)�)���2�:�:���E�"�"�"��:r%)r*r')F)�__name__�
__module__�__qualname__�__doc__�	__slots__r�TreeCacheTuprAr]r\rGrJr[�boolrWr_rar r%r#r'r'is������X�X�
�I��d�<�0��T������3��3���������"�"�u�"�C�"�s�"�4�"�N�"�"�"�"�H	'�E�	'��	'�C�	'�D�	'�	'�	'�	'�#��#��#�#�#�#�#�#r%r'c�H��eZdZUdZdZeded<dZdZdZ	dZ
dZeee	e
e
e
iZeeeefed	<ed
zdfdd
dededeedff�fd�
Zededeededffd���Zdeddf�fd�Zdeedeefd�Zdedefd�Z dedefd�Z!e"de#dfd���Z$e"de#e
fd���Z%e"de&fd ���Z'd!�d"�d#d$d%d&d%fd'e(eee)fege*fd(e(eee)fege*fd)ed*e*d+e*d,ed-e*deeeee)ff�fd.�
Z+d/e,d0e,de-ef�fd1�Z.d2ed3ede#efd4�Z/deefd5�Z0defd6�Z1d7eeee2fdefd8�Z3d7eeefde*fd9�Z4deefd:�Z5d?d=�Z6d?d>�Z7�xZ8S)@rz�Tree objects represent an ordered list of Blobs and other Trees.

    ``Tree as a list``::

        Access a specific blob using the
        tree['filename'] notation.

        You may as well access by index
        blob = tree[0]
    �tree�typer=���
�rRrPN�reporrXrL�pathc�^��tt|���||||��dSr)�superrrA)r@rprXrLrq�	__class__s     �r#rAz
Tree.__init__�s/���	�d�D���"�"�4���t�<�<�<�<�<r%�index_objectr*)r.r c�j�|jdkr't|�|j����SdS)Nrjr )rk�tuple�_iter_convert_to_objectr=)�clsrus  r#�_get_intermediate_itemszTree._get_intermediate_items�s6��
���&�&���=�=�l�>Q�R�R�S�S�S��rr%�attrc���|dkrL|jj�|j��}t	|�����|_dStt|���	|��dS)Nr=)
rp�odb�streamrXr�readr=rsr�_set_cache_)r@r{�ostreamrts   �r#r�zTree._set_cache_�sf����8����i�m�*�*�4�;�7�7�G�.D�W�\�\�^�^�.T�.T�D�K�K�K��$����)�)�$�/�/�/�/�/r%�iterablec#��K�|D]f\}}}t|j|��}	|j|dz	|j|||��V��@#t$r}td||fz��|�d}~wwxYwdS)zwIterable yields tuples of (binsha, mode, name), which will be converted
        to the respective object representationrPz0Unknown mode %o found in tree data for path '%s'N)rrqrRrp�KeyError�	TypeError)r@r�rXrLrBrq�es       r#rxzTree._iter_convert_to_object�s�����#+�	j�	j��F�D�$��T�Y��-�-�D�
j�6�d�*�4�2�:�6�t�y�&�$�PT�U�U�U�U�U�U���
j�
j�
j�� R�VZ�\`�Ua� a�b�b�hi�i�����
j����		j�	js�#A�
A)�A$�$A)�filec��d}d|vr�|}|}|�d��}t|��D]F\}}||}|jdkr|}�|t|��dz
krt	||z���|cS||krt	||z���|S|jD]\}|d|krN|j|ddz	|j|d|dt|j	|d����cS�]t	||z���)z�Find the named object in this tree's contents

        :return: ``git.Blob`` or ``git.Tree`` or ``git.Submodule``
        :raise KeyError: if given file or tree does not exist in treezBlob or Tree named %r not foundrOrjrr,rPr)
�splitrErkr-r�r=rRrprrq)	r@r��msgrjrU�tokensr9�token�infos	         r#�joinz	Tree.joins?��
0���$�;�;��D��D��Z�Z��_�_�F�%�f�-�-�
 �
 ���5��E�{���9��&�&��D�D��C��K�K�!�O�+�+�&�s�T�z�2�2�2��K�K�K��t�|�|��s�T�z�*�*�*��K���
�
����7�d�?�?�>�4�/��Q��2�
�>��	�4��7�D��G�Y�t�y�$�q�'�5R�5R������#�
�3��:�&�&�&r%c�,�|�|��S)zFor PY3 only)r�)r@r�s  r#�__truediv__zTree.__truediv__(s���y�y����r%c��d�|D��S)z?:return: list(Tree, ...) list of trees directly below this treec�(�g|]}|jdk�
|��S)rj�rk��.0r9s  r#�
<listcomp>zTree.trees.<locals>.<listcomp>/�$��4�4�4�a�1�6�V�#3�#3��#3�#3�#3r%r rIs r#�treesz
Tree.trees,���5�4�4�4�4�4�4r%c��d�|D��S)z?:return: list(Blob, ...) list of blobs directly below this treec�(�g|]}|jdk�
|��S)�blobr�r�s  r#r�zTree.blobs.<locals>.<listcomp>4r�r%r rIs r#�blobsz
Tree.blobs1r�r%c�*�t|j��S)aM
        :return: An object allowing to modify the internal cache. This can be used
            to change the tree's contents. When done, make sure you call ``set_done``
            on the tree modifier, or serialization behaviour will be incorrect.
            See the ``TreeModifier`` for more information on how to alter the cache)r'r=rIs r#r>z
Tree.cache6s���D�K�(�(�(r%c��dS)NTr �r9�ds  r#r$z
Tree.<lambda>As��`d�r%c��dS)NFr r�s  r#r$z
Tree.<lambda>Bs��\a�r%rDTFr�	predicate�prune�depth�branch_first�
visit_once�ignore_self�as_edgec����ttttttftt|���||||||����S)z�For documentation, see util.Traversable._traverse()
        Trees are set to visit_once = False to gain more performance in the traversal)rrrr	�TraversedTreeTuprsr�	_traverse)	r@r�r�r�r�r�r�r�rts	        �r#�traversez
Tree.traverse?s^���.��(�=�)�8�4D�+E�E�F��$����'�'�������

�
�

�

�
	
r%�args�kwargsc�D��tt|��j|i|��S)z�
        :return: IterableList with the results of the traversal as produced by
            traverse()
            Tree -> IterableList[Union['Submodule', 'Tree', 'Blob']]
        )rsr�_list_traverse)r@r�r�rts   �r#�
list_traversezTree.list_traversebs'���0�u�T�4� � �/��@��@�@�@r%r9r:c�`�t|�|j||�����Sr)�listrxr=)r@r9r:s   r#�__getslice__zTree.__getslice__ls)���D�0�0���Q�q�S�1A�B�B�C�C�Cr%c�6�|�|j��Sr)rxr=rIs r#�__iter__z
Tree.__iter__os���+�+�D�K�8�8�8r%c�*�t|j��Sr)r-r=rIs r#�__len__zTree.__len__rs���4�;���r%rUc
�V�t|t��rY|j|}|j|ddz	|j|d|dt|j|d����St|t��r|�|��Std|z���)NrrPrr,zInvalid index type: %r)
rZr\r=rRrprrqr]r�r�)r@rUr�s   r#�__getitem__zTree.__getitem__us����d�C� � �	s��;�t�$�D�6�4�'��Q��2�
�6�t�y�$�q�'�4�PQ�7�T]�^b�^g�im�no�ip�Tq�Tq�r�r�r��d�C� � �	#��9�9�T�?�?�"��0�4�7�8�8�8r%c���t|t��r|jD]}|j|dkrdS�n.|j}|jD]}|t||d��krdS� dS)NrTr,F)rZrr=rXrqr)r@rUr�rqs    r#�__contains__zTree.__contains__�s����d�K�(�(�	 ���
 �
 ���;�$�q�'�)�)��4�4�*�
 ��9�D���
 �
 ���9�T�4��7�3�3�3�3��4�4�4��ur%c�P�t|�|j����Sr)�reversedrxr=rIs r#�__reversed__zTree.__reversed__�s ����4�4�T�[�A�A�B�B�Br%r~rc�:�t|j|j��|S)a
Serialize this tree into the stream. Please note that we will assume
        our tree data to be in a sorted state. If this is not the case, serialization
        will not generate a correct tree representation as these are assumed to be sorted
        by algorithms)r
r=�write�r@r~s  r#�
_serializezTree._serialize�s��
	�t�{�F�L�1�1�1��r%c�R�t|�����|_|Sr)rrr=r�s  r#�_deserializezTree._deserialize�s��,�V�[�[�]�]�;�;����r%)r~rr*r)9rbrcrdrerkr�__annotations__rf�	commit_id�blob_id�
symlink_id�tree_idrr
rRrr\rr	r[rrrA�classmethodrrzr]r�rrgrrxr�r��propertyrr�r�r'r>rr�rhr�rrr�r�r�r��slicer�r�r�r�r��
__classcell__)rts@r#rr�s���������	�	�#�D�'�&�/�"�"�"��I��I��G��J��G�	�9����D�7�O�T�#�t�M�2�2�3�����r�M�&*�=�=��=��=��	=�
�H�d�N�#�=�=�=�=�=�=���#��
�u�[�!�5��9�,�	-�����[��0��0��0�0�0�0�0�0�j���0F�j�8�Ta�Kb�j�j�j�j�'��'��'�'�'�'�D���
������5�t�F�|�5�5�5��X�5��5�t�D�z�5�5�5��X�5��)�|�)�)�)��X�)�Te�Sd�Oa�Oa��!� ���!
�!
��U�=�2B�#B�C�S�I�4�O�P�!
���}�.>�>�?��E�t�K�L�!
��	!
�
�!
��
!
��!
��!
�
�x�
�&��1A�(B�B�	C�!
�!
�!
�!
�!
�!
�FA�3�A�#�A�,�}�:U�A�A�A�A�A�A�D�c�D�c�D�d�=�.A�D�D�D�D�9�(�=�1�9�9�9�9� �� � � � �
9��c�3��o� 6�
9�=�
9�
9�
9�
9���}�h�'>�!?��D�����&C�h�}�5�C�C�C�C������������r%r)8�git.utilrr�git.diff�diff�git_diffr�r�baserr	r�r
�submodule.baser�funrr
�typingrrrrrrrrrrr�	git.typesrr�git.repor�iorr[r\r]rgr�r&r��__all__r3r5�objectr'�Diffable�Traversable�SerializablerrRr�r r%r#�<module>r�s���-�,�,�,�,�,�,�,�,�������������������,�,�,�,�,�,�,�,�������%�%�%�%�%�%�7�7�7�7�7�7�7�7�
��������������������������(�'�'�'�'�'�'�'����������������U�C��_�%����u�\�2�M�5�Ia�Cb�b�c�d��"@�!?��X�s�C�j�#�o��?�?�?�
"��
��
�,�
�3�
�
�
�
� �$�|�$� �8�\�<�4P�RU�4U�+V� �[_� � � � �FU#�U#�U#�U#�U#�6�U#�U#�U#�t^�^�^�^�^�;��)�4�+;�T�=N�^�^�^�H&*���T�\�"�"�"r%

Zerion Mini Shell 1.0