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__/util.cpython-310.pyc
o

;j&]�	@s�dZgd�ZddlmZmZddlZddlmZddlmZm	Z	m
Z
ddlZddlm
Z
ddlZddlZddlmZmZmZdd	lmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!dd
l"m#Z#m$Z$er�ddl%m&Z&m'Z'ddl(m)Z)dd
l"m*Z*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5m6Z6neZ*dd�Z+Gdd�de�Z7eddd�Z8eeeddfdfZ9e	d�Z:dee;e<fde=fd d!�Z>d"e;deed#ed$ed%ed&ffd'd(�Z?d)e<de=fd*d+�Z@d,eAde<fd-d.�ZBd/e<de<fd0d1�ZCGd2d3�d3e
�ZDeDdd4�ZEd5eAd6eAdefd7d8�ZFd9ee<efdee=e=ffd:d;�ZGe�Hd<�ZIe�Hd=�ZJd>e<deee=e=ffd?d@�ZKGdAdB�dB�ZLe+GdCd�de*��ZMe+GdDdE�dEe*��ZNGdFd�deeM�ZOdS)Gz/Utility functions for working with git objects.)�get_object_type_by_name�
parse_date�parse_actor_and_date�ProcessStreamAdapter�Traversable�altz_to_utctz_str�
utctz_to_altz�verify_utctz�Actor�tzoffset�utc�)�ABC�abstractmethodN)�deque)�datetime�	timedelta�tzinfo)�digits)r	�IterableList�IterableObj)
�Any�Callable�Deque�Iterator�
NamedTuple�Sequence�
TYPE_CHECKING�Tuple�Type�TypeVar�Union�cast�overload)�Has_id_attribute�Literal)�BytesIO�StringIO)�Popen)�Protocol�runtime_checkable�)�Blob)�Commit)�	Submodule)�	TagObject)�TraversedTreeTup�TreecCs|S�N�)�fr2r2�D/opt/saltstack/salt/lib/python3.10/site-packages/git/objects/util.pyr)C�r)c@s.eZdZUeed<eded<eded<dS)�
TraverseNT�depth�rr+�item�rN�srcN)�__name__�
__module__�__qualname__�int�__annotations__r r2r2r2r4r6Gs
r6�T_TIobj�TraversableIterableObj)�boundr:rr/�modestr�returncCsLd}tt|dd���D]\}}ttttf|�}|t|�|d>7}q|S)a�Convert mode bits from an octal mode string to an integer mode for git.

    :param modestr:
        String like ``755`` or ``644`` or ``100644`` - only the last 6 chars will be
        used.

    :return:
        String identifying a mode compatible to the mode methods ids of the :mod:`stat`
        module regarding the rwx permissions for user, group and other, special flags
        and file system flags, such as whether it is a symlink.
    r���N�)�	enumerate�reversedr!r �strr?)rD�modeZ	iteration�charr2r2r4�mode_str_to_int[s
rM�object_type_namer,r.r0r+cCsx|dkr
ddlm}|jS|dkrddlm}|jS|dkr'ddlm}|jS|dkr4dd	lm}|jSt	d
|�
���)aRetrieve the Python class GitPython uses to represent a kind of Git object.

    :return:
        A type suitable to handle the given as `object_type_name`.
        This type can be called create new instances.

    :param object_type_name:
        Member of :attr:`Object.TYPES <git.objects.base.Object.TYPES>`.

    :raise ValueError:
        If `object_type_name` is unknown.
    scommitr*)�commitstag)�tagsblob)�blobstree)�treez%Cannot handle unknown object type: %s)�rOr,rPr.rQr+rRr0�
ValueError�decode)rNrOrPrQrRr2r2r4rosr�utctzcCs:t|�}t|�ddt|�dd}|dkr|S|S)z�Convert a git timezone offset into a timezone offset west of UTC in seconds
    (compatible with :attr:`time.altzone`).

    :param utctz:
        git utc timezone string, e.g. +0200
    �d��<r)r?�abs)rVZ	int_utctz�secondsr2r2r4r�s r�altzcCs:t|�d}t|�dd}|dkrdnd}d�|||�S)z�Convert a timezone offset west of UTC in seconds into a Git timezone offset
    string.

    :param altz:
        Timezone offset in seconds west of UTC.
    rXrY�-�+z{}{:02}{:02})rZ�format)r\�hours�minutes�signr2r2r4r�sr�offsetcCsdtd|�}t|�dkr|�|ddvr|�|dtvs.|dtvs.|dtvs.|dtvr0|�|S)	z]
    :raise ValueError:
        If `offset` is incorrect.

    :return:
        `offset`
    z"Invalid timezone offset format: %s�rz+-r*�rG�)rT�lenr)rcZfmt_excr2r2r4r�s0rc@s�eZdZddededefddfdd�Zdeedeeefffdd�Z	d	ee
