Edit File: tree.cpython-311.pyc
� ����s�d�7���������������������������U�d�dl�mZmZ�d�dlmZ�d�dl�mZ�ddlmZ�ddl m Z mZ�ddlm Z �ddlmZ�dd lmZmZ�d�d lmZmZmZmZmZmZmZmZmZmZmZ�d�dlm Z m!Z!�erd�dl"m#Z#�d�d l$m%Z%�ee&e'e(f���������Z)eeed���������eed���������f������������������Z*d��Z+ee(e(ge'f���������e,d<���dZ-de)de)de'fd�Z.dee)���������dee)e)ge'f���������ddfd�Z/�G�d��de0������������Z1�G�d��de ej2��������ej3��������ej4��������������������Z5e5e5j6��������e5j7��������<���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)r���r���c�����������������������|�|k����|�|k�����z ��S��N��)�a�bs��� �a/builddir/build/BUILD/cloudlinux-venv-1.0.2/venv/lib/python3.11/site-packages/git/objects/tree.py�<lambda>r$���4���s������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_cmpr3���9���sm������ �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����������|�������������dk�����rd�S�t����������|�������������dz��}|�d�|����������}|�|d�����������}t����������||�������������t����������||�������������d}d}d}|t����������|������������k�����r{|t����������|������������k�����rh�|||���������||���������������������dk����r||���������|�|<���|dz���}n||���������|�|<���|dz���}|dz���}|t����������|������������k�����r|t����������|������������k������h|t����������|������������k�����r(||���������|�|<���|dz���}|dz���}|t����������|������������k������(|t����������|������������k�����r*||���������|�|<���|dz���}|dz���}|t����������|������������k������(d�S�d�S�)Nr,���r���r���)r-���� merge_sort)r!���r&����mid�lefthalf� righthalf�i�j�ks��� r#���r5���r5���F���s������ �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�������������������������e�Zd�ZdZdZdee���������ddfd�Zdede fd�Z dd �Zddede ded e dd�f d�Zdede 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�����������������������||�_���������d�S�r���)r=���)�selfr>���s��� r#����__init__zTreeModifier.__init__r���s ����������r%����namec������������������Z�����t����������|�j��������������������D�]\��}}|d���������|k����r|c�S��dS�)z7:return: index of an item with name, or -1 if not foundr,������)� enumerater=���)r@���rB���r9����ts��� r#����_index_by_namezTreeModifier._index_by_nameu���sA�������d�k�*�*�� �� �D�A�q���t�t�|�|���������rr%���c������������������:�����t����������|�j��������t�����������������������|�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:)r5���r=���r3����r@���s��� r#����set_donezTreeModifier.set_done���s������� �4�;��(�(�(��r%���F�sha�mode�forcec����������������������d|v�rt����������d�������������|dz ��t����������j��������vrt����������d|z���������������t����������|������������}|����������������������|������������}|||f}|dk����r|�j�����������������������������|�������������nD|r||�j��������|<���n7|�j��������|���������}|d���������|k����s|d���������|k����rt����������d|z���������������|�S�) aA��Add 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 %orD���r���r���z)Item %r existed with different properties)� ValueErrorr����_map_id_to_typer���rG���r=����append)r@���rK���rL���rB���rM����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@���rX���rL���rB���� tree_caches��� r#���� add_uncheckedzTreeModifier.add_unchecked����sb��������&�%�(�(�\�Z��c�-B�-B�\�z�RV�X[�G\�G\�\�\�\��d�D�)� �����:�&�&�&�&�&r%���c������������������P�����|�����������������������|������������}|dk����r |�j��������|=�dS�dS�)z0Deletes an item with the given name if it existsrD���N)rG���r=���)r@���rB���rT���s��� r#����__delitem__zTreeModifier.__delitem__����s5�������#�#�D�)�)���2�:�:���E�"�"�"���:r%���)r*���r'���)F)�__name__� __module__�__qualname__�__doc__� __slots__r����TreeCacheTuprA���r]���r\���rG���rJ���r[����boolrW���r_���ra���r ���r%���r#���r'���r'���i���s�������������X��X� ��I��d�<�0���T����������3���3����������������"��"�u��"�C��"�s��"�4��"�N��"��"��"��"�H '�E�� '��� '�C�� '�D�� '�� '�� '�� '�#���#���#��#��#��#��#��#r%���r'���c��������������������H������e�Zd�ZU�dZdZed���������ed<���dZdZdZ dZ dZeee e e e iZeeee���������f���������ed <���ed z��dfdd dededeedf���������f��fd� Zededeed���������ed���������f���������fd���������������Zdeddf��fd�Zdee���������dee���������fd�Zdedefd�Z dedefd�Z!e"de#d����������fd���������������Z$e"de#e ���������fd���������������Z%e"de&fd ���������������Z'd!��d"��d#d$d%d&d%fd'e(eee)f���������ege*f���������d(e(eee)f���������ege*f���������d)ed*e*d+e*d,ed-e*deee���������ee)���������f���������f��fd.� Z+d/e,d0e,de-e���������f��fd1�Z.d2ed3ede#e���������fd4�Z/dee���������fd5�Z0defd6�Z1d7eeee2f���������defd8�Z3d7eeef���������de*fd9�Z4dee���������fd:�Z5d?d=�Z6d?d>�Z7��xZ8S�)@r���z�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=������������ �������rR���rP���N�repor���rX���rL����pathc������������������^������t����������t����������|����������������������������������||||�������������d�S�r���)�superr���rA���)r@���rp���rX���rL���rq���� __class__s��� �r#���rA���z Tree.__init__����s/�������� �d�D���"�"�4���t�<�<�<�<�<r%����index_objectr*���)r���.r ���c������������������j�����|j���������dk����r't����������|���������������������|j��������������������������������S�dS�)Nrj���r ���)rk����tuple�_iter_convert_to_objectr=���)�clsru���s��� r#����_get_intermediate_itemszTree._get_intermediate_items����s6������ ����&�&���=�=�l�>Q�R�R�S�S�S��rr%����attrc������������������������|dk����rL|�j���������j�����������������������������|�j��������������������}t ����������|�����������������������������������������������|�_��������d�S�t����������t����������|�������������� ��������������������|�������������d�S�)Nr=���) rp����odb�streamrX���r����readr=���rs���r����_set_cache_)r@���r{����ostreamrt���s��� �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}t����������d||fz��������������|�d}~ww�xY�wdS�)zwIterable yields tuples of (binsha, mode, name), which will be converted to the respective object representationrP���z0Unknown mode %o found in tree data for path '%s'N)r���rq���rR���rp����KeyError� TypeError)r@���r����rX���rL���rB���rq����es��� r#���rx���zTree._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|v�r�|�}|�}|����������������������d������������}t����������|������������D�]F\��}}||���������}|j��������dk����r|}�|t����������|������������dz ��k����rt ����������||z���������������|c�S�||�k����rt ����������||z���������������|S�|�j��������D�]\}|d���������|k����rN�|�j��������|d���������dz �����������|�j��������|d���������|d���������t����������|�j ��������|d���������������������������������c�S��]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 foundrO���rj���r���r,���rP���r���) �splitrE���rk���r-���r����r=���rR���rp���r���rq���) r@���r�����msgrj���rU����tokensr9����token�infos ��� r#����joinz Tree.join��s?����� �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�)zFor 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�|�]}|j���������d�k����� |��S�)rj����rk�����.0r9���s��� r#���� <listcomp>zTree.trees.<locals>.<listcomp>/���$������4�4�4�a�1�6�V�#3�#3��#3�#3�#3r%���r ���rI���s��� 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�|�]}|j���������d�k����� |��S�)�blobr����r����s��� r#���r����zTree.blobs.<locals>.<listcomp>4��r����r%���r ���rI���s��� r#����blobsz Tree.blobs1��r����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=���rI���s��� r#���r>���z Tree.cache6��s��������D�K�(�(�(r%���c�����������������������dS�)NTr ����r9����ds��� r#���r$���z Tree.<lambda>A��s������`d��r%���c�����������������������dS�)NFr ���r����s��� r#���r$���z Tree.<lambda>B��s������\a��r%���rD���TFr���� predicate�prune�depth�branch_first� visit_once�ignore_self�as_edgec�������������������������t����������t����������t����������t�������������������t����������t�������������������f���������t����������t����������|����������������������������������||||||������������������������S�)z�For documentation, see util.Traversable._traverse() Trees are set to visit_once = False to gain more performance in the traversal)r���r���r���r ����TraversedTreeTuprs���r���� _traverse) r@���r����r����r����r����r����r����r����rt���s ��� �r#����traversez Tree.traverse?��s^�������.���(�=�)�8�4D�+E�E�F��$����'�'������� �� � �� �� r%����args�kwargsc������������������D�������t����������t����������|�������������j��������|i�|��S�)z� :return: IterableList with the results of the traversal as produced by traverse() Tree -> IterableList[Union['Submodule', 'Tree', 'Blob']] )rs���r����_list_traverse)r@���r����r����rt���s��� �r#���� list_traversezTree.list_traverseb��s'��������0�u�T�4� � �/��@��@�@�@r%���r9���r:���c������������������`�����t����������|����������������������|�j��������||����������������������������������S�r���)�listrx���r=���)r@���r9���r:���s��� r#����__getslice__zTree.__getslice__l��s)�������D�0�0���Q�q�S�1A�B�B�C�C�Cr%���c������������������6�����|�����������������������|�j��������������������S�r���)rx���r=���rI���s��� r#����__iter__z Tree.__iter__o��s�������+�+�D�K�8�8�8r%���c������������������*�����t����������|�j��������������������S�r���)r-���r=���rI���s��� r#����__len__zTree.__len__r��s�������4�;���r%���rU���c����������� �������V����t����������|t����������������������rY|�j��������|���������}�|�j��������|d���������dz �����������|�j��������|d���������|d���������t����������|�j��������|d���������������������������������S�t����������|t����������������������r|����������������������|������������S�t����������d|z���������������)Nr���rP���r���r,���zInvalid index type: %r) rZ���r\���r=���rR���rp���r���rq���r]���r����r����)r@���rU���r����s��� r#����__getitem__zTree.__getitem__u��s��������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|�j��������D�]}|j��������|d���������k����r�dS��n.|�j��������}|�j��������D�]}|t����������||d���������������������k����r�dS�� dS�)Nr���Tr,���F)rZ���r���r=���rX���rq���r���)r@���rU���r����rq���s��� 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��������������������������������S�r���)�reversedrx���r=���rI���s��� r#����__reversed__zTree.__reversed__���s ��������4�4�T�[�A�A�B�B�Br%���r~���r���c������������������:�����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����������|�����������������������������������������������|�_��������|�S�r���)r���r���r=���r����s��� r#����_deserializezTree._deserialize���s������,�V�[�[�]�]�;�;����r%���)r~���r���r*���r���)9rb���rc���rd���re���rk���r����__annotations__rf���� commit_id�blob_id� symlink_id�tree_idr���r ���rR���r���r\���r���r ���r[���r���r���rA����classmethodr���rz���r]���r����r���rg���r���rx���r����r�����propertyr���r����r����r'���r>���r���r����rh���r����r���r���r����r����r����r�����slicer����r����r����r����r����� __classcell__)rt���s���@r#���r���r�������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.utilr���r����git.diff�diff�git_diffr�����r����baser���r ���r����r ����submodule.baser����funr���r ����typingr���r���r���r���r���r���r���r���r���r���r���� git.typesr���r����git.repor����ior���r[���r\���r]���rg���r����r&���r�����__all__r3���r5����objectr'����Diffable�Traversable�Serializabler���rR���r����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%���