ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/gitdb/db/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/gitdb/db/__pycache__/base.cpython-311.pyc

�

�܋fk#����dZddlmZmZmZddlmZddlmZm	Z	ddl
mZddlm
Z
dZGd�d	��ZGd
�d��ZGd�d
��ZGd�d��Zd�ZGd�deee��ZdS)z8Contains implementations of database retrieveing objects�)�join�	LazyMixin�
hex_to_bin)�
force_text)�	BadObject�AmbiguousObjectName)�chain)�reduce)�	ObjectDBR�	ObjectDBW�
FileDBBase�
CompoundDB�	CachingDBc�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	rzkDefines an interface for object database lookup.
    Objects are identified either by their 20 byte bin shac��|jS�N)�has_obj��self�shas  �^/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/gitdb/db/base.py�__contains__zObjectDBR.__contains__s
���|��c� �td���)z�
        Whether the object identified by the given 20 bytes
            binary sha is contained in the database

        :return: True if the object identified by the given 20 bytes
            binary sha is contained in the database�To be implemented in subclass��NotImplementedErrorrs  r�
has_objectzObjectDBR.has_object"s��"�"A�B�B�Brc� �td���)zW :return: OInfo instance
        :param sha: bytes binary sha
        :raise BadObject:rrrs  r�infozObjectDBR.info+���"�"A�B�B�Brc� �td���)z[:return: OStream instance
        :param sha: 20 bytes binary sha
        :raise BadObject:rrrs  r�streamzObjectDBR.stream1r!rc��t���)z+:return: amount of objects in this databaser�rs r�sizezObjectDBR.size7���!�#�#�#rc��t���)zGReturn iterator yielding 20 byte shas for all objects in this data baserr%s r�sha_iterzObjectDBR.sha_iter;r'rN)
�__name__�
__module__�__qualname__�__doc__rrr r#r&r)�rrrrs�������>�>����C�C�C�C�C�C�C�C�C�$�$�$�$�$�$�$�$rrc�*�eZdZdZd�Zd�Zd�Zd�ZdS)rz6Defines an interface to create objects in the databasec��d|_dSr��_ostream)r�args�kwargss   r�__init__zObjectDBW.__init__Fs
����
�
�
rc�"�|j}||_|S)ab
        Adjusts the stream to which all data should be sent when storing new objects

        :param stream: if not None, the stream to use, if None the default stream
            will be used.
        :return: previously installed stream, or None if there was no override
        :raise TypeError: if the stream doesn't have the supported functionalityr1)rr#�cstreams   r�set_ostreamzObjectDBW.set_ostreamJs���-����
��rc��|jS)z�
        Return the output stream

        :return: overridden output stream this instance will write to, or None
            if it will write to the default streamr1r%s r�ostreamzObjectDBW.ostreamVs���}�rc� �td���)a�
        Create a new object in the database
        :return: the input istream object with its sha set to its corresponding value

        :param istream: IStream compatible instance. If its sha is already set
            to a value, the object will just be stored in the our database format,
            in which case the input stream is expected to be in object format ( header + contents ).
        :raise IOError: if data could not be writtenrr)r�istreams  r�storezObjectDBW.store^s��"�"A�B�B�BrN)r*r+r,r-r5r8r:r=r.rrrrBs[������@�@����
�
�
����	C�	C�	C�	C�	Crrc�.��eZdZdZ�fd�Zd�Zd�Z�xZS)r
z}Provides basic facilities to retrieve files of interest, including
    caching facilities to help mapping hexsha's to objectsc�V��t�����||_dS)aYInitialize this instance to look for its files at the given root path
        All subsequent operations will be relative to this path
        :raise InvalidDBRoot:
        **Note:** The base will not perform any accessablity checking as the base
            might not yet be accessible, but become accessible before the first
            access.N)�superr5�
_root_path)r�	root_path�	__class__s  �rr5zFileDBBase.__init__qs&���	��������#����rc��|jS)z':return: path at which this db operates)rAr%s rrBzFileDBBase.root_path|s
����rc�F�t|jt|����S)z~
        :return: the given relative path relative to our database root, allowing
            to pontentially access datafiles)rrAr)r�	rela_paths  r�db_pathzFileDBBase.db_path�s���D�O�Z�	�%:�%:�;�;�;r)r*r+r,r-r5rBrG�
