§ |<ˆjk#ãóä—dZddlmZmZmZddlmZddlmZm Z ddl m Z ddl m Z dZGd„d ¦«ZGd „d ¦«ZGd „d ¦«ZGd„d¦«Zd„ZGd„deee¦«ZdS)z8Contains implementations of database retrieveing objectsé)ÚjoinÚ LazyMixinÚ hex_to_bin)Ú force_text)Ú BadObjectÚAmbiguousObjectName)Úchain)Úreduce)Ú ObjectDBRÚ ObjectDBWÚ FileDBBaseÚ CompoundDBÚ CachingDBcó6—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z dS) r zkDefines an interface for object database lookup. Objects are identified either by their 20 byte bin shacó—|jS©N)Úhas_obj©ÚselfÚshas ú_/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/python3.11/site-packages/gitdb/db/base.pyÚ __contains__zObjectDBR.__contains__s €ØŒ|Ðócó —td¦«‚)zê Whether the object identified by the given 20 bytes binary sha is contained in the database :return: True if the object identified by the given 20 bytes binary sha is contained in the databaseúTo be implemented in subclass©ÚNotImplementedErrorrs rÚ has_objectzObjectDBR.has_object"s€õ"Ð"AÑBÔBÐBrcó —td¦«‚)zW :return: OInfo instance :param sha: bytes binary sha :raise BadObject:rrrs rÚinfozObjectDBR.info+ó€õ"Ð"AÑBÔBÐBrcó —td¦«‚)z[:return: OStream instance :param sha: 20 bytes binary sha :raise BadObject:rrrs rÚstreamzObjectDBR.stream1r!rcó—t¦«‚)z+:return: amount of objects in this databaser©rs rÚsizezObjectDBR.size7ó€å!Ñ#Ô#Ð#rcó—t¦«‚)zGReturn iterator yielding 20 byte shas for all objects in this data baserr%s rÚsha_iterzObjectDBR.sha_iter;r'rN) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr r#r&r)©rrr r s�€€€€€ð>ð>ððððCðCðCðCðCðCð CðCðCð $ð$ð$ð$ð$ð$ð$ð$rr có*—eZdZdZd„Zd„Zd„Zd„ZdS)r z6Defines an interface to create objects in the databasecó—d|_dSr©Ú_ostream)rÚargsÚkwargss rÚ__init__zObjectDBW.__init__Fs €ØˆŒ ˆ ˆ rcó"—|j}||_|S)ab Adjusts the stream to which all data should be sent when storing new objects :param stream: if not None, the stream to use, if None the default stream will be used. :return: previously installed stream, or None if there was no override :raise TypeError: if the stream doesn't have the supported functionalityr1)rr#Úcstreams rÚ set_ostreamzObjectDBW.set_ostreamJs€ð”-ˆØˆŒ ؈rcó—|jS)z¤ Return the output stream :return: overridden output stream this instance will write to, or None if it will write to the default streamr1r%s rÚostreamzObjectDBW.ostreamVs €ð Œ}Ðrcó —td¦«‚)a¿ Create a new object in the database :return: the input istream object with its sha set to its corresponding value :param istream: IStream compatible instance. If its sha is already set to a value, the object will just be stored in the our database format, in which case the input stream is expected to be in object format ( header + contents ). :raise IOError: if data could not be writtenrr)rÚistreams rÚstorezObjectDBW.store^s€õ"Ð"AÑBÔBÐBrN)r*r+r,r-r5r8r:r=r.rrr r Bs[€€€€€à@Ð@ðððð ð ð ðððð Cð Cð Cð Cð Crr có.‡—eZdZdZˆfd„Zd„Zd„ZˆxZS)r z}Provides basic facilities to retrieve files of interest, including caching facilities to help mapping hexsha's to objectscóV•—t¦« ¦«||_dS)aYInitialize this instance to look for its files at the given root path All subsequent operations will be relative to this path :raise InvalidDBRoot: **Note:** The base will not perform any accessablity checking as the base might not yet be accessible, but become accessible before the first access.N)Úsuperr5Ú _root_path)rÚ root_pathÚ __class__s €rr5zFileDBBase.__init__qs&ø€õ ‰Œ×ÒÑÔÐØ#ˆŒˆˆrcó—|jS)z':return: path at which this db operates)rAr%s rrBzFileDBBase.root_path|s €àŒÐrcóF—t|jt|¦«¦«S)z~ :return: the given relative path relative to our database root, allowing to pontentially access datafiles)rrAr)rÚ rela_paths rÚdb_pathzFileDBBase.db_path€s€õ�D”O¥Z° Ñ%:Ô%:Ñ;Ô;Ð;r)r*r+r,r-r5rBrGÚ __classcell__©rCs@rr r ls`ø€€€€€ð>ð>ð$ð$ð$ð$ð$ðððð<ð<ð<ð<ð<ð<ðz'_databases_recursive..žs1èè€ÐIÐI˜R­j¸½ZÑ.HÔ.HÐI�bÐIÐIÐIÐIÐIÐIrc3óDK—|]}t|t¦«¯|V—ŒdSrrQrSs rrVz'_databases_recursive..Ÿs1èè€ÐCÐC˜2­ °2µzÑ(BÔ(BÐC�BÐCÐCÐCÐCÐCÐCrN)rRrÚ databasesÚextendÚ_databases_recursiveÚappend)ÚdatabaseÚoutputÚdbsÚcdbs rrZrZ™sœ€õ�(�JÑ'Ô'ð Ø× Ò Ñ"Ô"ˆØ� Š ÐIÐI 3ÐIÑIÔIÑIÔIÐIØCÐC ÐCÑCÔCð .ð .ˆCÝ   fÑ -Ô -Ð -Ð -ð .ð .ð � Š �hÑÔÐÐÐrcóZ‡—eZdZdZˆfd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d d „Z d „Z ˆxZS)rz§A database which delegates calls to sub-databases. Databases are stored in the lazy-loaded _dbs attribute. Define _set_cache_ to update it with your databasescó¶•—|dkrt¦«|_dS|dkrt¦«|_dSt ¦« |¦«dS)NÚ_dbsÚ _db_cache)ÚlistrbÚdictrcr@Ú _set_cache_)rÚattrrCs €rrfzCompoundDB._set_cache_­sSø€Ø �6Š>ˆ>Ý™œˆDŒIˆIˆIØ �[Ò Ð Ý!™VœVˆDŒNˆNˆNå ‰GŒG× Ò  Ñ %Ô %Ð %Ð %Ð %rcó¶— |j|S#t$rYnwxYw|jD]%}| |¦«r||j|<|cSŒ&t |¦«‚)zL:return: database containing the given 20 byte sha :raise BadObject:)rcÚKeyErrorrbrr)rrrUs rÚ _db_queryzCompoundDB._db_queryµsƒ€ð  Ø”> #Ô&Ð &øÝð ð ð Ø ˆDð øøøð”)ð ð ˆBØ�}Š}˜SÑ!Ô!ð Ø&(�”˜sÑ#Ø� � � ð õ˜‰nŒnÐs ‚ � ›cóT— | |¦«dS#t$rYdSwxYw)NTF)rjrrs rrzCompoundDB.has_objectÉs@€ð Ø �NŠN˜3Ñ Ô Ð Ø�4øÝð ð ð Ø�5�5ð øøøs ‚™ '¦'cóR—| |¦« |¦«Sr)rjr rs rr zCompoundDB.infoÑs"€Ø�~Š~˜cÑ"Ô"×'Ò'¨Ñ,Ô,Ð,rcóR—| |¦« |¦«Sr)rjr#rs rr#zCompoundDB.streamÔs"€Ø�~Š~˜cÑ"Ô"×)Ò)¨#Ñ.Ô.Ð.rcóD—td„d„|jD¦«d¦«S)z.:return: total size of all contained databasescó —||zSrr.)ÚxÚys rúz!CompoundDB.size..Ùs € 1 q¡5€rc3ó>K—|]}| ¦«V—ŒdSr)r&rSs rrVz"CompoundDB.size..Ùs*èè€Ð*IÐ*I¸¨2¯7ª7©9¬9Ð*IÐ*IÐ*IÐ*IÐ*IÐ*Irr)r rbr%s rr&zCompoundDB.size×s)€åÐ(Ð(Ð*IÐ*I¸t¼yÐ*IÑ*IÔ*IÈ1ÑMÔMÐMrcó2—td„|jD¦«ŽS)Nc3ó>K—|]}| ¦«V—ŒdSr)r)rSs rrVz&CompoundDB.sha_iter..Üs*èè€Ð9Ð9¨�r—{’{‘}”}Ð9Ð9Ð9Ð9Ð9Ð9r)r rbr%s rr)zCompoundDB.sha_iterÛs€ÝÐ9Ð9¨t¬yÐ9Ñ9Ô9Ð:Ð:rcó*—t|j¦«S)z7:return: tuple of database instances we use for lookups)Útuplerbr%s rrXzCompoundDB.databasesâs€å�T”YÑÔÐrFcóª—|j ¦«d}|jD]/}t|t¦«r|| |¦«z}Œ0|S)NF)rcÚclearrbrRrrM)rrLÚstatrUs rrMzCompoundDB.update_cacheæs\€à Œ×ÒÑÔÐØˆØ”)ð /ð /ˆBݘ"�iÑ(Ô(ð /ؘŸš¨Ñ.Ô.Ñ.�øðˆ rcóÚ—t¦«}t||¦«t|¦«}t|¦«}|dzdkrt |dz¦«}nt |¦«}d}|D]m}d} t |d¦«r| |¦«}n| ||¦«}n#t$rYŒNwxYw|r|r||krt|¦«‚|}Œn|st|¦«‚|S)z¾ :return: 20 byte binary sha1 from the given less-than-40 byte hexsha (bytes or str) :param partial_hexsha: hexsha with less than 40 byte :raise AmbiguousObjectName: érÚ0NÚpartial_to_complete_sha_hex) rdrZrÚlenrÚhasattrr~Úpartial_to_complete_sharr)rÚpartial_hexsharXÚlen_partial_hexshaÚpartial_binshaÚ candidaterUÚ full_bin_shas rr~z&CompoundDB.partial_to_complete_sha_hexñs7€õ ‘F”Fˆ ݘT 9Ñ-Ô-Ð-Ý# NÑ3Ô3ˆÝ  Ñ0Ô0ÐØ  Ñ ! QÒ &Ð &Ý'¨¸Ñ(<Ñ=Ô=ˆNˆNå'¨Ñ7Ô7ˆNðˆ Øð )ð )ˆB؈Lð ݘ2Ð<Ñ=Ô=ðbØ#%×#AÒ#AÀ.Ñ#QÔ#Q�L�Là#%×#=Ò#=¸nÐN`Ñ#aÔ#a�Løøåð ð ð Ø�ð øøøðð )Øð> ¨lÒ!:Ð!:Ý-¨nÑ=Ô=Ð=Ø(� øðð ,ݘNÑ+Ô+Ð +ØÐsÁ1r�s¬ðð ?Ð>ððððððððððð ,Ð+Ð+Ð+Ð+Ð+ððððððððð ÐÐÐÐÐØÐÐÐÐÐð N€ð$$ð$$ð$$ð$$ð$$ñ$$ô$$ð$$ðR%Cð%Cð%Cð%Cð%Cñ%Cô%Cð%CðT<ð<ð<ð<ð<ñ<ô<ð<ð8 Oð Oð Oð Oð Oñ Oô Oð Oð"  ð  ð  ðnðnðnðnðn�˜I yñnônðnðnðnr