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__/loose.cpython-311.pyc

�

�܋f�����ddlmZmZmZddlmZmZddlmZm	Z	m
Z
mZddlm
Z
mZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZddlmZm Z m!Z!m"Z"ddl#m$Z$ddl%Z%ddl&Z&ddl'Z'd	Z(Gd
�deee��Z)dS)�)�
FileDBBase�	ObjectDBR�	ObjectDBW)�	BadObject�AmbiguousObjectName)�DecompressMemMapReader�FDCompressedSha1Writer�FDStream�
Sha1Writer)�OStream�OInfo)�file_contents_ro_filepath�ENOENT�
hex_to_bin�
bin_to_hex�exists�chmod�isdir�isfile�remove�mkdir�rename�dirname�basename�join)�
chunk_size�loose_object_header_info�write_object�stream_copy)�force_bytesN)�
LooseObjectDBc���eZdZdZeZedd��Zej	dkredd��Z�fd�Z
d�Zd�Zd	�Z
d
�Z�fd�Zd�Zd
�Zd�Zd�Zd�Zd�Z�xZS)r!z/A database which operates on loose object files�444��nt�644c���t���|��t��|_t	t
dd��|_dS)N�	O_NOATIMEr)�super�__init__�dict�_hexsha_to_file�getattr�os�_fd_open_flags)�self�	root_path�	__class__s  ��_/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/gitdb/db/loose.pyr*zLooseObjectDB.__init__MsC���
������#�#�#�#�v�v���&�b�+�q�9�9�����c�B�t|dd�|dd���S)z{
        :return: path at which the object with the given hexsha would be stored,
            relative to the database rootN�)r)r0�hexshas  r3�object_pathzLooseObjectDB.object_pathVs$���F�2�A�2�J��q�r�r�
�+�+�+r4c���	|j|S#t$rYnwxYw|�|�|����}t	|��r||j|<|St|���)z�
        :return: readable object path to the object identified by hexsha
        :raise BadObject: If the object file does not exist)r,�KeyError�db_pathr8rr)r0r7�paths   r3�readable_db_object_pathz%LooseObjectDB.readable_db_object_path\s���	��'��/�/���	�	�	��D�	����
�|�|�D�,�,�V�4�4�5�5���$�<�<�	�+/�D� ��(��K�����s��
�c���d}|���D]D}t|���t|����r|�t	|���|}�E|�t|���|S)z�:return: 20 byte binary sha1 string which matches the given name uniquely
        :param name: hexadecimal partial name (bytes or ascii string)
        :raise AmbiguousObjectName:
        :raise BadObject: N)�sha_iterr�
startswithr rr)r0�partial_hexsha�	candidate�binshas    r3�partial_to_complete_sha_hexz)LooseObjectDB.partial_to_complete_sha_hexnsz��
�	��m�m�o�o�	#�	#�F��&�!�!�,�,�[��-H�-H�I�I�
#��(�-�n�=�=�=�"�	�����N�+�+�+��r4c�l�|�|�t|������}	t||j���S#t
$r\}|jtkr7	t|��cYd}~S#t
$r}t|��|�d}~wwxYwt|��|�d}~wwxYw)z~
        :return: memory map of that file to allow random read access
        :raise BadObject: if object could not be located)�flagsN)	r;r8rrr/�OSError�errnorr)r0�shar;�e�new_es     r3�_map_loose_objectzLooseObjectDB._map_loose_object�s����,�,�t�/�/�
�3���@�@�A�A��	,�,�W�D�<O�P�P�P�P���
	,�
	,�
	,��w�&� � �4�4�W�=�=�=�=�=�=�=�=���4�4�4�#�C�.�.�e�3�����4����
 ��n�n�!�+�����
	,���s;�A