dfdefd
d�Zd	ee
dfdefdd
�Z
d	ee
dfdefdd�ZdS)r
N�secs_west_of_utc�namerEcCst|d�|_|p
d|_dS)N)r[�fixed)r�_offset�_name)�selfrhrir2r2r4�__init__�sztzoffset.__init__cCst|j��|jffSr1)r
rk�
total_secondsrl�rmr2r2r4�
__reduce__�sztzoffset.__reduce__�dtcC�|jSr1)rk�rmrrr2r2r4�	utcoffset��ztzoffset.utcoffsetcCrsr1)rlrtr2r2r4�tzname�rvztzoffset.tznamecCstSr1)�ZEROrtr2r2r4�dst�r5ztzoffset.dstr1)r<r=r>�floatr rJrnrrrqrrrurwryr2r2r2r4r
�s "r
�UTC�	timestamp�	tz_offsetcCs8t�|t�}z
|�t|��}|WSty|YSw)z[Convert a `timestamp` + `tz_offset` into an aware :class:`~datetime.datetime`
    instance.)r�
fromtimestampr�
astimezoner
rT)r|r}Zutc_dtZlocal_dtr2r2r4�from_timestamp�s�r��string_datecCs"t|t�r(|jr!tt|���}t|���}t|�t	��
��|fStd|����z�|�d�dkrU|�
d�dkrU|��\}}|�d�rH|dd�}t|�}|tt|��fWSd}|d	d
vrkt|d	d��}|dd�}t|�}g}d}d|vr�|�d
�|�
d�}n"|�d�|�d�|�d�|�d�|�
d�}|dkr�|�
d�}|dks�J�||dd�}|d|�}	t�|d�}
|D]2}z't�|	|�}t�|j|j|j|
j|
j|
j|j|j|
jf	�}
t|
�|fWWSty�Yq�wtd��t �y}z
td|�dt!|����|�d}~ww)a	Parse the given date as one of the following:

        * Aware datetime instance
        * Git internal format: timestamp offset
        * :rfc:`2822`: ``Thu, 07 Apr 2005 22:13:13 +0200``
        * ISO 8601: ``2005-04-07T22:13:13`` - The ``T`` can be a space as well.

    :return:
        Tuple(int(timestamp_UTC), int(offset)), both in seconds since epoch

    :raise ValueError:
        If the format could not be understood.

    :note:
        Date can also be ``YYYY.MM.DD``, ``MM/DD/YYYY`` and ``DD.MM.YYYY``.
    z,string_date datetime object without tzinfo, � r*�:����@Nz+0000���z-+rF�,z%a, %d %b %Yz%Y-%m-%dz%Y.%m.%dz%m/%d/%Yz%d.%m.%Y�Tz%H:%M:%Szno format matchedz!Unsupported date format or type: z, type=)"�
isinstancerrr!rrur?rorrr|rT�count�rfind�split�
startswithrr�append�time�strptime�calendar�timegm�tm_year�tm_mon�tm_mday�tm_hour�tm_min�tm_sec�tm_wday�tm_yday�tm_isdst�	Exception�type)r�rurcr|Z
offset_strZ
timestamp_intZdate_formatsZsplitterZ	time_partZ	date_partZtstruct�fmtZdtstructZutctime�er2r2r4r�st








