
    .Ph                        d Z g dZddlmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddl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 G d d          Z G d de          Z G d de          Z G d de          Z dS )z#Additional types used by the index.)
BlobFilterBaseIndexEntry
IndexEntry	StageType    )b2a_hex)Path)Blob   )packunpack)
NamedTupleSequenceTYPE_CHECKINGTupleUnioncast)PathLike)Repoi  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   zPredicate to be used by
    :meth:`IndexFile.iter_blobs <git.index.base.IndexFile.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.
    pathsr   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.
        Nr   )selfr   s     M/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/git/index/typ.py__init__zBlobFilter.__init__0   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>C   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__8   s    ",Q-"4+5mT+J+Jc--PTUbPcPc	
 		 		H%/$%?%?ST(^^D  :L"J<  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 named tuple to provide named attribute access for :class:`BaseIndexEntry`.

    This is needed to allow overriding ``__new__`` in child class to preserve backwards
    compatibility.
    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:   H   s           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   a  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 :class:`IndexEntry` type, methods
    expecting a :class:`BaseIndexEntry` can also handle full :class:`IndexEntry`\s even
    if they use numeric indices for performance reasons.
    	inp_tupler   c                 8     t                      j        | g|R  S )z\Override ``__new__`` to allow construction from a tuple for backwards
        compatibility.)super__new__)clsrJ   	__class__s     r   rM   zBaseIndexEntry.__new__e   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__p   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__s   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.hexshav   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 :manpage:`git-read-tree(1)`.
        )r=   CE_STAGEMASKCE_STAGESHIFTrT   s    r   rS   zBaseIndexEntry.stage{   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   \   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   a-  Allows convenient access to index entry data as defined in
    :class:`BaseIndexEntry` without completely unpacking it.

    Attributes usually 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 time
        r>   )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 )z:See :attr:`ctime` property, but returns modification time.r>   )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 :class:`BaseIndexEntry` instance.
            Missing values will be set to null-like values.

        :param base:
            Instance of type :class:`BaseIndexEntry`.
        r>   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          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   __all__binasciir   pathlibr   git.objectsr	   utilr   r   typingr   r   r   r   r   r   	git.typesr   git.repor   rF   r   CE_NAMEMASKr\   CE_EXTENDEDCE_VALIDr]   r   r:   r   r   r"   r   r   <module>r~      s   * )
E
E
E                           K J J J J J J J J J J J J J J J       	
 
       D    :   (4= 4= 4= 4= 4=) 4= 4= 4=n7
 7
 7
 7
 7
 7
 7
 7
 7
 7
r   