�
B3�B.�(A<�6B3�<
B�B�B�B.�.B3c���|�1t|t��stdtjz���t	���|��S)zI:raise TypeError: if the stream does not support the Sha1Writer interfaceNz,Output stream musst support the %s interface)�
isinstancer�	TypeError�__name__r)�set_ostream)r0�streamr2s  �r3rQzLooseObjectDB.set_ostream�sG�����j���&D�&D���J�Z�M`�`�a�a�a��w�w�"�"�6�*�*�*r4c��|�|��}	t|��\}}t|||��t|d��r|���SS#t|d��r|���wwxYw)N�close)rLrr
�hasattrrT)r0rI�m�typ�sizes     r3�infozLooseObjectDB.info�s����"�"�3�'�'��	�0��3�3�I�C����c�4�(�(��q�'�"�"�
����	�	�	�	�
��w�q�'�"�"�
����	�	�	�	�
���s�"A�'Bc��|�|��}tj|d���\}}}t||||��S)NT)�close_on_deletion)rLr�newr)r0rIrV�typerXrRs      r3rRzLooseObjectDB.stream�sE���"�"�3�'�'��3�7��T�R�R�R���d�F��s�D�$��/�/�/r4c�n�	|�t|����dS#t$rYdSwxYw)NTF)r=rr)r0rIs  r3�
has_objectzLooseObjectDB.has_object�sH��	��(�(��C���9�9�9��4���	�	�	��5�5�	���s�"&�
4�4c���d}|���}|�Dtjd|j���\}}|j�t|��}nt
|��}		|j�,t|j|j	tj|j��n-t|j|j|j|j	|j���|r|���n#|r|���wwxYwn#|rt#j|���xYwd}|jr|j}n|�d���}|r�|�|�|����}t/|��}t1|��st3|��t5|��rt%|��nt7||��t9||j��t=|��|_|S)z.note: The sha we produce will be hex by natureN�obj)�prefix�dir)rT)�as_hex)�ostream�tempfile�mkstemp�
_root_pathrCr	r
r�read�write�sys�maxsize�stream_chunk_sizerr]rXrTr.rr7rIr;r8rrrrrr�new_objects_moder)r0�istream�tmp_path�writer�fdr7�obj_path�obj_dirs        r3�storezLooseObjectDB.store�s������������>�#�+�5�d�o�N�N�N�L�B���~�%�/��3�3���!�"����	�
#��>�-� ���f�l�C�K��I_�`�`�`�`�!���w�|�W�\�6�<�,0�,B�D�D�D�D��#��L�L�N�N�N����#��L�L�N�N�N�N�#������	��
$��	�(�#�#�#��������>�	-��^�F�F��Z�Z�t�Z�,�,�F��	3��|�|�D�$4�$4�V�$<�$<�=�=�H��h�'�'�G���>�>�
��g�����h���
+��x� � � � ��x��*�*�*�

�(�D�1�2�2�2�$�F�+�+����s�A C�?C3�C/�/C3�3Dc#�K�tj|�����D]V\}}}t|��}t	|��dkr�)|D]*}t	|��dkr�t||z��V��+�WdS)Nr6�&)r.�walkr1r�lenr)r0�root�dirs�files�	root_base�fs      r3r?zLooseObjectDB.sha_iter�s�����!#�����)9�)9�!:�!:�	0�	0��D�$�� ����I��9�~�~��"�"���
0�
0���q�6�6�R�<�<�� ��Q��/�/�/�/�/�/�
0�	0�	0r4c�^�tt|�������S)N)ry�tupler?)r0s r3rXzLooseObjectDB.sizes ���5������)�)�*�*�*r4)rP�
__module__�__qualname__�__doc__rrm�intrnr.�namer*r8r=rDrLrQrYrRr_rur?rX�
__classcell__)r2s@r3r!r!?s#�������9�9�#���s�5�!�}�}��	�w�$����3�u�a�=�=��:�:�:�:�:�,�,�,� � � �$���&,�,�,�*+�+�+�+�+����0�0�0�
���>�>�>�@
0�
0�
0�+�+�+�+�+�+�+r4r!)*�
gitdb.db.baserrr�	gitdb.excrr�gitdb.streamrr	r
r�
gitdb.baserr
�
gitdb.utilrrrrrrrrrrrrrr�	gitdb.funrrrr�gitdb.utils.encodingr rfr.rk�__all__r!�r4r3�<module>r�s��
������������������
��������������������
��������������������������������"������������-�,�,�,�,�,�����	�	�	�	�
�
�
�
���C+�C+�C+�C+�C+�J�	�9�C+�C+�C+�C+�C+r4

Zerion Mini Shell 1.0