????
Your IP : 3.149.29.120
�
If����ddlmZddlmZmZmZmZddlmZ ddl
mZddl
mZddlmZmZmZddlmZmZmZer$ddlmZdd lmZdd
lmZddlmZddlm Z dd
l!m"Z"edZ#dZ$dZ%Gd�de��Z&Gd�de&��Z'dS)�)�WorkTreeRepositoryUnsupported)� LazyMixin�join_path_native�stream_copy�
bin_to_hexN�)�get_object_type_by_name)�Any�
TYPE_CHECKING�Union)�PathLike�
Commit_ish�Lit_commit_ish)�Repo)�OStream)�Tree)�Blob)� Submodule)� Reference)rrrzSCreated object %r whose python type %r disagrees with the actual git object type %r)�Object�IndexObjectc�x��eZdZUdZdZdZejejej ej
fZdZdZ
eedfed<ddd ef�fd
�Zedddeedfd
efd���Zeddded
efd���Zded
df�fd�Zded
efd�Zded
efd�Zd
efd�Zd
efd�Zd
efd�Z e!d
efd���Z"e!dd���Z#dd�Z$�xZ%S) rz@Implements an Object which may be Blobs, Trees, Commits and Tags�(0000000000000000000000000000000000000000s)�repo�binsha�sizeN�typerrrc����tt|�����||_||_t|��dksJd|t|��fz���dS)z�Initialize an object by identifying it by its binary sha.
All keyword arguments will be set on demand if None.
:param repo: repository this object is located in
:param binsha: 20 byte SHA1�z,Require 20 byte binary sha, got %r, len = %iN)�superr�__init__rr�len)�selfrr� __class__s ��a/builddir/build/BUILD/cloudlinux-venv-1.0.5/venv/lib/python3.11/site-packages/git/objects/base.pyr!zObject.__init__8sl��� �f�d���$�$�&�&�&��� �����6�{�{�b� � � �"P����K�K�T
�#
� � � � � ��idr�returnc�F�|�t|����S)a�
:return: New Object instance of a type appropriate to the object type behind
id. The id of the newly created object will be a binsha even though
the input id may have been a Reference or Rev-Spec
:param id: reference, rev-spec, or hexsha
:note: This cannot be a __new__ method as it would always call __init__
with the input id which is not necessarily a binsha.)� rev_parse�str)�clsrr's r%�newz
Object.newGs���~�~�c�"�g�g�&�&�&r&�sha1c���||jkrtd��||��S|j�|��}t|j��||j��}|j|_|S)z�
:return: new object instance of a type appropriate to represent the given
binary sha1
:param sha1: 20 byte binary sha1scommit)�NULL_BIN_SHAr �odb�inforrr)r,rr.�oinfo�insts r%�new_from_shazObject.new_from_shaTsl���3�#�#�#�5�*�9�5�5�d�D�A�A�A���
�
�d�#�#��2�&�u�z�2�2�4���F�F���J�� ��r&�attrc����|dkr2|jj�|j��}|j|_dStt|���|��dS)zRetrieve object informationrN)rr1r2rrr r�_set_cache_)r#r6r3r$s �r%r8zObject._set_cache_csX����6�>�>��I�M�&�&�t�{�3�3�E��
�D�I�I�I�
�&�$���+�+�D�1�1�1�1�1r&�otherc�F�t|d��sdS|j|jkS)z/:return: True if the objects have the same SHA1rF��hasattrr�r#r9s r%�__eq__z
Object.__eq__ls(���u�h�'�'� ��5��{�e�l�*�*r&c�F�t|d��sdS|j|jkS)z6:return: True if the objects do not have the same SHA1rTr;r=s r%�__ne__z
Object.__ne__rs(���u�h�'�'� ��4��{�e�l�*�*r&c�*�t|j��S)zE:return: Hash of our id allowing objects to be used in dicts and sets)�hashr�r#s r%�__hash__zObject.__hash__xs���D�K� � � r&c��|jS)z=:return: string of our SHA1 as understood by all git commands)�hexsharCs r%�__str__zObject.__str__|s
���{�r&c�2�d|jj�d|j�d�S)z::return: string with pythonic representation of our objectz<git.z "z">)r$�__name__rFrCs r%�__repr__zObject.__repr__�s ���"&�.�"9�"9�"9�4�;�;�;�G�Gr&c�P�t|j���d��S)z6:return: 40 byte hex version of our 20 byte binary sha�ascii)rr�decoderCs r%rFz
Object.hexsha�s"���$�+�&�&�-�-�g�6�6�6r&rc�J�|jj�|j��S)z�:return: File Object compatible stream to the uncompressed raw data of the object
:note: returned streams must be read in order)rr1�streamrrCs r%�data_streamzObject.data_stream�s���y�}�#�#�D�K�0�0�0r&�ostreamc�n�|jj�|j��}t ||��|S)z�Writes our data directly to the given output stream
:param ostream: File object compatible stream object.
:return: self)rr1rOrr)r#rQ�istreams r%�stream_datazObject.stream_data�s2��
�)�-�&�&�t�{�3�3���G�W�%�%�%��r&)r(r)rQrr(r)&rI�
__module__�__qualname__�__doc__�NULL_HEX_SHAr0�dbtyp�
str_blob_type�
str_tree_type�str_commit_type�str_tag_type�TYPES� __slots__rrr�__annotations__�bytesr!�classmethodr+rr-r5r8r
�boolr>r@�intrDrGrJ�propertyrFrPrT�
__classcell__�r$s@r%rr(s4��������J�J��L��L� ��
��
��
��
�E�+�I�(,�D�%���$�
%�,�,�,�
�V�
�U�
�
�
�
�
�
��
'�v�
'�5��k�)9�#:�
'�z�
'�
'�
'��[�
'�����e��
�����[��2��2��2�2�2�2�2�2�+�C�+�D�+�+�+�+�+�C�+�D�+�+�+�+�!�#�!�!�!�!�������H�#�H�H�H�H��7��7�7�7��X�7�
�1�1�1��X�1�
�������r&rc���eZdZdZdZdZ ddddededefdede fd df
�fd
�
Z
d efd�Zded df�fd
�Z
ed efd���Zed e fd���Z�xZS)rzeBase for all objects that can be part of the index file , namely Tree, Blob and
SubModule objects)�path�moderiNrrrrjr(c���tt|���||��|�||_|� ||_dSdS)aJInitialize a newly instanced IndexObject
:param repo: is the Repo we are located in
:param binsha: 20 byte sha1
:param mode:
is the stat compatible file mode as int, use the stat module
to evaluate the information
:param path:
is the path to the file in the file system, relative to the git repository root, i.e.
file.ext or folder/other.ext
:note:
Path may not be set of the index object has been created directly as it cannot
be retrieved without knowing the parent tree.N)r rr!rjri)r#rrrjrir$s �r%r!zIndexObject.__init__�sK���( �k�4� � �)�)�$��7�7�7����D�I����D�I�I�I��r&c�*�t|j��S)z�
:return:
Hash of our path as index items are uniquely identifiable by path, not
by their data !)rBrirCs r%rDzIndexObject.__hash__�s��
�D�I���r&r6c����|tjvr(td|�dt|��j�d����tt|���|��dS)NzAttribute 'z<' unset: path and mode attributes must have been set during z object creation)rr_�AttributeErrorrrIr r8)r#r6r$s �r%r8zIndexObject._set_cache_�sh����;�(�(�(� �.��4�4��d���,�,�,�.���
�
�+�t�$�$�0�0��6�6�6�6�6r&c�4�tj|j��S)zA:return: Name portion of the path, effectively being the basename)�osp�basenamerirCs r%�namezIndexObject.name�s���|�D�I�&�&�&r&c�v�|jj�t|jj|j��St d���)a
:return:
Absolute path to this index object in the file system ( as opposed to the
.path field which is a path relative to the git repository ).
The returned path will be native to the system and contains '' on windows.Nz"Working_tree_dir was None or empty)r�working_tree_dirrrirrCs r%�abspathzIndexObject.abspath�s5���9�%�1�#�D�I�$>�� �J�J�J�/�0T�U�U�Ur&)NN)rIrUrVrWr_�_id_attribute_rarrdr
r!rDr+r8rerrrurfrgs@r%rr�sB���������!�I��N�"&�&*��������D�#�I�� �
�D�(�N�#��
�
������4�#�����7��7��7�7�7�7�7�7��'�c�'�'�'��X�'��
V��
V�
V�
V��X�
V�
V�
V�
V�
Vr&r)(�git.excr�git.utilrrrr� gitdb.typ�typrY�os.pathrirp�utilr �typingr
rr� git.typesr
rr�git.repor�
gitdb.baser�treer�blobr�submodule.baser�git.refs.referencer�
IndexObjUnion�_assertion_msg_format�__all__rr�r&r%�<module>r�s���2�1�1�1�1�1�I�I�I�I�I�I�I�I�I�I�I�I�������������)�)�)�)�)�)�
-�,�,�,�,�,�,�,�,�,�:�:�:�:�:�:�:�:�:�:��-�������"�"�"�"�"�"�������������)�)�)�)�)�)�,�,�,�,�,�,��1�2�
�
n��
#��o�o�o�o�o�Y�o�o�o�dFV�FV�FV�FV�FV�&�FV�FV�FV�FV�FVr&