��
���rz^.+? (.*) (\d+) ([+-]\d+).*$z
^.+? (.*)$�linecCs`d\}}}t�|�}|r|��\}}}nt�|�}|r |�d�n|p#d}t�|�t|�t|�fS)z�Parse out the actor (author or committer) info from a line like::

        author Tom Preston-Werner <tom@mojombo.com> 1191999972 -0700

    :return:
        [Actor, int_seconds_since_epoch, int_timezone_offset]
    )rS�0r�r*rS)	�_re_actor_epoch�search�groups�_re_only_actor�groupr	Z_from_stringr?r)r�ZactorZepochrc�mr2r2r4rFs


rc@s<eZdZdZdZdddeddfdd	�Zd
edefdd�ZdS)
ra%Class wiring all calls to the contained Process instance.

    Use this type to hide the underlying process to provide access only to a specified
    stream. The process is usually wrapped into an :class:`~git.cmd.Git.AutoInterrupt`
    class to kill it if the instance goes out of scope.
    )�_proc�_stream�processr'�stream_namerENcCs||_t||�|_dSr1)r��getattrr�)rmr�r�r2r2r4rnhszProcessStreamAdapter.__init__�attrcCst|j|�Sr1)r�r�)rmr�r2r2r4�__getattr__lsz ProcessStreamAdapter.__getattr__)	r<r=r>�__doc__�	__slots__rJrnrr�r2r2r2r4r^s
rc@seZdZdZdZeedededfdd���Z	edededefd	d
��Z
	d#dedededee
d
fdd�Zedededefdd��Zdd�dd�dddddfdee
ddefegefdee
ddefegefdededededede
ee
deeffd d!�Zd"S)$rauSimple interface to perform depth-first or breadth-first traversals in one
    direction.

    Subclasses only need to implement one function.

    Instances of the subclass must be hashable.

    Defined subclasses:

    * :class:`Commit <git.objects.Commit>`
    * :class:`Tree <git.objects.tree.Tree>`
    * :class:`Submodule <git.objects.submodule.base.Submodule>`
    r2r9rEcC�td��)aA
        :return:
            Tuple of items connected to the given item.
            Must be implemented in subclass.

        class Commit::     (cls, Commit) -> Tuple[Commit, ...]
        class Submodule::  (cls, Submodule) -> Iterablelist[Submodule]
        class Tree::       (cls, Tree) -> Tuple[Tree, ...]
        �To be implemented in subclass��NotImplementedError)�clsr9r2r2r4�_get_intermediate_items��z#Traversable._get_intermediate_items�args�kwargscO� tjdtdd�|j|i|��S)z�Traverse self and collect all items found.

        Calling this directly on the abstract base class, including via a ``super()``
        proxy, is deprecated. Only overridden implementations should be called.
        z�list_traverse() method should only be called from subclasses. Calling from Traversable abstract class will raise NotImplementedError in 4.0.0. The concrete subclasses in GitPython itself are 'Commit', 'RootModule', 'Submodule', and 'Tree'.re��
stacklevel)�warnings�warn�DeprecationWarning�_list_traverse�rmr�r�r2r2r4�
list_traverse���zTraversable.list_traverseF�as_edge)r,r-r0r+cOsXt|t�r	|j}nd}|s t|�}|�|j|d|i|���|St|j|i|���}|S)ajTraverse self and collect all items found.

        :return:
            :class:`~git.util.IterableList` with the results of the traversal as
            produced by :meth:`traverse`::

                Commit -> IterableList[Commit]
                Submodule ->  IterableList[Submodule]
                Tree -> IterableList[Union[Submodule, Tree, Blob]]
        rSr�)r�r#Z_id_attribute_r�extend�traverse)rmr�r�r��id�outZout_listr2r2r4r��s
zTraversable._list_traversecOr�)z�Iterator yielding items found when traversing self.

        Calling this directly on the abstract base class, including via a ``super()``
        proxy, is deprecated. Only overridden implementations should be called.
        z�traverse() method should only be called from subclasses. Calling from Traversable abstract class will raise NotImplementedError in 4.0.0. The concrete subclasses in GitPython itself are 'Commit', 'RootModule', 'Submodule', and 'Tree'.rer�)r�r�r��	_traverser�r2r2r4r��r�zTraversable.traversecC�dS�NTr2��i�dr2r2r4�<lambda>��zTraversable.<lambda>cCr��NFr2r�r2r2r4r��r�r�Tr*�	predicater+�pruner7�branch_first�
visit_once�ignore_selfr8c
#s��t�}t�}	|	�td�d��dttdddtdtddf
��fd	d
�}
|	rr|	��\}�}|r4�|vr4q$|r;|���|rB|�f}
n�}
||
|�rJq$|oO��u}|sZ||
|�rZ|
V|d}|dkrg||krgq$|
|	�||�|	s&dSdS)
a�Iterator yielding items found when traversing `self`.

        :param predicate:
            A function ``f(i,d)`` that returns ``False`` if item i at depth ``d`` should
            not be included in the result.

        :param prune:
            A function ``f(i,d)`` that returns ``True`` if the search should stop at
            item ``i`` at depth ``d``. Item ``i`` will not be returned.

        :param depth:
            Defines at which level the iteration should not go deeper if -1. There is no
            limit if 0, you would effectively only get `self`, the root of the
            iteration. If 1, you would only get the first level of
            predecessors/successors.

        :param branch_first:
            If ``True``, items will be returned branch first, otherwise depth first.

        :param visit_once:
            If ``True``, items will only be returned once, although they might be
            encountered several times. Loops are prevented that way.

        :param ignore_self:
            If ``True``, `self` will be ignored and automatically pruned from the
            result. Otherwise it will be the first item to be returned. If `as_edge` is
            ``True``, the source of the first edge is ``None``.

        :param as_edge:
            If ``True``, return a pair of items, first being the source, second the
            destination, i.e. tuple(src, dest) with the edge spanning from source to
            destination.

        :return:
            Iterator yielding items found when traversing `self`::

                Commit -> Iterator[Union[Commit, Tuple[Commit, Commit]] Submodule ->
                Iterator[Submodule, Tuple[Submodule, Submodule]] Tree ->
                Iterator[Union[Blob, Tree, Submodule,
                                        Tuple[Union[Submodule, Tree], Union[Blob, Tree,
                                        Submodule]]]

                ignore_self=True is_edge=True -> Iterator[item] ignore_self=True
                is_edge=False --> Iterator[item] ignore_self=False is_edge=True ->
                Iterator[item] | Iterator[Tuple[src, item]] ignore_self=False
                is_edge=False -> Iterator[Tuple[src, item]]
        rN�stack�src_itemrr�r7rEcsh������s	dS|r|���fdd��D��dS���fdd�tt��ddd�D�}|�|�dS)Nc3s�|]	}t�|��VqdSr1�r6��.0r�)r7r�r2r4�	<genexpr>s�z<Traversable._traverse.<locals>.addToStack.<locals>.<genexpr>c3s �|]}t��|��VqdSr1r�r��r7�lstr�r2r4r�s�r*r�)r��
extendleft�rangergr�)r�r�r�r7Zreviter�r9rmr�r4�
addToStacks
&z)Traversable._traverse.<locals>.addToStackr*r�)	�setrr�r6r�boolr?�pop�add)rmr�r�r7r�r�r�r�Zvisitedr�r�r�r;ZrvalZ
skipStartItemZnext_dr2r�r4r��sD�:�����


�zTraversable._traverseN)F)r<r=r>r�r��classmethodrrrr�r�r�rr r�r�r�TraversedTupr?rr�r2r2r2r4rpsX����

�#��������	�c@s(eZdZdZdZddd�Zddd	�Zd
S)�SerializablezUDefines methods to serialize and deserialize objects from and into a data
    stream.r2�streamr%rEcCr�)aSerialize the data of this object into the given data stream.

        :note:
            A serialized object would :meth:`_deserialize` into the same object.

        :param stream:
            A file-like object.

        :return:
            self
        r�r��rmr�r2r2r4�
_serializeKr�zSerializable._serializecCr�)z�Deserialize all information regarding this object from the stream.

        :param stream:
            A file-like object.

        :return:
            self
        r�r�r�r2r2r4�_deserializeZs	zSerializable._deserializeN)r�r%rEr�)r<r=r>r�r�r�r�r2r2r2r4r�Cs

r�cs~eZdZdZeeedfefZdededede	ef�fdd�Z
ededeefd	d
��Z
ededeeeeeedfeffegefdeeeeeedfeffegefd
ededededdeddeefdd
��Z
ededeeeeeedfeffegefdeeeeeedfeffegefd
ededededdeddeeeedfeffdd
��Z
ededeeeefegefdeeeefegefd
ededededdeddeeeeffdd
��Z
dd�dd�dddddfdedeeeefegefdeeeefegefd
edededededeeeeeeefeeff�fdd
�
Z
�ZS)rBr2Nrmr�r�rEcst�j|i|��Sr1)�superr�r���	__class__r2r4r�ksz$TraversableIterableObj.list_traversecC�dSr1r2rpr2r2r4r�nr5zTraversableIterableObj.traverser�r�r7r�r�r�Tr�FcCr�r1r2�rmr�r�r7r�r�r�r�r2r2r4r�q�
cCr�r1r2r�r2r2r4r�}r�cCr�r1r2r�r2r2r4r��r�cCr�r�r2r�r2r2r4r��r�zTraversableIterableObj.<lambda>cCr�r�r2r�r2r2r4r��r�r�r*cs>tttttttdtftfft��|||||||��S)z5For documentation, see :meth:`Traversable._traverse`.N)r!r rrArr�r�r�r�r2r4r��s"��)r<r=r>r�rr rAZTIobj_tuplerrr�r"rr�rr?r�r$�
__classcell__r2r2r�r4rBfs�"�&�&������	��&�&������	���������	�
��������� 	�)Pr��__all__�abcr
rr��collectionsrrrr�re�stringrr�r�Zgit.utilr	rr�typingrrrrrrrrrrr r!r"Z	git.typesr#r$�ior%r&�
subprocessr'r(r)rQr+rOr,Zsubmodule.baser-rPr.rRr/r0r6rAr�rx�bytesrJr?rMrrrzrrr
rr�r�compiler�r�rrrr�rBr2r2r2r4�<module>sn<���
�#

"
d
S"

Youez - 2016 - github.com/yon3zu
LinuXploit