__classcell__�rCs@rr
r
ls`�������>�>�$�$�$�$�$����<�<�<�<�<�<�<rr
c��eZdZdZdd�ZdS)rz/A database which uses caches to speed-up accessFc��dS)ar
        Call this method if the underlying data changed to trigger an update
        of the internal caching structures.

        :param force: if True, the update must be performed. Otherwise the implementation
            may decide not to perform an update if it thinks nothing has changed.
        :return: True if an update was performed as something change indeedNr.)r�forces  r�update_cachezCachingDB.update_cache�s���rN�F)r*r+r,r-rMr.rrrr�s4������9�9�O�O�O�O�O�Orrc��t|t��rT|���}|�d�|D����d�|D��D]}t	||���dS|�|��dS)zfFill output list with database from db, in order. Deals with Loose, Packed
    and compound databases.c3�DK�|]}t|t���|V��dSr��
isinstancer��.0�dbs  r�	<genexpr>z'_databases_recursive.<locals>.<genexpr>�s1����I�I�R�j��Z�.H�.H�I�b�I�I�I�I�I�Irc3�DK�|]}t|t���|V��dSrrQrSs  rrVz'_databases_recursive.<locals>.<genexpr>�s1����C�C�2�
�2�z�(B�(B�C�B�C�C�C�C�C�CrN)rRr�	databases�extend�_databases_recursive�append)�database�output�dbs�cdbs    rrZrZ�s����(�J�'�'� �� � �"�"���
�
�I�I�3�I�I�I�I�I�I�C�C��C�C�C�	.�	.�C� ��f�-�-�-�-�	.�	.�	�
�
�h�����rc�Z��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
d�Zd�Z
�xZS)rz�A database which delegates calls to sub-databases.

    Databases are stored in the lazy-loaded _dbs attribute.
    Define _set_cache_ to update it with your databasesc���|dkrt��|_dS|dkrt��|_dSt	���|��dS)N�_dbs�	_db_cache)�listrb�dictrcr@�_set_cache_)r�attrrCs  �rrfzCompoundDB._set_cache_�sS����6�>�>����D�I�I�I�
�[�
 �
 �!�V�V�D�N�N�N��G�G����%�%�%�%�%rc��	|j|S#t$rYnwxYw|jD]%}|�|��r||j|<|cS�&t	|���)zL:return: database containing the given 20 byte sha
        :raise BadObject:)rc�KeyErrorrbrr)rrrUs   r�	_db_queryzCompoundDB._db_query�s���
	��>�#�&�&���	�	�	��D�	�����)�	�	�B��}�}�S�!�!�
�&(���s�#��	�	�	�
���n�n�s��
�c�T�	|�|��dS#t$rYdSwxYw)NTF)rjrrs  rrzCompoundDB.has_object�s@��	��N�N�3�����4���	�	�	��5�5�	���s��
'�'c�R�|�|���|��Sr)rjr rs  rr zCompoundDB.info�s"���~�~�c�"�"�'�'��,�,�,rc�R�|�|���|��Sr)rjr#rs  rr#zCompoundDB.stream�s"���~�~�c�"�"�)�)�#�.�.�.rc�D�td�d�|jD��d��S)z.:return: total size of all contained databasesc��||zSrr.)�x�ys  r�<lambda>z!CompoundDB.size.<locals>.<lambda>�s
��1�q�5�rc3�>K�|]}|���V��dSr)r&rSs  rrVz"CompoundDB.size.<locals>.<genexpr>�s*����*I�*I��2�7�7�9�9�*I�*I�*I�*I�*I�*Irr)r
rbr%s rr&zCompoundDB.size�s)���(�(�*I�*I�t�y�*I�*I�*I�1�M�M�Mrc�2�td�|jD���S)Nc3�>K�|]}|���V��dSr)r)rSs  rrVz&CompoundDB.sha_iter.<locals>.<genexpr>�s*����9�9��r�{�{�}�}�9�9�9�9�9�9r)r	rbr%s rr)zCompoundDB.sha_iter�s���9�9�t�y�9�9�9�:�:rc�*�t|j��S)z7:return: tuple of database instances we use for lookups)�tuplerbr%s rrXzCompoundDB.databases�s���T�Y���rFc��|j���d}|jD]/}t|t��r||�|��z}�0|S)NF)rc�clearrbrRrrM)rrL�statrUs    rrMzCompoundDB.update_cache�s\������������)�	/�	/�B��"�i�(�(�
/������.�.�.����rc���t��}t||��t|��}t|��}|dzdkrt	|dz��}nt	|��}d}|D]m}d}	t|d��r|�|��}n|�||��}n#t$rY�NwxYw|r|r||krt|���|}�n|st|���|S)z�
        :return: 20 byte binary sha1 from the given less-than-40 byte hexsha (bytes or str)
        :param partial_hexsha: hexsha with less than 40 byte
        :raise AmbiguousObjectName: �r�0N�partial_to_complete_sha_hex)
rdrZr�lenr�hasattrr~�partial_to_complete_sharr)r�partial_hexsharX�len_partial_hexsha�partial_binsha�	candidaterU�full_bin_shas        rr~z&CompoundDB.partial_to_complete_sha_hex�s7��
�F�F�	��T�9�-�-�-�#�N�3�3�� ��0�0����!�Q�&�&�'���(<�=�=�N�N�'��7�7�N��	��	)�	)�B��L�
��2�<�=�=�b�#%�#A�#A�.�#Q�#Q�L�L�#%�#=�#=�n�N`�#a�#a�L����
�
�
���
�����
)��>��l�!:�!:�-�n�=�=�=�(�	���	,��N�+�+�+��s�1<B.�.
B;�:B;rN)r*r+r,r-rfrjrr r#r&r)rXrMr~rHrIs@rrr�s��������;�;�
&�&�&�&�&����(���-�-�-�/�/�/�N�N�N�;�;�;� � � �	�	�	�	�#�#�#�#�#�#�#rrN)r-�
gitdb.utilrrr�gitdb.utils.encodingr�	gitdb.excrr�	itertoolsr	�	functoolsr
�__all__rrr
rrZrr.rr�<module>r�s���
?�>�����������,�+�+�+�+�+���������
������������N��$$�$$�$$�$$�$$�$$�$$�$$�R%C�%C�%C�%C�%C�%C�%C�%C�T<�<�<�<�<�<�<�<�8O�O�O�O�O�O�O�O�"	 �	 �	 �n�n�n�n�n��I�y�n�n�n�n�nr

Zerion Mini Shell 1.0