403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/git/objects/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/git/objects/__pycache__/tree.cpython-310.pyc
o

;jJ6�@stddgZddlZddlZddlmZddlmZmZm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZmZdd
lmZddlmZmZmZmZmZmZmZmZmZm Z m!Z!ej"dkrddd
lm#Z#ndd
l$m#Z#ddl%m&Z&er~ddl'm(Z(ddl)m*Z*ee+e,e-fZ.e ee de
edfZ/de-de-de,fdd�Z0Gdd�d�Z1Gdd�deej2ej3ej4�Z5e5e5j6e5j7<dS)�TreeModifier�Tree�N)�IterableList�	join_path�
to_bin_sha�)�util)�
IndexObjUnion�IndexObject)�Blob)�tree_entries_from_data�tree_to_stream)�	Submodule)�Any�Callable�Dict�Iterable�Iterator�List�Tuple�
TYPE_CHECKING�Type�Union�cast)��)�Literal)�PathLike)�BytesIO)�Repo)rN)rr�a�b�returncCs||k||kS�N�)r r!r$r$�D/opt/saltstack/salt/lib/python3.10/site-packages/git/objects/tree.py�cmp7�r&c@s�eZdZdZdZdeeddfdd�Zdede	fd	d
�Z
ddd�Zddede	dede
ddf
dd�Zdede	deddfdd�Zdeddfdd�ZdS)raA utility class providing methods to alter the underlying cache in a list-like
    fashion.

    Once all adjustments are complete, the :attr:`_cache`, which really is a reference
    to the cache of a tree, will be sorted. This ensures it will be in a serializable
    state.
    ��_cache�cacher"NcCs
||_dSr#r()�selfr*r$r$r%�__init__F�
zTreeModifier.__init__�namecCs,t|j�D]\}}|d|kr|SqdS)z7:return: index of an item with name, or -1 if not found����)�	enumerater))r+r.�i�tr$r$r%�_index_by_nameIs
�zTreeModifier._index_by_namecCs|jjdd�d�|S)z�Call this method once you are done modifying the tree information.

        This may be called several times, but be aware that each call will cause a sort
        operation.

        :return:
            self
        cSs&|dtjd>kr|ddS|dS)Nr�r/�/)r�tree_id)�xr$r$r%�<lambda>\s&z'TreeModifier.set_done.<locals>.<lambda>)�key)r)�sort�r+r$r$r%�set_doneSs	zTreeModifier.set_doneF�sha�mode�forcecCs�d|vrtd��|d?tjvrtd|��t|�}|�|�}|||f}|dkr/|j�|�|S|r8||j|<|S|j|}|d|ksI|d|krOtd|��|S)	a�Add the given item to the tree.

        If an item with the given name already exists, nothing will be done, but a
        :exc:`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:
            :class:`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
        r6z$Name must not contain '/' charactersr5z(Invalid object type according to mode %or0rrz)Item %r existed with different properties)�
ValueErrorr�_map_id_to_typerr4r)�append)r+r>r?r.r@�index�itemZex_itemr$r$r%�addbs"

�

�zTreeModifier.add�binshacCs<t|t�rt|t�rt|t�sJ�|||f}|j�|�dS)aAdd the given item to the tree. Its correctness is assumed, so it is the
        caller's responsibility to ensure that the input is correct.

        For more information on the parameters, see :meth:`add`.

        :param binsha:
            20 byte binary sha.
        N)�
isinstance�bytes�int�strr)rC)r+rGr?r.Z
tree_cacher$r$r%�
add_unchecked�s"	
zTreeModifier.add_uncheckedcCs"|�|�}|dkr|j|=dSdS)z0Delete an item with the given name if it exists.r0N)r4r))r+r.rDr$r$r%�__delitem__�s
�zTreeModifier.__delitem__)r"r)F)�__name__�
__module__�__qualname__�__doc__�	__slots__r�TreeCacheTupr,rKrJr4r=rI�boolrFrLrMr$r$r$r%r;s

 ,csxeZdZUdZdZeded<dZdZdZ	dZ
dZeee	e
e
e
iZeeeefed	<ed
>dfdd
dededeedff�fdd�
Zededeededffdd��Zdeddf�fdd�Zdeedeefdd�Zdedefd d!�Z dedefd"d#�Z!e"de#dfd$d%��Z$e"de#e
fd&d'��Z%e"de&fd(d)��Z'd*d+�d,d+�d-d.d/d0d/fd1e(eee)fege*fd2e(eee)fege*fd3ed4e*d5e*d6ed7e*deeeee)ff�fd8d9�
Z+d:e,d;e,de-ef�fd<d=�Z.d>ed?ede#efd@dA�Z/deefdBdC�Z0defdDdE�Z1dFeeee2fdefdGdH�Z3dFeeefde*fdIdJ�Z4deefdKdL�Z5dSdOdP�Z6dSdQdR�Z7�Z8S)Tra�Tree objects represent an ordered list of :class:`~git.objects.blob.Blob`\s and
    other :class:`Tree`\s.

    See :manpage:`gitglossary(7)` on "tree object":
    https://git-scm.com/docs/gitglossary#def_tree_object

    Subscripting is supported, as with a list or dict:

    * Access a specific blob using the ``tree["filename"]`` notation.
    * You may likewise access by index, like ``blob = tree[0]``.
    �tree�typer(�r�
�rBr5N�reporrGr?�pathcst��||||�dSr#)�superr,)r+rZrGr?r[��	__class__r$r%r,�sz
Tree.__init__�index_objectr")r.r$cCs|jdkr
t|�|j��SdS)NrUr$)rV�tuple�_iter_convert_to_objectr))�clsr_r$r$r%�_get_intermediate_items�s
zTree._get_intermediate_items�attrcs:|dkr|jj�|j�}t|���|_dSt��|�dS)Nr))	rZZodb�streamrGr�readr)r\�_set_cache_)r+rdZostreamr]r$r%rg�szTree._set_cache_�iterableccsl�|D]0\}}}t|j|�}z|j|d?|j|||�VWqty3}z	td||f�|�d}~wwdS)z�Iterable yields tuples of (binsha, mode, name), which will be converted to
        the respective object representation.
        r5z0Unknown mode %o found in tree data for path '%s'N)rr[rBrZ�KeyError�	TypeError)r+rhrGr?r.r[�er$r$r%ra�s� ���zTree._iter_convert_to_object�filec		Cs�d}t�|�}d|vrF|}|}|�d�}t|�D]!\}}||}|jdkr(|}q|t|�dkr6t||��|S||krDt||��|S|jD]#}|d|krl|j|dd?|j	|d|dt
