
    chW                        S r SSKJr  SSKJrJr  Sr " S S\5      r " S S\5      r	 " S	 S
\	5      r
 " S S\5      r " S S\5      r " S S\	5      r " S S\
5      r " S S\5      r " S S\5      r " S S\5      rg)zPModule with basic data structures - they are designed to be lightweight and fast    
bin_to_hex)type_id_to_type_maptype_to_type_id_map)	OInfo	OPackInfoODeltaPackInfoOStreamOPackStreamODeltaPackStreamIStreamInvalidOInfoInvalidOStreamc                       \ rS rSrSr\" 5       rS rS r\	S 5       r
\	S 5       r\	S 5       r\	S 5       r\	S	 5       rS
rg)r      a  Carries information about an object in an ODB, providing information
about the binary sha of the object, the type_string as well as the uncompressed size
in bytes.

It can be accessed using tuple notation and using attribute access notation::

    assert dbi[0] == dbi.binsha
    assert dbi[1] == dbi.type
    assert dbi[2] == dbi.size

The type is designed to be as lightweight as possible.c                 0    [         R                  XX#45      $ Ntuple__new__)clsshatypesizes       ]C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\gitdb/base.pyr   OInfo.__new__#   s    }}S"344    c                 .    [         R                  U 5        g r   r   __init__selfargss     r   r    OInfo.__init__&       tr   c                     U S   $ )z$:return: our sha as binary, 20 bytesr    r"   s    r   binshaOInfo.binsha*        Awr   c                     [        U S   5      $ z':return: our sha, hex encoded, 40 bytesr   r   r(   s    r   hexshaOInfo.hexsha/        $q'""r   c                     U S   $ N   r'   r(   s    r   r   
OInfo.type4       Awr   c                     [         U S      $ r2   )r   r(   s    r   type_idOInfo.type_id8       "47++r   c                     U S   $ N   r'   r(   s    r   r   
OInfo.size<   r5   r   r'   N)__name__
__module____qualname____firstlineno____doc__r   	__slots__r   r    propertyr)   r.   r   r7   r   __static_attributes__r'   r   r   r   r      s~    
> I5   # #   , ,  r   r   c                   r    \ rS rSrSr\" 5       rS rS r\	S 5       r
\	S 5       r\	S 5       r\	S 5       rS	rg
)r   B   aP  As OInfo, but provides a type_id property to retrieve the numerical type id, and
does not include a sha.

Additionally, the pack_offset is the absolute offset into the packfile at which
all object information is located. The data_offset property points to the absolute
location in the pack at which that actual data stream can be found.c                 0    [         R                  XX#45      $ r   r   )r   
packoffsetr   r   s       r   r   OPackInfo.__new__L   s    }}St":;;r   c                 .    [         R                  U 5        g r   r   r!   s     r   r    OPackInfo.__init__O   r%   r   c                     U S   $ Nr   r'   r(   s    r   pack_offsetOPackInfo.pack_offsetT   r5   r   c                     [         U S      $ r2   )r   r(   s    r   r   OPackInfo.typeX   r9   r   c                     U S   $ r2   r'   r(   s    r   r7   OPackInfo.type_id\   r5   r   c                     U S   $ r;   r'   r(   s    r   r   OPackInfo.size`   r5   r   r'   N)r>   r?   r@   rA   rB   r   rC   r   r    rD   rO   r   r7   r   rE   r'   r   r   r   r   B   sk    K I<
   , ,    r   r   c                   <    \ rS rSrSr\" 5       rS r\S 5       r	Sr
g)r	   g   zAdds delta specific information,
Either the 20 byte sha which points to some object in the database,
or the negative offset from the pack_offset, so that pack_offset - delta_info yields
the pack offset of the base objectc                 2    [         R                  XX#U45      $ r   r   )r   rI   r   r   
delta_infos        r   r   ODeltaPackInfo.__new__o   s    }}St:"FGGr   c                     U S   $ N   r'   r(   s    r   rZ   ODeltaPackInfo.delta_infos   r5   r   r'   N)r>   r?   r@   rA   rB   r   rC   r   rD   rZ   rE   r'   r   r   r	   r	   g   s*    * IH  r   r	   c                   L    \ rS rSrSr\" 5       rS rS rS	S jr	\
S 5       rSrg)
r
   y   zBase for object streams retrieved from the database, providing additional
