
    64%el                     
   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZmZmZmZmZmZmZ ddlmZ erdd	lmZ eZd
ZdZdZdZdZdZ G d de          Z G d de          Z  G d de           Z! G d de!          Z"dS )z.Module with additional types used by the index    )b2a_hex)Path   )packunpack)Blob)
NamedTupleSequenceTYPE_CHECKINGTupleUnioncastList)PathLike)Repo)
BlobFilterBaseIndexEntry
IndexEntry	StageTypei  i 0  i @  i      c                   R    e Zd ZdZdZdee         ddfdZdee	e
f         defdZdS )r   z
    Predicate to be used by iter_blobs allowing to filter only return blobs which
    match the given list of directories or files.

    The given paths are given relative to the repository.
    pathsreturnNc                     || _         dS )z
        :param paths:
            tuple or list of paths which are either pointing to directories or
            to files relative to the current repository
        N)r   )selfr   s     -lib/python3.11/site-packages/git/index/typ.py__init__zBlobFilter.__init__.   s     


    
stage_blobc                 ~   |d         j         }t          |t                    r|nt          |          }| j        D ]}t          |t                    r|nt          |          }|j        }|j        }t          |          t          |          k    rWt          d t          ||          D                       r dS dS )Nr   c              3   (   K   | ]\  }}||k    V  d S )N ).0ijs      r   	<genexpr>z&BlobFilter.__call__.<locals>.<genexpr>@   s*      DDda16DDDDDDr   TF)path
isinstancer   r   partslenallzip)r   r   blob_pathlike	blob_pathpathliker'   filter_parts
blob_partss           r   __call__zBlobFilter.__call__6   s    ",Q-"4+5mT+J+Jc--PTUbPcPc	
 	 	H%/$%?%?ST(^^D&*jL$-OJ<  3z??22DDc,
&C&CDDDDD ttur   )__name__
__module____qualname____doc__	__slots__r
   r   r   r   r   r   boolr2   r"   r   r   r   r   #   sw          Ihx0 T    5D#9 d      r   r   c                       e Zd ZU dZeed<   eed<   eed<   eed<    eddd          Z	eed<    eddd          Z
eed	<   dZeed
<   dZeed<   dZeed<   dZeed<   dZeed<   dS )BaseIndexEntryHelperzTyped namedtuple to provide named attribute access for BaseIndexEntry.
    Needed to allow overriding __new__ in child class to preserve backwards compat.modebinshaflagsr'   >LLr   ctime_bytesmtime_bytesdevinodeuidgidsizeN)r3   r4   r5   r6   int__annotations__bytesr   r   r?   r@   rA   rB   rC   rD   rE   r"   r   r   r:   r:   E   s         W W IIIMMMJJJ