|j|d��SqIt||��)a Find the named object in this tree's contents.

        :return:
            :class:`~git.objects.blob.Blob`, :class:`Tree`, or
            :class:`~git.objects.submodule.base.Submodule`

        :raise KeyError:
            If the given file or tree does not exist in this tree.
        zBlob or Tree named %r not foundr6rUrr/r5r)�os�fspath�splitr1rV�lenrir)rBrZrr[)	r+rl�msgrUrE�tokensr2�token�infor$r$r%�join�s.




��z	Tree.joincCs
|�|�S)zaThe ``/`` operator is another syntax for joining.

        See :meth:`join` for details.
        )ru)r+rlr$r$r%�__truediv__s
zTree.__truediv__cC�dd�|D�S)z?:return: list(Tree, ...) List of trees directly below this treecS�g|]	}|jdkr|�qS)rU�rV��.0r2r$r$r%�
<listcomp>�zTree.trees.<locals>.<listcomp>r$r<r$r$r%�trees�z
Tree.treescCrw)z?:return: list(Blob, ...) List of blobs directly below this treecSrx)�blobryrzr$r$r%r|!r}zTree.blobs.<locals>.<listcomp>r$r<r$r$r%�blobsrz
Tree.blobscC�
t|j�S)a�
        :return:
            An object allowing modification of the internal cache. This can be used to
            change the tree's contents. When done, make sure you call
            :meth:`~TreeModifier.set_done` on the tree modifier, or serialization
            behaviour will be incorrect.

        :note:
            See :class:`TreeModifier` for more information on how to alter the cache.
        )rr)r<r$r$r%r*#s
z
Tree.cachecC�dS)NTr$�r2�dr$r$r%r93�z
Tree.<lambda>cCr�)NFr$r�r$r$r%r94r�r0TFr�	predicate�prune�depth�branch_first�
visit_once�ignore_self�as_edgec
s,ttttttft��||||||��S)z�For documentation, see
        `Traversable._traverse() <git.objects.util.Traversable._traverse>`.

        Trees are set to ``visit_once = False`` to gain more performance in the
        traversal.
        )rrrr	�TraversedTreeTupr\Z	_traverse)r+r�r�r�r�r�r�r�r]r$r%�traverse1s��z
Tree.traverse�args�kwargscst�j|i|��S)z�
        :return:
            :class:`~git.util.IterableList` with the results of the traversal as
            produced by :meth:`traverse`

            Tree -> IterableList[Union[Submodule, Tree, Blob]]
        )r\Z_list_traverse)r+r�r�r]r$r%�
list_traverseXszTree.list_traverser2�jcCst|�|j||���Sr#)�listrar))r+r2r�r$r$r%�__getslice__dszTree.__getslice__cCs|�|j�Sr#)rar)r<r$r$r%�__iter__gsz
Tree.__iter__cCr�r#)rpr)r<r$r$r%�__len__jr-zTree.__len__rEcCsft|t�r#|j|}|j|dd?|j|d|dt|j|d��St|t�r-|�|�St	d|��)Nrr5rr/zInvalid index type: %r)
rHrJr)rBrZrr[rKrurj)r+rErtr$r$r%�__getitem__ms

2

zTree.__getitem__cCs\t|t�r|jD]}|j|dkrdSqdS|j}|jD]}|t||d�kr+dSqdS)NrTr/F)rHr
r)rGr[r)r+rErtr[r$r$r%�__contains__ys

��
�zTree.__contains__cCst|�|j��Sr#)�reversedrar)r<r$r$r%�__reversed__�r'zTree.__reversed__rercCst|j|j�|S)a9Serialize this tree into the stream. Assumes sorted tree data.

        :note:
            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+rer$r$r%�
_serialize�szTree._serializecCst|���|_|Sr#)rrfr)r�r$r$r%�_deserialize�szTree._deserialize)rerr"r)9rNrOrPrQrVr�__annotations__rRZ	commit_idZblob_idZ
symlink_idr7rrrBrrJrr	rIrrr,�classmethodrrcrKrgrrSrrarurv�propertyrr~r�rr*rr�rTr�rrr�r�r�r��slicer�r�r�r�r��
__classcell__r$r$r]r%r�s�
�����
�	��	(��������	�'
)8�__all__rm�sysZgit.diff�diffZgit_diffZgit.utilrrr�r�baser	r
r�rZfunrr
Zsubmodule.baser�typingrrrrrrrrrrr�version_inforZtyping_extensionsZ	git.typesr�iorZgit.reporrIrJrKrSr�r&rZDiffableZTraversableZSerializablerrBr7r$r$r$r%�<module>s24
j~

Youez - 2016 - github.com/yon3zu
LinuXploit