Your IP : 3.144.104.175
�
��bgR� � � � d Z ddlZddlmZmZmZmZ ddlmZm Z m
Z
mZmZ ddl
mZmZmZmZmZmZmZmZmZmZmZ ddlmZ n# e$ r Y nw xY wddlmZmZmZm Z m!Z!m"Z"m#Z# ddl$m%Z%m&Z&m'Z'm(Z(m)Z) dd l*m+Z+ dd
l,m-Z- ddl.m/Z/ ddl0Z0ddl1Z1ddl2Z2ddl3Z3dZ4d
� Z5dd�Z6 G d� d� � Z7 G d� de � � Z8 G d� de � � Z9 G d� de � � Z:dS )z3Contains PackIndexFile and PackFile implementations� N)� BadObject�AmbiguousObjectName�UnsupportedOperation�
ParseError)�mman� LazyMixin�unpack_from�
bin_to_hex�byte_ord)�create_pack_object_header�pack_object_header_info�is_equal_canonical_sha�type_id_to_type_map�write_object�stream_copy�
chunk_size�delta_types� OFS_DELTA� REF_DELTA�msb_size��PackIndexFile_sha_to_index)�OInfo�OStream� OPackInfo�OPackStream�ODeltaStream�ODeltaPackInfo�ODeltaPackStream)�DecompressMemMapReader�DeltaApplyReader�
Sha1Writer�
NullStream�FlexibleSha1Writer)�pack)�crc32)� NULL_BYTE)�
PackIndexFile�PackFile�
PackEntityc �j � | � |� � � � � }t |� � \ }}}d}d}|t k rZ|} t || � � }
| dz
} |
dz }|
dz r/t || � � }
| dz
} |dz
}|dz |
dz z }|
dz �/|}| }n|t
k r|dz }|||� }n|}||z }|rDt
||d� d|� � }
|�|t ||||
� � fS |t |||||
� � fS |�|t |||� � fS |t ||||� � fS )a&
:return: Tuple(abs_data_offset, PackInfo|PackStream)
an object of the correct type according to the type_id of the object.
If as_stream is True, the object will contain a stream, allowing the
data to be read decompressed.
:param data: random accessible data containing all required information
:parma offset: offset in to the data at which the object information is located
:param as_stream: if True, a stream object will be returned that can read
the data, otherwise you receive an info object onlyN� � � � � F)�
use_region�bufferr
r r r r r r r r )�cursor�offset� as_stream�data�type_id�uncomp_size�data_rela_offset�total_rela_offset�
delta_info�i�c�delta_offset�abs_data_offset�streams �[/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/gitdb/pack.py�pack_object_atrB L s� � � ���V�$�$�+�+�-�-�D�-D�T�-J�-J�*�G�[�*����J� �)������T�!�W���� �Q����4�x���$�h� <���a��!�!�A�
��F�A��A��L�(�A�-�!�d�(�;�L� �$�h� <� "�
���� �I� � �,�r�1���*�+<�<�=�
�
� -���0�0�O��
]�'��->�-?�-?�(@�%��U�U����"�K����f�$U�$U�U�U�"�$4�V�W�k�S]�_e�$f�$f�f�f���"�I�f�g�{�$K�$K�K�K�"�N�6�7�K�Q[�$\�$\�\�\� c � � d}d}|du}d}|r|} | t � � }|t |� � z
}|� |� � } |t | � � z
} || � � |rt | |� � }t |� � t k rn��|� � � } |t | � � z
} || � � |rt | |� � }|||fS )a� Copy a stream as read from read function, zip it, and write the result.
Count the number of written bytes and return it
:param base_crc: if not None, the crc will be the base for all compressed data
we consecutively write and generate a crc32 from. If None, no crc will be generated
:return: tuple(no bytes read, no bytes written, crc32) crc might be 0 if base_crc
was falser N)r �len�compressr&