ok

Mini Shell

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

�

�܋f{���dZddlmZmZmZddlmZddlmZm	Z	m
Z
ddlmZddl
mZddlZddlZdZGd	�d
eeee��ZdS)z/Module containing a database to deal with packs�)�
FileDBBase�	ObjectDBR�	CachingDB)�	LazyMixin)�	BadObject�UnsupportedOperation�AmbiguousObjectName)�
PackEntity)�reduceN)�PackedDBc�p��eZdZdZdZ�fd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zdd�Zd�Zd�Z�xZS)rz-A database operating on a set of object packsi�c�f��t���|��d|_d|_dS�Nr)�super�__init__�
_hit_count�	_st_mtime)�self�	root_path�	__class__s  ��^/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/gitdb/db/pack.pyrzPackedDB.__init__)s/���
������#�#�#���������c�h�|dkr+t��|_|�d���dSdS)N�	_entitiesT)�force)�listr�update_cache)r�attrs  r�_set_cache_zPackedDB._set_cache_3s=���;���!�V�V�D�N����D��)�)�)�)�)��rc�@�|j�d�d���dS)Nc��|dSr�)�ls r�<lambda>z)PackedDB._sort_entities.<locals>.<lambda>:s
��!�A�$�rT)�key�reverse)r�sort�rs r�_sort_entitieszPackedDB._sort_entities9s%����������=�=�=�=�=rc��|j|jzdkr|���|jD]A}|d|��}|�,|dxxdz
cc<|xjdz
c_|d|fcS�Bt	|���)a�:return: tuple(entity, index) for an item at the given sha
        :param sha: 20 or 40 byte sha
        :raise BadObject:
        **Note:** This method is not thread-safe, but may be hit in multi-threaded
            operation. The worst thing that can happen though is a counter that
            was not incremented, or the list being in wrong order. So we safe
            the time for locking here, lets see how that goesr�N�)r�_sort_intervalr)rr)r�sha�item�indexs    r�
_pack_infozPackedDB._pack_info<s����?�T�0�0�A�5�5����!�!�!��N�	(�	(�D��D��G�C�L�L�E�� ��Q����1��������1�$����Q���'�'�'�'�!���n�n�rc�T�	|�|��dS#t$rYdSwxYw)NTF)r1r)rr.s  r�
has_objectzPackedDB.has_objectYs@��	��O�O�C� � � ��4���	�	�	��5�5�	���s��
'�'c�\�|�|��\}}|�|��S�N)r1�
info_at_index�rr.�entityr0s    r�infoz
PackedDB.infoas+������,�,�
����#�#�E�*�*�*rc�\�|�|��\}}|�|��Sr5)r1�stream_at_indexr7s    r�streamzPackedDB.streames+������,�,�
����%�%�e�,�,�,rc#��K�|���D]N}|���}|j}t|�����D]}||��V���OdSr5)�entitiesr0r.�range�size)rr8r0�sha_by_indexs    r�sha_iterzPackedDB.sha_iterisx�����m�m�o�o�	*�	*�F��L�L�N�N�E� �9�L��u�z�z�|�|�,�,�
*�
*��"�l�5�)�)�)�)�)�)�
*�	*�	*rc�H�d�|jD��}td�|d��S)Nc�f�g|].}|d��������/S�r,)r0r@��.0r/s  r�
<listcomp>z!PackedDB.size.<locals>.<listcomp>ss0��C�C�C�D��a������%�%�'�'�C�C�Crc��||zSr5r")�x�ys  rr$zPackedDB.size.<locals>.<lambda>ts
��1�q�5�rr)rr)r�sizess  rr@z
PackedDB.sizers-��C�C�D�N�C�C�C���(�(�%��3�3�3rc��t���)z�Storing individual objects is not feasible as a pack is designed to
        hold multiple objects. Writing or rewriting packs for single objects is
        inefficient)r)r�istreams  r�storezPackedDB.storezs��#�$�$�$rFc�,�tj|�����}|s|j|jkrdS|j|_tt
jtj�|���d������}d�|j	D��}||z
D]i}t|��}|j	�|����
��||���jg���j||z
D]b}d}t!|j	��D]9\}}	|	d������|kr|}n�:|dksJ�|j	|=�c|���dS)a�
        Update our cache with the actually existing packs on disk. Add new ones,
        and remove deleted ones. We keep the unchanged ones

        :param force: If True, the cache will be updated even though the directory
            does not appear to have changed according to its modification timestamp.
        :return: True if the packs have been updated so there is new information,
            False if there was no change to the pack databaseFzpack-*.packc�f�h|].}|d��������/SrE)�pack�pathrFs  r�	<setcomp>z(PackedDB.update_cache.<locals>.<setcomp>�s0��K�K�K�D�$�q�'�,�,�.�.�-�-�/�/�K�K�Kr���r,T)�os�statr�st_mtimer�set�globrS�joinrr
�appendrRr@r0�sha_to_index�	enumerater))
rrrW�
pack_files�our_pack_files�	pack_filer8�	del_index�ir/s
          rrzPackedDB.update_cache�s����w�t�~�~�'�'�(�(���	���$�.�8�8��5��������2�7�<�<����0@�0@�-�#P�#P�Q�Q�R�R�
�K�K�D�N�K�K�K��%�~�5�	_�	_�I� �	�*�*�F��N�!�!�6�;�;�=�=�#5�#5�#7�#7�������A\�"]�^�^�^�^�)�:�5�		+�		+�I��I�$�T�^�4�4�
�
���4���7�<�<�>�>�&�&�(�(�I�5�5� !�I��E�6�
��?�?�?�?���y�)�)�	
�������trc�$�d�|jD��S)z=:return: list of pack entities operated upon by this databasec��g|]
}|d��SrEr"rFs  rrHz%PackedDB.entities.<locals>.<listcomp>�s��3�3�3�D��Q��3�3�3r)rr(s rr>zPackedDB.entities�s��3�3�D�N�3�3�3�3rc�,�d}|jD]x}|d����||��}|�F|d����|��}|r||krt	|���|}�y|r|St|���)a�:return: 20 byte sha as inferred by the given partial binary sha
        :param partial_binsha: binary sha with less than 20 bytes
        :param canonical_length: length of the corresponding canonical representation.
            It is required as binary sha's cannot display whether the original hex sha
            had an odd or even number of characters
        :raise AmbiguousObjectName:
        :raise BadObject: Nr,)rr0�partial_sha_to_indexr.r	r)r�partial_binsha�canonical_length�	candidater/�
item_indexr.s       r�partial_to_complete_shaz PackedDB.partial_to_complete_sha�s����	��N�	 �	 �D��a������=�=�n�N^�_�_�J��%��1�g�m�m�o�o�)�)�*�5�5���>��c�!1�!1�-�n�=�=�=��	���	�����'�'�'r)F)�__name__�
__module__�__qualname__�__doc__r-rrr)r1r3r9r<rBr@rOrr>rl�
__classcell__)rs@rrr s��������7�7�
�N������*�*�*�>�>�>����:���+�+�+�-�-�-�*�*�*�4�4�4�%�%�%�+�+�+�+�Z4�4�4�(�(�(�(�(�(�(rr)rp�
gitdb.db.baserrr�
gitdb.utilr�	gitdb.excrrr	�
gitdb.packr
�	functoolsrrVrZ�__all__rr"rr�<module>rxs��
6�5�����������!� � � � � �����������"�!�!�!�!�!�������	�	�	�	�����
��
l(�l(�l(�l(�l(�z�9�i��l(�l(�l(�l(�l(r

Zerion Mini Shell 1.0