NNNeQ**K***eQ**K***CLLLE3NNNCLLLCLLLD#MMMMMr   r:   c                        e Zd ZdZdeeeeeef         eeeeeeeeeeeef         f         dd f fdZ	de
fdZde
fdZede
fd            Zedefd            Zedd
ededd fd            ZdddefdZ xZS )r   aq  Small Brother of an index entry which can be created to describe changes
    done to the index in which case plenty of additional information is not required.

    As the first 4 data members match exactly to the IndexEntry type, methods
    expecting a BaseIndexEntry can also handle full IndexEntries even if they
    use numeric indices for performance reasons.
    	inp_tupler   c                 8     t                      j        | g|R  S )zOOverride __new__ to allow construction from a tuple for backwards compatibility)super__new__)clsrJ   	__class__s     r   rM   zBaseIndexEntry.__new__`   s#     uwws/Y////r   c                 <    d| j         | j        | j        | j        fz  S )Nz%o %s %i	%sr;   hexshastager'   r   s    r   __str__zBaseIndexEntry.__str__j   s    DKTY OOOr   c                 <    d| j         | j        | j        | j        fz  S )Nz(%o, %s, %i, %s)rQ   rT   s    r   __repr__zBaseIndexEntry.__repr__m   s    !TYTZ$SSSr   c                 P    t          | j                                      d          S )zhex version of our shaascii)r   r<   decoderT   s    r   rR   zBaseIndexEntry.hexshap   s"     t{##**7333r   c                 0    | j         t          z  t          z	  S )a  Stage of the entry, either:

            * 0 = default stage
            * 1 = stage before a merge or common ancestor entry in case of a 3 way merge
            * 2 = stage of entries from the 'left' side of the merge
            * 3 = stage of entries from the right side of the merge

        :note: For more information, see http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html
        )r=   CE_STAGEMASKCE_STAGESHIFTrT   s    r   rS   zBaseIndexEntry.stageu   s     
\)m;;r   r   blobrS   c                 N     | |j         |j        |t          z  |j        f          S )z9:return: Fully equipped BaseIndexEntry at the given stage)r;   r<   r]   r'   )rN   r^   rS   s      r   	from_blobzBaseIndexEntry.from_blob   s(     sDIt{E],BDINOOOr   repor   c                 D    t          || j        | j        | j                  S )z7:return: Blob using the information of this index entry)r   r<   r;   r'   )r   ra   s     r   to_blobzBaseIndexEntry.to_blob   s    D$+ty$)<<<r   r   )r3   r4   r5   r6   r   r   rF   rH   r   rM   strrU   rW   propertyrR   rS   classmethodr   r`   rc   __classcell__)rO   s   @r   r   r   V   s        0#uc8+,#uc8UE3S#sRSU
0 
0 0 0 0 0 0P P P P PT# T T T T 4 4 4 4 X4 
<s 
< 
< 
< X
< P PT P# P6F P P P [P=F =t = = = = = = = =r   r   c                       e Zd ZdZedeeef         fd            Zedeeef         fd            Ze	dd            Z
e	dd	ed
edd fd            ZdS )r   zAllows convenient access to IndexEntry data without completely unpacking it.

    Attributes usully accessed often are cached in the tuple whereas others are
    unpacked on demand.

    See the properties for a mapping between names and tuple indices.r   c                 v    t          t          t          t          f         t          d| j                            S )z{
        :return:
            Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
            file's creation timer>   )r   r   rF   r   r?   rT   s    r   ctimezIndexEntry.ctime   s)     E#s(OVE43C%D%DEEEr   c                 v    t          t          t          t          f         t          d| j                            S )z1See ctime property, but returns modification timer>   )r   r   rF   r   r@   rT   s    r   mtimezIndexEntry.mtime   s)     E#s(OVE43C%D%DEEEr   baser   c                     t          ddd          }t          |j        |j        |j        |j        ||dddddf          S )z
        :return:
            Minimal entry as created from the given BaseIndexEntry instance.
            Missing values will be set to null-like values

        :param base: Instance of type BaseIndexEntryr>   r   )r   r   r;   r<   r=   r'   )rN   rn   times      r   	from_basezIndexEntry.from_base   sH     E1a  49dk4:ty$PTVWYZ\]_`bcdeeer   r   r^   rS   c                     t          ddd          }t          |j        |j        |t          z  |j        ||dddd|j        f          S )z7:return: Minimal entry resembling the given blob objectr>   r   )r   r   r;   r<   r]   r'   rE   )rN   r^   rS   rp   s       r   r`   zIndexEntry.from_blob   sZ     E1a  	&		
 
 	
r   N)rn   r   r   r   rd   )r3   r4   r5   r6   rf   r   rF   rk   rm   rg   rq   r   r`   r"   r   r   r   r      s        I I FuS#X F F F XF FuS#X F F F XF f f f [f 
 
T 
# 
l 
 
 
 [
 
 
r   r   N)#r6   binasciir   pathlibr   utilr   r   git.objectsr   typingr	   r
   r   r   r   r   r   	git.typesr   git.repor   rF   r   __all__CE_NAMEMASKr\   CE_EXTENDEDCE_VALIDr]   objectr   r:   r   r   r"   r   r   <module>r      s   4 4                          
 Q P P P P P P P P P P P P P P P P P       	 F 
       D    :   "3= 3= 3= 3= 3=) 3= 3= 3=l3
 3
 3
 3
 3
 3
 3
 3
 3
 3
r   