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 Z5ddZ6 G d d Z7 G d de Z8 G d de Z9 G d de Z:dS )z3Contains PackIndexFile and PackFile implementations N) BadObjectAmbiguousObjectNameUnsupportedOperation ParseError)mman LazyMixinunpack_from bin_to_hexbyte_ord)create_pack_object_headerpack_object_header_infois_equal_canonical_shatype_id_to_type_mapwrite_objectstream_copy chunk_sizedelta_types OFS_DELTA REF_DELTAmsb_sizePackIndexFile_sha_to_index)OInfoOStream OPackInfoOPackStreamODeltaStreamODeltaPackInfoODeltaPackStream)DecompressMemMapReaderDeltaApplyReader Sha1Writer NullStreamFlexibleSha1Writer)pack)crc32) NULL_BYTE) PackIndexFilePackFile 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_regionbufferr r r r r r r r r )cursoroffset as_streamdatatype_iduncomp_sizedata_rela_offsettotal_rela_offset delta_infoicdelta_offsetabs_data_offsetstreams \/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/gitdb/pack.pypack_object_atrB L s V$$++--D-DT-J-J*G[*J )T!W Q4x$h <a!!A FAAL(A-!d(;L $h < " I ,r1*+<<= -00O ]'->-?-?(@%UU"Kf$U$UUU"$4VWkS]_e$f$fff"Ifg{$K$KKK"N67KQ[$\$\\\ 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 lencompressr&