information about the stream.
Generally, ODB streams are read-only as objects are immutablec                 2    [         R                  XX#U45      $ z+Helps with the initialization of subclassesr   r   r   r   r   streamr#   kwargss          r   r   OStream.__new__       }}SF";<<r   c                 .    [         R                  U 5        g r   r   )r"   r#   rf   s      r   r    OStream.__init__   r%   r   c                 *    U S   R                  U5      $ r]   readr"   r   s     r   rm   OStream.read       Aw||D!!r   c                     U S   $ r]   r'   r(   s    r   re   OStream.stream   r5   r   r'   N)r>   r?   r@   rA   rB   r   rC   r   r    rm   rD   re   rE   r'   r   r   r
   r
   y   s4    E I=
"  r   r
   c                   .    \ rS rSrSrS r\S 5       rSrg)ODeltaStream   z,Uses size info of its stream, delaying readsc                 2    [         R                  XX#U45      $ rc   r   rd   s          r   r   ODeltaStream.__new__   rh   r   c                      U S   R                   $ r]   )r   r(   s    r   r   ODeltaStream.size   s    Aw||r   r'   N)	r>   r?   r@   rA   rB   r   rD   r   rE   r'   r   r   rv   rv      s    6=  r   rv   c                   F    \ rS rSrSr\" 5       rS rSS jr\	S 5       r
Srg)	r      z[Next to pack object information, a stream outputting an undeltified base object
is providedc                 2    [         R                  XX#U45      $ rc   r   )r   rI   r   r   re   r#   s         r   r   OPackStream.__new__   s    }}St6"BCCr   c                 *    U S   R                  U5      $ r]   rl   rn   s     r   rm   OPackStream.read   rp   r   c                     U S   $ r]   r'   r(   s    r   re   OPackStream.stream   r5   r   r'   Nrs   r>   r?   r@   rA   rB   r   rC   r   rm   rD   re   rE   r'   r   r   r   r      s-    ID
"  r   r   c                   F    \ rS rSrSr\" 5       rS rSS jr\	S 5       r
Srg)	r      zFProvides a stream outputting the uncompressed offset delta informationc                 2    [         R                  XX#XE45      $ r   r   )r   rI   r   r   rZ   re   s         r   r   ODeltaPackStream.__new__   s    }}St:"NOOr   c                 *    U S   R                  U5      $ N   rl   rn   s     r   rm   ODeltaPackStream.read   rp   r   c                     U S   $ r   r'   r(   s    r   re   ODeltaPackStream.stream   r5   r   r'   Nrs   r   r'   r   r   r   r      s+    PIP"  r   r   c                       \ rS rSrSr\" 5       rSS jrSS jr\	S 5       r
S rS r\	" \\5      rSS	 jrS
 rS r\	" \\5      rS rS r\	" \\5      rS rS r\	" \\5      rS rS r\	" \\5      rSrg)r      aW  Represents an input content stream to be fed into the ODB. It is mutable to allow
the ODB to record information about the operations outcome right in this instance.

It provides interfaces for the OStream and a StreamReader to allow the instance
to blend in without prior conversion.

The only method your content stream must support is 'read'Nc                 4    [         R                  XXUS 45      $ r   )listr   )r   r   r   re   r   s        r   r   IStream.__new__   s    ||Ct64!@AAr   c                 6    [         R                  XXUS 45        g r   )r   r    )r"   r   r   re   r   s        r   r    IStream.__init__   s    d$fd;<r   c                     [        U S   5      $ r-   r   r(   s    r   r.   IStream.hexsha   r0   r   c                     U S   $ )zD:return: the error that occurred when processing the stream, or Noner   r'   r(   s    r   _errorIStream._error   r5   r   c                     XS'   g)zFSet this input stream to the given exc, may be None to reset the errorr   Nr'   )r"   excs     r   
_set_errorIStream._set_error   s	    Qr   c                 *    U S   R                  U5      $ )z\Implements a simple stream reader interface, passing the read call on
to our internal streamr^   rl   rn   s     r   rm   IStream.read   s     Aw||D!!r   c                     XS'   g rN   r'   )r"   r)   s     r   _set_binshaIStream._set_binsha   	    Qr   c                     U S   $ rN   r'   r(   s    r   _binshaIStream._binsha       Awr   c                     U S   $ r2   r'   r(   s    r   _typeIStream._type   r   r   c                     XS'   g r2   r'   )r"   r   s     r   	_set_typeIStream._set_type  	    Qr   c                     U S   $ r;   r'   r(   s    r   _sizeIStream._size  r   r   c                     XS'   g r;   r'   rn   s     r   	_set_sizeIStream._set_size  r   r   c                     U S   $ r]   r'   r(   s    r   _streamIStream._stream  r   r   c                     XS'   g r]   r'   )r"   re   s     r   _set_streamIStream._set_stream  r   r   r'   r   rs   )r>   r?   r@   rA   rB   r   rC   r   r    rD   r.   r   r   errorrm   r   r   r)   r   r   r   r   r   r   r   r   re   rE   r'   r   r   r   r      s    B IB= # # VZ(E" g{+F E9%D E9%D g{+Fr   r   c                   b    \ rS rSrSr\" 5       rS rS r\	S 5       r
\	S 5       r\	S 5       rSrg	)
r   i  zCarries information about a sha identifying an object which is invalid in
the queried database. The exception attribute provides more information about
the cause of the issuec                 0    [         R                  XU45      $ r   r   )r   r   r   s      r   r   InvalidOInfo.__new__"  s    }}S*--r   c                 2    [         R                  XU45        g r   r   )r"   r   r   s      r   r    InvalidOInfo.__init__%  s    t3Z(r   c                     U S   $ rN   r'   r(   s    r   r)   InvalidOInfo.binsha(  r5   r   c                     [        U S   5      $ rN   r   r(   s    r   r.   InvalidOInfo.hexsha,  s    $q'""r   c                     U S   $ )z2:return: exception instance explaining the failurer3   r'   r(   s    r   r   InvalidOInfo.error0  r+   r   r'   N)r>   r?   r@   rA   rB   r   rC   r   r    rD   r)   r.   r   rE   r'   r   r   r   r     sV     I.)   # #  r   r   c                   &    \ rS rSrSr\" 5       rSrg)r   i6  z/Carries information about an invalid ODB streamr'   N)r>   r?   r@   rA   rB   r   rC   rE   r'   r   r   r   r   6  s    9Ir   r   N)rB   
gitdb.utilr   	gitdb.funr   r   __all__r   r   r   r	   r
   rv   r   r   r   r   r   r   r'   r   r   <module>r      s   
 W !
8*E *\   JY $e 47 ") (~ $L,d L,b5 6\ r   