yL idZgdZddlmZddlmZddlmZddlm Z m Z ddl m Z m Z mZmZmZmZdd lmZerdd lmZeZd Zd Zd ZdZdZGddZGdde ZGddeZGddeZ y)z#Additional types used by the index.) BlobFilterBaseIndexEntry IndexEntry StageType)b2a_hex)Path)Blob)packunpack) NamedTupleSequence TYPE_CHECKINGTupleUnioncast)PathLike)Repoii0i@i cDeZdZdZdZdeeddfdZdee e fde fdZ y) rzPredicate to be used by :meth:`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. pathsrreturnNc||_y)z :param paths: Tuple or list of paths which are either pointing to directories or to files relative to the current repository. Nr)selfrs S/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/git/index/typ.py__init__zBlobFilter.__init__0s  stage_blobcT|dj}t|tr|n t|}|jD]m}t|tr|n t|}|j}|j}t |t |kDrPt dt||Dsmyy)Nr c3,K|] \}}||k(yw)N).0ijs r z&BlobFilter.__call__..CsDda16DsTF)path isinstancerrpartslenallzip)rr blob_pathlike blob_pathpathliker' filter_parts blob_partss r__call__zBlobFilter.__call__8s",Q-"4"4 +5mT+J-PTUbPc  H%/$%?T(^D ::L"J< 3z?2Dc, &CDD r) __name__ __module__ __qualname____doc__ __slots__rrrrrr boolr2r"rrrr&sBIhx0T 5D#9 d rrceZdZUdZeed<eed<eed<eed<edddZ eed<edddZ eed <dZ eed <dZ eed <dZ eed <dZeed <dZeed<y)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. modebinshaflagsr'>LLr ctime_bytes mtime_bytesdevinodeuidgidsizeN)r3r4r5r6int__annotations__bytesrr r?r@rArBrCrDrEr"rrr:r:Hsp I M J NeQ*K*eQ*K*CLE3NCLCLD#Mrr:ceZdZdZdeeeeeefeeeeeeeeeeeef fddffd Z de fdZ de fdZ e de fdZe defdZedd ed eddfd Zd d defdZxZS)raSmall 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_tuplerc$t||g|S)z\Override ``__new__`` to allow construction from a tuple for backwards compatibility.)super__new__)clsrJ __class__s rrMzBaseIndexEntry.__new__esws/Y//rcdd|j|j|j|jfzS)Nz %o %s %i %sr;hexshastager'rs r__str__zBaseIndexEntry.__str__ps&DKKTYY OOOrcdd|j|j|j|jfzS)Nz(%o, %s, %i, %s)rQrTs r__repr__zBaseIndexEntry.__repr__ss&!TYY TZZ$SSSrcJt|jjdS)zhex version of our shaascii)rr<decoderTs rrRzBaseIndexEntry.hexshavst{{#**733rc6|jtztz 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_STAGESHIFTrTs rrSzBaseIndexEntry.stage{s \)m;;rblobrScd||j|j|tz|jfS)z9:return: Fully equipped BaseIndexEntry at the given stage)r;r<r]r')rNr^rSs r from_blobzBaseIndexEntry.from_blobs)DIIt{{E],BDIINOOrreporcZt||j|j|jS)z7:return: Blob using the information of this index entry)r r<r;r')rras rto_blobzBaseIndexEntry.to_blobsD$++tyy$))<)rrrFr r?rTs rctimezIndexEntry.ctimes&E#s(OVE43C3C%DEErcdttttftd|jS)z:See :attr:`ctime` property, but returns modification time.r>)rrrFr r@rTs rmtimezIndexEntry.mtimes&E#s(OVE43C3C%DEErc tddd}t|j|j|j|j ||dddddf 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 rr;r<r=r')rNbasetimes r from_basezIndexEntry.from_basesJE1a 499dkk4::tyy$PTVWYZ\]_`bcdeerr^rSc tddd}t|j|j|tz|j ||dddd|j f S)z7:return: Minimal entry resembling the given blob objectr>r)r rr;r<r]r'rE)rNr^rSrps rr`zIndexEntry.from_blobsZE1a   &     rN)rorrrrd) r3r4r5r6rfrrFrkrmrgrqr r`r"rrrrsFuS#XFFFuS#XFF f f T # l  rrN)!r6__all__binasciirpathlibr git.objectsr utilr r typingr rrrrr git.typesrgit.reporrFr CE_NAMEMASKr\ CE_EXTENDEDCE_VALIDr]rr:rrr"rrr~s~* EKJ      D:(4=)4=n7 7 r