yL iͫ UddlZgdZejdk(rejdddlmZddlZddlmZddl Z ddl Z ddl Z ddl m ZddlZddlZddlZddlZddlZddlZddlZddlmZmZddlZddlmZmZmZmZmZmZm Z m!Z!m"Z"dd l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5e1rdd l6m7Z7dd l8m9Z9m:Z:dd l;mZ>ddl?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHe2de3ddZIe jeKZLdeMdeNdeNfdZOdeMdeNdeNfdZPePddZQePddZRe2dZSde'deSfde'deSffdZTejdeDde)eDddffdZVejdeMd eMde)d!fd"ZWd#eDddfd$ZXd#eDddfd%ZYdmd&e&d'e&d(eZdeZfd)Z[d*eDd+eDdeDfd,Z\ejdk(rd#eDdeDfd-Z]d#eDdeMfd.Z^e]Z_n d#eDdeMfd/Z^e^Z_d*eDd+eDdeDfd0Z`dnd#eDd2eNdeNfd3Zade/eMfd4Zbdod5eMd#e-eDde,eMfd6Zcd7e-eMd#eMdeMfd8Zdejd9d:d1fejd;edd1fejd<edd1fejd=ejd>dfejd?d@d1ffZge0e0e.eMe'eNfdfehdA<d#eMdeMfdBZiejdCZjd#eDdeMfdDZkiZle(eMe-eNfehdE<dFeMdeNfdGZme5dFddeCd1fdHZne5dFeDdeNfdIZndFe3deDfdeNfdJZndeMfdKZodLe3ejdMfdNe$ddfdOZqe5dpd+ddPeNddfdQZre5dpd+eDdPeNdeMfdRZrdqd+e3deDfdPeNde-eDfdSZrdTe/eMde,eMfdUZsGdVdWZtGdXdYetZuGdZd[ZvGd\d]ZwGd^d_ZxGd`daZyGdbdceyZzGdddee,eIZ{eHGdfdgeEZ|Gdhdie}Z~Gdjdke~lZy)rN) stream_copy join_pathto_native_path_linuxjoin_path_nativeStatsIndexFileSHA1Writer IterableObj IterableListBlockingLockFileLockFileActor get_user_idassure_directory_existsRemoteProgressCallableRemoteProgressrmtree unbare_repoHIDE_WINDOWS_KNOWN_ERRORSwin32to_native_path_windows)abstractmethod)wraps)urlsplit urlunsplit) LazyMixinLockedFD bin_to_hexfile_contents_rofile_contents_ro_filepath hex_to_binmake_sha to_bin_sha to_hex_sha)AnyAnyStrBinaryIOCallableDict GeneratorIOIteratorListOptionalPatternSequenceTuple TYPE_CHECKINGTypeVarUnioncastoverload)Git)GitConfigParserSectionConstraint)Remote)Repo) Files_TDHas_id_attributeHSH_TDLiteralPathLikeProtocol SupportsIndexTotal_TDruntime_checkable T_IterableObj)r r<T)bound covariantnamedefaultreturnc tj|}tj d||j j }|dvry|dvrytj d||||S#t$r|cYSwxYw)zRead a boolean flag from an environment variable. :return: The flag, or the `default` value if absent or ambiguous. zlThe %s environment variable is deprecated. Its effect has never been documented and changes without warning.>0nofalseF>1yestrueTz-%s has unrecognized value %r, treating as %r.)osenvironKeyError_loggerwarningstriplower)rGrHvalueadjusted_values N/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/git/util.py_read_env_flagr\ss  4  OOv  [[]((*N11-- OOCT5RYZ N sA-- A;:A;cDtjdk(xr t||S)aRead a boolean flag from an environment variable on Windows. :return: On Windows, the flag, or the `default` value if absent or ambiguous. On all other operating systems, ``False``. :note: This only accesses the environment on Windows. r)sysplatformr\)rGrHs r[_read_win_env_flagr`s <<7 " D~dG'DDrHIDE_WINDOWS_FREEZE_ERRORSTfunc.c hddlmtdddtdtdtffd }|S) ztMethods with this decorator raise :exc:`~git.exc.InvalidGitRepositoryError` if they encounter a bare repository.)InvalidGitRepositoryErrorselfr9argskwargsrIcr|jjrdjz|g|i|S)Nz/Method '%s' cannot operate on bare repositories)repobare__name__)rhrirjrgrds r[wrapperzunbare_repo..wrappers; 99>>+,]`d`m`m,mn nD*4*6**ra)excrgrr$rc)rdrorgs` @r[rrsA/ 4[+h+s+c+a++ Nranew_dirc#Ktj}tj| |tj|y#tj|wxYww)zContext manager to temporarily change directory. This is similar to :func:`contextlib.chdir` introduced in Python 3.11, but the context manager object returned by a single call to this function is not reentrant. N)rRgetcwdchdir)rqold_dirs r[cwdrvsAiikGHHW  s*A!AA!AA!rY)NNNc# Ktj|}|tj|< d|tj|=y|tj|<y#|tj|=w|tj|<wxYww)z=Context manager to temporarily patch an environment variable.N)rRgetenvrS)rGrY old_values r[ patch_envrzsn $IBJJt)   4 (BJJt    4 (BJJt s)BA(B)BBpathc dtdtdtddfd}tjdk7rt j |ytjdk\rt j || yt j || y) zRemove the given directory tree recursively. :note: We use :func:`shutil.rmtree` but adjust its behaviour to see whether files that couldn't be deleted are read-only. Windows will not remove them in that case. functionr{_excinforINctj|tj ||y#t$r}t rddlm}|d||d}~wwxYw)zuCallback for :func:`shutil.rmtree`. This works as either a ``onexc`` or ``onerror`` style callback. r)SkipTestz%FIXME: fails with: PermissionError N)rRchmodstatS_IWUSRPermissionErrorrunittestr)r}r{r~exrs r[handlerzrmtree..handlersQ t||$  TN (-!GtLMSUU   s/ AAAr) )onexc)onerror)r'r?r$r^r_shutilr version_info)r{rs r[rrsg((cd" ||w d  W $ d'* dG,ractj|r?tjdk(rt j |dt j |yy)zWEnsure file deleted also on *Windows* where read-only files need special treatment.riN)ospisfiler^r_rRrremover{s r[rmfilers: zz$ <<7 " HHT5 ! $rasource destination chunk_sizecd} |j|}|j||t|z }t||kr |SB)zCopy all data from the `source` stream into the `destination` stream in chunks of size `chunk_size`. :return: Number of bytes written r)readwritelen)rrrbrchunks r[rrsO B  J'%  c%j u: "  I raapct|}|D]N}t|}|s|jdr ||ddz }+|dk(s|jdr||z }G|d|zz }P|S)zmJoin path tokens together similar to osp.join, but always use ``/`` instead of possibly ``\`` on Windows./rfNrK)str startswithendswith)rrr{bs r[rrsu q6D   F  <<  AabEMD RZ4==- AID C!GOD  Krac<t|}|jddS)Nr\rreplacers r[rr$s4y||C&&rac<t|}|jddS)Nrrrrs r[rr(s4y||D#&&ract|SN)rrs r[rr/s 4yrac,tt|g|S)zLike :func:`join_path`, but makes sure an OS native path is returned. This is only needed to play it safe on Windows and to ensure nice paths that only use ``\``. )to_native_pathr)rrs r[rr5s )A** ++raFis_filec|rtj|}tj|stj|dyy)a$Make sure that the directory pointed to by path exists. :param is_file: If ``True``, `path` is assumed to be a file and handled correctly. Otherwise it must be a directory. :return: ``True`` if the directory was created, ``False`` if it already existed. T)exist_okF)rdirnameisdirrRmakedirs)r{rs r[rr>s4{{4  99T? D4( ractjjdd}|r/td|j tj DSt jdk(ryy)NPATHEXTc3<K|]}|jywr)upper).0rs r[ z&_get_exe_extensions..TsB1QWWYBsr)z.BATz.COMz.EXE)rRrSgettuplesplitpathsepr^r_)rs r[_get_exe_extensionsrQsIjjnnY-GB bjj(ABBB  'raprogramctdtdtffd }g}|stjd}t|j tj D]c}|jd}|stj||}|gDcgc]}|| c}zD]}||s |j|e|Scc}w)a6Perform a path search to assist :func:`is_cygwin_git`. This is not robust for general use. It is an implementation detail of :func:`is_cygwin_git`. When a search following all shell rules is needed, :func:`shutil.which` can be used instead. :note: Neither this function nor :func:`shutil.which` will predict the effect of an executable search on a native Windows system due to a :class:`subprocess.Popen` call without ``shell=True``, because shell and non-shell executable search on Windows differ considerably. fpathrIctjxrTtjtjxr.t j dk7xs xstfdDS)Nrc3\K|]#}jj|%ywr)rr)rextrs r[rz,py_where..is_exec..ps$Bwcf5;;=CYCYZ]C^Bws),)rrrRaccessX_OKr^r_any)r winprog_extss`r[is_execzpy_where..is_execksW JJu   %)  'w|+;wsBwjvBw?w  raPATH") rrboolrRrSrrrWrjoinappend) rr{rprogsfolderexe_pathefrs @r[py_wherer[s'(L s t  E zz&!d)//"**-$c" xx0HZ<"PaXq#9"PP $1:LLO $ $ L#Qs Cdrivecjtj|r|s|}n}|xr;tjtjtj|}tj|r|r|}n$t |}n|rd|j d|}t|}|jddS)Nz/proc/cygdrive/rr) risabsnormpath expandvars expandusercygpathrXrr)rr{rp_strs r[ _cygexpathrs yyu   GS\\#..1E"FG 99Q<AJ */++-;A FE ==s ##raz*\\\\\?\\UNC\\([^\\]+)\\([^\\]+)(?:\\(.*))?c 8d|d|d|jddS)N//rr)r)servershare rest_paths r[rs&%IZIZ[_adIe*fraz\\\\\?\\(\w):[/\\](.*)z(\w):[/\\](.*)z file:(.*)c|Srr)rs r[rrs raz (\w{2,}:.*)c|Srr)urls r[rrscra_cygpath_parsersct|}|jdsQtD]<\}}}|j|}|s||j }|r t |}|St d|}|S)zJUse :meth:`git.cmd.Git.polish_url` instead, that works on any environment.)z /cygdriverz/proc/cygdriveN)rrrmatchgroupsrr)r{regexparserrecursers r[rrsx t9D ??@ A&6 * "E67KK%Eu||~."4=D K *dD)D Kraz(?:/proc)?/cygdrive/(\w)(/.*)?ct|}tj|}|r,|j\}}|j d|xsd}|j ddS)N:rKrr)r_decygpath_regexrrrr)r{mrrs r[ decygpathrsU t9Dt$A88:y++-b9 <<T ""ra_is_cygwin_cachegit_executablectj|}| d} tj|}|s't |}|rtj|dnd}tj |d}t j|jr$tj|tjs$tjd|d|t|<|Stj|gtj d}|j#\}}d |v}|t|<|S#t$$r }tjd |Yd}~/d}~wwxYw) NFrrKunamez&Failed checking if running in CYGWIN: z is not an executableT)stdoutuniversal_newlinesCYGWINz/Failed checking if running in CYGWIN due to: %r)rrrrrrpathlibPathrrRrrrUdebug subprocessPopenPIPE communicate Exception) r is_cygwingit_dirres uname_cmdprocess uname_out_rs r[_is_cygwin_gitr s$ $$^4I  Qkk.1G~.14#++c!f-"'2ILL+335"))Irww:W FykQfgh3< 0   && {:??_cdG"..0LIq I-I,5(   Q MMKR P P QsB>D$>D$$ E -EE cyrrrs r[ is_cygwin_gitr ;>racyrrr s r[r r s58ractjdtjd|tjdk7ry|yt t |S)Nz sys.platform=z, git_executable=cygwinF)rUrr^r_r rr s r[r r sJ MMM#,,!11B>BTUV ||x  c.122racXtjdtjS)zM:return: String identifying the currently active system user as ``name@node``@)getpassgetuserr_noderrar[rrsoo' 99raproczGit.AutoInterruptrjc (|jdi|y)zXWait for the process (clone, fetch, pull or push) and handle its errors accordingly.Nr)wait)rrjs r[finalize_processrsDIIra expand_varscyrrrrs r[ expand_pathrrracyrrrs r[rrsract|tjr|jS t j |}|rt j |}t jt j|S#t$rYywxYwr) isinstancerrresolverrrrabspathrrs r[rr si!W\\"yy{ NN1  q!A||CKKN++ sAB B  B cmdlinecg}t|D]\}}|j| t|}|j |j<|j6|j |j j|jd}|j6|j |j j|jd}t|||<|S#t$rYwxYw)a>Parse any command line argument and if one of the elements is an URL with a username and/or password, replace them by stars (in-place). If nothing is found, this just returns the command line as-is. This should be used for every log line that print a command line, as well as exception messages. z*****)netloc) enumeraterrpasswordusername_replacer&rr ValueError)r$ new_cmdlineindexto_parsers r[remove_password_if_presentr/sK$W-x8$ 8$C||# (<||'ll#***<*> $ $%9 :    # #DNN 3 ) 9##))(3 =''--h7E   h '    # #H - DILLNA(Iy' ( ( t}} $G - - t'' 'G ) ) t|| #G + + t~~ %G * * t~~ %G ) ) t++ +G , , t(( (G   h '  $.. ( NN ! !' * tzz !G ?G--/   DOO , txx G5T__!5 56G-- 4 45   *% *  *% *   rac$dtddffd }|S)z :return: A progress handler suitable for :func:`~git.cmd.handle_process_output`, passing lines on to this progress handler in a suitable format. r:rINcBj|jSr)rVrstrip)r:rhs r[rz3RemoteProgress.new_message_handler..handlers,,T[[]; ;ra)r%)rhrs` r[new_message_handlerz"RemoteProgress.new_message_handlers <& `. Nr)rhrQrOrPrUs r[rLzRemoteProgress.updatesH rarINNrK)$rn __module__ __qualname____doc__r2int__annotations__rangerHrJrArBrCrDrErFrG STAGE_MASKOP_MASKrIrK __slots__recompiler?r>r9r%rVr'rrZr@r3rMrL)rxs00r[rr;s/5M3}-.Aa.   JkGJOI  RZZ HINRZZ UVN) W W DW r XseTk%:    .2 $ $ e$$ eT)* $  $  $ C /s B#rcDeZdZdZdZdeddffd Zdededdfd ZxZ S) raA :class:`RemoteProgress` implementation forwarding updates to any callable. :note: Like direct instances of :class:`RemoteProgress`, instances of this :class:`CallableRemoteProgress` class are not themselves directly callable. Rather, instances of this class wrap a callable and forward to it. This should therefore not be confused with :class:`git.types.CallableProgress`.  _callablefnrINc0||_t| yr)rmsuperr9)rhrn __class__s r[r9zCallableRemoteProgress.__init__s rarirjc(|j|i|yrrl)rhrirjs r[rLzCallableRemoteProgress.updates''ra) rnr_r`rargr'r9r$rL __classcell__rqs@r[rrs<I8(C(3(4(rarc beZdZdZej dZej dZdZdZ dZ dZ dZ d Z d Zdeed eed d fd Zded efdZded efdZd efdZd efdZd efdZeded dfdZe ddedededd dfdZeddedd dfdZeddedd dfdZy )r zActors hold information about a person acting on the repository. They can be committers and authors or anything with a name and an email as mentioned in the git log entries.z<(.*)>z (.*) <(.*?)>GIT_AUTHOR_NAMEGIT_AUTHOR_EMAILGIT_COMMITTER_NAMEGIT_COMMITTER_EMAILrGemailrGrzrINc ||_||_yrr{)rhrGrzs r[r9zActor.__init__s  raothercj|j|jk(xr|j|jk(Srr{rhr}s r[__eq__z Actor.__eq__!s'yyEJJ&D4::+DDrac||k( Srrrs r[__ne__z Actor.__ne__$sEM""racDt|j|jfSr)hashrGrzr8s r[__hash__zActor.__hash__'sTYY +,,rac6|jr |jSdSr^)rGr8s r[__str__z Actor.__str__*s IItyy-2-rac<d|jd|jdS)Nz ">r{r8s r[__repr__zActor.__repr__-s*.))TZZ@@rastringc|jj|}|r|j\}}t||S|jj|}|rt|j ddSt|dS)zCreate an :class:`Actor` from a string. :param string: The string, which is expected to be in regular git format:: John Doe :return: :class:`Actor` rfN)name_email_regexsearchrr name_only_regexgroup)clsrrrGrzs r[ _from_stringzActor._from_string0st  ' ' / ((*KD%u% %##**62AQWWQZ..& &raenv_name env_email config_reader)Nr7r8c tdd}d dtf fd dtf fd }d||j|fd||j ffD](\}}}} tj |} t ||| *|S#t$rZ|7 |jd|} n#t$r | } YnwxYwt ||| t||st ||| YwxYw)NrKrIc s tSr)r)user_idsr[ default_emailz(Actor._main_actor..default_emailSs%-Nrac6jddS)Nrr)r)rsr[ default_namez'Actor._main_actor..default_nameYs ?((-a0 0rarGrzuser) r r conf_name conf_emailrRrSsetattrrTrrgetattr) rrrractorrattrevarcvarrHvalrrs @@r[ _main_actorzActor._main_actorIsb"  s   1c 1Xs}}l ; i ?*  4 %D$g 4jj&tS)  4&  4 ,(+//=$(%i(E4-ud+E43 4s6 A66 CBCB(%C'B((.CCcP|j|j|j|S)a :return: :class:`Actor` instance corresponding to the configured committer. It behaves similar to the git implementation, such that the environment will override configuration values of `config_reader`. If no value is set at all, it will be generated. :param config_reader: ConfigReader to use to retrieve the values from in case they are not set in the environment. )renv_committer_nameenv_committer_emailrrs r[ committerzActor.committerqs$s55s7N7NP]^^racP|j|j|j|S)zSame as :meth:`committer`, but defines the main author. It may be specified in the environment, but defaults to the committer.)renv_author_nameenv_author_emailrs r[authorz Actor.authors#s22C4H4H-XXrar) rnr_r`rarhrirrrrrrrrrgr-rr9r$rrrrbrrr classmethodrr3rrrrrar[r r s !bjj+O!rzz/2(O)-/IJ!IXc]8C=TECEDE#C#D#-#-..A#A'#''''0 NR %%%IJ %  %%N _e,X&Y _el _ _Y5)U#VYbiYYrar cPeZdZdZdZdedeeefddfdZ e dd d e ddfd Z y) raRepresents stat information as presented by git at the end of a merge. It is created from the output of a diff operation. Example:: c = Commit( sha1 ) s = c.stats s.total # full-stat-dict s.files # dict( filepath : stat-dict ) ``stat-dict`` A dictionary with the following keys and values:: deletions = number of deleted lines as int insertions = number of inserted lines as int lines = total number of lines changed as int, or deletions + insertions change_type = type of change as str, A|C|D|M|R|T|U|X|B ``full-stat-dict`` In addition to the items in the stat-dict, it features additional information:: files = number of changed files as int totalfilesrrrINc ||_||_yrr)rhrrs r[r9zStats.__init__s  rarlr:textcdddddid}|jD]}|jd\}}}}|dk7xr t|xsd} |dk7xr t|xsd} |ddxx| z cc<|ddxx| z cc<|dd xx| | zz cc<|dd xxd z cc<| | | | z|d } | |d |j<t |d|d S) zCreate a :class:`Stats` object from output retrieved by :manpage:`git-diff(1)`. :return: :class:`git.Stats` r) insertions deletionslinesrr -rrrrrrf)rrr change_type) splitlinesrrbrWr) rrlrhshr:rraw_insertions raw_deletionsfilenamerr files_dicts r[_list_from_stringzStats._list_from_strings%&AAN OO% 8DEIZZPTEU B[.-'3.F3~3FK!J%,C]1CHqI L &* 4 & L % 2 % L !Z)%; ; ! L !Q & !(&#i/* $J .8CL) * 8S\3w<00ra) rnr_r`rargrBr(r?r;r9rrrrrar[rrs[4#IhtHh4F/GD1V131711rarcXeZdZdZdZdeddfdZdedefdZ de fd Z de fd Z defd Z y) raWrapper around a file-like object that remembers the SHA1 of the data written to it. It will write a sha when the stream is closed or if asked for explicitly using :meth:`write_sha`. Only useful to the index file. :note: Based on the dulwich project. )rsha1rrINc2||_td|_y)Nra)rr!r)rhrs r[r9zIndexFileSHA1Writer.__init__sSM radatacn|jj||jj|Sr)rrLrr)rhrs r[rzIndexFileSHA1Writer.writes' vv||D!!racp|jj}|jj||Sr)rdigestrrrhshas r[ write_shazIndexFileSHA1Writer.write_shas)ii   S racZ|j}|jj|Sr)rrclosers r[rzIndexFileSHA1Writer.closes nn   rac6|jjSr)rtellr8s r[rzIndexFileSHA1Writer.tellsvv{{}ra)rnr_r`rargr*r9r%rbrr<rrrrrar[rrsXI"""""&"S"5 u crarc\eZdZdZdZdeddfdZd dZdefdZ de fd Z d d Z d d Z d d Zy)r aProvides methods to obtain, check for, and release a file based lock which should be used to handle concurrent access to the same file. As we are a utility class to be derived from, we only use protected methods. Locks will automatically be released on destruction.  _file_path _owns_lock file_pathrINc ||_d|_y)NFr)rhrs r[r9zLockFile.__init__s#rac$|jyr) _release_lockr8s r[__del__zLockFile.__del__s rac d|jzS)z:return: Path to lockfilez%s.lock)rr8s r[_lock_file_pathzLockFile._lock_file_pathsDOO,,rac|jS)z :return: True if we have a lock and if the lockfile still exists :raise AssertionError: If our lock-file does not exist. )rr8s r[ _has_lockzLockFile._has_locksracJ|jry|j}tj|rt d|j d|d t |d5 dddd|_ y#1swYxYw#t$r}t t||d}~wwxYw)zCreate a lock file as flag for other instances, mark our instance as lock-holder. :raise IOError: If a lock was already present or a lock file could not be written. NzLock for file z did already exist, delete z in case the lock is illegalw)modeT) rrrrIOErrorropenOSErrorrr)rh lock_filers r[_obtain_lock_or_raisezLockFile._obtain_lock_or_raise s >>  ((* ::i ??I/   )ic*       )#a&/q ( )s0 A?!A3#A?3A<8A?? B"BB"c"|jS)zThe default implementation will raise if a lock cannot be obtained. Subclasses may override this method to provide a different implementation. )rr8s r[ _obtain_lockzLockFile._obtain_lock"s ))++rac|jsy|j} t|d|_y#t$r Yd|_ywxYw)z Release our lock if we have one.NF)rrrrr)rhlfps r[rzLockFile._release_lock)sO~~ ""$  3K    s 6 A A r])rnr_r`rargr?r9rrrrrrrrrrar[r r sM-I ( t --40,  rar c ^eZdZdZdZdej fdedede ddffd Z d fd Z xZ S) r aThe lock file will block until a lock could be obtained, or fail after a specified timeout. :note: If the directory containing the lock was removed, an exception will be raised during the blocking period, preventing hangs as the lock can never be obtained. )_check_interval_max_block_timeg333333?rcheck_interval_smax_block_time_srINc@t||||_||_y)aConfigure the instance. :param check_interval_s: Period of time to sleep until the lock is checked the next time. By default, it waits a nearly unlimited time. :param max_block_time_s: Maximum amount of seconds we may lock. N)rpr9rr)rhrrrrqs r[r9zBlockingLockFile.__init__Cs" #//ractj}|t|jz} t|y#t $r}tj}t jt j|js$d|j||z fz}t ||||k\r$d||z |jfz}t ||tj|jYd}~nd}~wwxYw)zThis method blocks until it obtained the lock, or raises :exc:`IOError` if it ran out of time or if the parent directory was not available anymore. If this method returns, you are guaranteed to own the lock. zVDirectory containing the lockfile %r was not readable anymore after waiting %g secondsz Waited %g seconds for lock at %rN) timerMrrprrrrrrsleepr)rh starttimemaxtimercurtimemsgrqs r[rzBlockingLockFile._obtain_lockVs IIK eD$8$899 $&,+ 1))+yyT-A-A-C!DEr,,.)+vC"#,A-g%<)+,,.@C"#,A- 4//00' 1s? DB6DDr]) rnr_r`rargr^maxsizer?rMrbr9rrsrts@r[r r 8sP7I #& # 00 0 0  0&  rar ceZdZdZdZddededdffd Zddededdfd Zd ede fd Z d ede fd Z d e eeeefde fdZd e eeeefddfdZxZS)r aList of iterable objects allowing to query an object by id or by named index:: heads = repo.heads heads.master heads['master'] heads[0] Iterable parent objects: * :class:`Commit ` * :class:`Submodule ` * :class:`Reference ` * :class:`FetchInfo ` * :class:`PushInfo ` Iterable via inheritance: * :class:`Head ` * :class:`TagReference ` * :class:`RemoteReference ` This requires an ``id_attribute`` name to be set which will be queried from its contained items to have a means for comparison. A prefix can be specified which is to be used in case the id returned by the items always contains a prefix that does not matter to the user, so it can be left out. _id_attr_prefixid_attrprefixrIzIterableList[T_IterableObj]c"t||Sr)rp__new__)rrrrqs r[rzIterableList.__new__sws##raNc ||_||_yrr)rhrrs r[r9zIterableList.__init__s  rarc tj||}|r|S t |t t |y#ttf$rY-wxYw#ttf$rYywxYw)NTF)list __contains__AttributeError TypeErrorrr4r)rhrrvals r[rzIterableList.__contains__so $$T40D   D$sD/ * *    *  s 9AA  A A A c|j|z}|D]}t||j|k(s|cStj ||Sr)rrrr__getattribute__)rhritems r[ __getattr__zIterableList.__getattr__sL||d" DtT]]+t3  $$T400rar-ct|trtj||St|tr t d t ||S#t$r!}td|j|zz|d}~wwxYw)NzIndex should be an int or strzNo item found with id %r) r!rbr __getitem__slicer+rr IndexErrorr)rhr-rs r[r zIterableList.__getitem__sw eS !##D%0 0 u %<= = ]tU++! ] !;t||e?S!TU[\\ ]s A A9A44A9ctt|}t|tsTd}|j|z}t |D]"\}}t ||j |k(s |}n|dk(rtd|ztj||y)NzItem with name %s not found) r4rbr!rr'rrrr __delitem__)rhr-delindexrGir s r[rzIterableList.__delitem__sU#%%H<<%'D$T? 44/47 H  2~ !>!EFF x(ra)rK)rnr_r`rargrrr9objectrrrDr r3rArbrr rrsrts@r[r r zs8(I$c$3$8U$S$D$11 1 ]}c5#'E!F ]= ])}c5#'E!F)4)rar c zeZdZUdZdZeed<eeddde de de e fd Z eddde de de e fd Zy ) r aDefines an interface for iterable items, so there is a uniform way to retrieve and iterate items within the git repository. Subclasses: * :class:`Submodule ` * :class:`Commit ` * :class:`Reference ` * :class:`PushInfo ` * :class:`FetchInfo ` * :class:`Remote ` r_id_attribute_rlr:rirjrIctd)aSFind (all) items of this type. Subclasses can specify `args` and `kwargs` differently, and may use them for filtering. However, when the method is called with no additional positional or keyword arguments, subclasses are obliged to to yield all items. :return: Iterator yielding Items To be implemented by SubclassNotImplementedErrorrrlrirjs r[ iter_itemszIterableObj.iter_itemss""ABBraczt|j}|j|j|g|i||S)aFind (all) items of this type and collect them into a list. For more information about the arguments, see :meth:`iter_items`. :note: Favor the :meth:`iter_items` method as it will avoid eagerly collecting all items. When there are many items, that can slow performance and increase memory usage. :return: list(Item,...) list of item instances r rextendrrrlrirjout_lists r[ list_itemszIterableObj.list_itemss:".c.@.@!At=d=f=>raN)rnr_r`rargrrcrrr$r+rDrr r#rrar[r r s I Cf CS CC CH]D[ C CfSCLQ^D_rar c(eZdZdZdedededdfdZy)IterableClassWatcherzbMetaclass that issues :exc:`DeprecationWarning` when :class:`git.util.Iterable` is subclassed.rGbasesclsdictrINcv|D]4}t|tustjd|dtd6y)Nz!GitPython Iterable subclassed by zq. Iterable is deprecated due to naming clash since v3.1.18 and will be removed in 4.0.0. Use IterableObj instead.) stacklevel)typer%warningswarnDeprecationWarning)rrGr&r'bases r[r9zIterableClassWatcher.__init__sC DDz11 7v>00'  ra)rnr_r`rarr0r(r9rrar[r%r% s( C    rar%c \eZdZdZdZdZedddededefd Zedddededefd Z y ) IterablezDeprecated, use :class:`IterableObj` instead. Defines an interface for iterable items, so there is a uniform way to retrieve and iterate items within the git repository. rz5attribute that most suitably identifies your instancerlr:rirjrIctd)zDeprecated, use :class:`IterableObj` instead. Find (all) items of this type. See :meth:`IterableObj.iter_items` for details on usage. :return: Iterator yielding Items rrrs r[rzIterable.iter_items)s""ABBraczt|j}|j|j|g|i||S)aDeprecated, use :class:`IterableObj` instead. Find (all) items of this type and collect them into a list. See :meth:`IterableObj.list_items` for details on usage. :return: list(Item,...) list of item instances rr!s r[r#zIterable.list_items6s:%S%7%78t=d=f=>raN) rnr_r`rargrrr$rr#rrar[r1r1sw ILN Cf CS CC CC C C f S C C  rar1) metaclass)i)Fr).)T)r^__all__r_rabcr contextlib functoolsrrloggingrRos.pathr{rrrhrrrr urllib.parserrr, gitdb.utilrrrrrr r!r"r#typingr$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5git.cmdr6 git.configr7r8 git.remoter9 git.repo.baser: git.typesr;r<r=r>r?r@rArBrCrD getLoggerrnrUrrr\r`rrbrcrcontextmanagerrvrzrrrbrrrrrrrrrrriIrrcrrrrr r rrrrr/rrr rrr r r r r+r%r1rrar[rFs   *<<7 NN+,   -   *=!"   u5V/Wcgh  '  H %t4 ES E4 ED E //JDQ/0LdS CLhsAv&8CF+;$   i$(<=    )C ) ) 2B(C ) )--d-BdxSZ]$xH$<<7'X'(''8'',N8*N,,h,8,(Td&Xc]#c#(!3#tCy#L$hsm$3$3$.  @A f  RZZ)*Z%@RZZ!"Z%8RZZ bdd#&ADIRZZ/E: E%gclHd:;S@A ##$2::?@#H##/1$sHTN*+034: >$>75>> > 8(8t8 83%h"73D3:S: 5!1!13F!FGSV[_ >4>d>T> > 8$  5x( t xPXGY  $s)Du u p(^((}Y}Y@=1=1@  FK K \>x>D[)4 &[)|1(11h4"%-%ra