yL iUdZddgZddlZddlZddlZddlmZddlZddl m Z m Z ddl Z ddl Z ddlmZddlZddlZddlmZmZddlmZdd lmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$dd l%m&Z&m'Z'm(Z(m)Z)m*Z*e r dd l m+Z+dd l,m-Z-e"d dZ.e"de/e0e1e2e3Z4ejjdddkr ddl6m7Z7e7Z8nddlm7Z7e7e/ee4fZ8e jre:Z;dZeZdZdZdededeeefddffd ZxZ S)MetaParserBuilderz_Utility class wrapping base-class methods into decorators that assure read-only properties.namebasesclsdictreturncd}||vre||}|D][}dtj|tjD}|D])\}} ||vr t| } ||vr t | } | ||<+]t |||||} | S)zEquip all base-class methods with a needs_values decorator, and all non-const methods with a :func:`set_dirty_and_flush_changes` decorator in addition to that. _mutating_methods_c3JK|]}|djdr|yw)r_N startswith).0ts P/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/git/config.py z,MetaParserBuilder.__new__..Ys%nYZ[\Y]YhYhilYm1ns##)inspect getmembers isroutine needs_valuesset_dirty_and_flush_changessuper__new__) clsr,r-r.kmmmutating_methodsbasemethods method_namemethodmethod_with_valuesnew_type __class__s r8r@zMetaParserBuilder.__new__Ps # '>&s|  >ng&8&8w?P?P&Qn+2>'K"g- )5f)=&"&66-HI[-\*,>GK(> >7?3eW=) __name__ __module__ __qualname____doc__strrrr r@ __classcell__rJs@r8r+r+Ls73utCH~J]rKr+func.r/c Xtdddtdtdtffd }|S)zYReturn a method for ensuring we read values (on demand) before we try to access them.selfrargskwargsr/c<|j|g|i|SN)read)rUrVrWrSs r8assure_data_presentz)needs_values..assure_data_presentos! D*4*6**rK)rr r)rSr[s` r8r=r=ksA 4[+"3+C+3+SU++ rKnon_const_funcc^dddtdtdtffd }j|_|S)zReturn a method that checks whether given non constant function may be called. If so, the instance will be set dirty. Additionally, we flush the changes right to disk. rUrrVrWr/cN|g|i|}d|_|j|S)NT)_dirtywrite)rUrVrWrvalr\s r8 flush_changesz2set_dirty_and_flush_changes..flush_changess,d4T4V4   rK)r rrL)r\rbs` r8r>r>xs;-cSR,44M rKceZdZdZdZdZdededdfdZdd Z d ede ffd Z d ed e de de fdZ e defdZddZddZdedededdfdZxZS)ra'Constrains a ConfigParser to only option commands which are constrained to always use the section we have been initialized with. It supports all ConfigParser methods that operate on an option. :note: If used as a context manager, will release the wrapped ConfigParser. _config _section_name) get_value set_valuegetsetgetintgetfloat getboolean has_optionremove_section remove_optionoptionsconfigsectionr/Nc ||_||_yrYrd)rUrrrss r8__init__zSectionConstraint.__init__s $rKc8|jjyrYrereleaserUs r8__del__zSectionConstraint.__del__s rKattrcNjvrfdSt S)Nc0jg|i|SrY) _call_config)rVrWr{rUs r8z/SectionConstraint.__getattr__..s+<4+<+|jj|||yrY)re__exit__)rUrrrs r8rzSectionConstraint.__exit__s noyIrKr/N)r/z!SectionConstraint[T_ConfigParser])rLrMrNrO __slots__rrrPrurzr rr~propertyrrrxrrrQrRs@r8rrs-I M%~%%% ... R3RsRcRcR & JsJSJSJUYJrKc ,eZdZdZdededdffd Zdededdffd Zdede eddffd Z dedeffd Z dedeffd Z dededdffd Z dded eedfdeedfffd Zdede effd Zde eeeffdZde eee effdZxZS)_OMDzOrdered multi-dict.keyvaluer/Nc(t|||gyrYr? __setitem__rUrrrJs r8rz_OMD.__setitem__s C%)rKcn||vrt|||gyt| |j|yrY)r?r __getitem__appendrs r8addz_OMD.adds6 d? G eW -  C ''.rKvaluesc&t|||yrYr)rUrrrJs r8setallz _OMD.setalls C(rKc(t||dSNr?rrUrrJs r8rz_OMD.__getitem__w"3'++rKc(t||dSrrrs r8getlastz _OMD.getlastrrKcZ||vrt|||gyt| |}||d<yr)r?rr)rUrrpriorrJs r8setlastz _OMD.setlasts6 d? G eW - #C(b rKdefaultc,t|||gdSr)r?ri)rUrrrJs r8riz_OMD.getsw{3 *2..rKc"t||SrYrrs r8getallz _OMD.getallsw"3''rKc6|Dcgc] }|||f c}Scc}w)z"List of (key, last value for key).rUks r8itemsz _OMD.itemss&*+DG +++scN|Dcgc]}||j|fc}Scc}w)z&List of (key, list of values for key).)rrs r8 items_allz_OMD.items_alls#-12DKKN#222s"rY)rLrMrNrOrPrrr rrrrrrrrirrrrrQrRs@r8rrs*s*2*$*/s/3/4/)#)tBx)D),s,s,,3,3,3st/s/U2t8_/b$h/(#($r((,tE#r'N+,34c48m 453rKr config_levelc tjdk(r|dk(rd}|dk(ry|dk(rtjj dxs4t j tjj ddd }t jt jt j |d d S|dk(r(t jt jd S|d k(r tdt|td|y)Nwin32r%r'z/etc/gitconfigr&XDG_CONFIG_HOMEHOME~z.configgitrrz ~/.gitconfigr(zGNo repo to get repository configuration from. Use Repo._get_config_pathzInvalid configuration level: ) sysplatformosenvironriospjoinnormpath expanduser ValueErrorr)r config_homes r8get_config_pathrs ||w<8#; x  jjnn%67k388BJJNNSY[^D_aj;k ||CNN388K+QRSS  !||CNN>:;;  %bcc   6|6FG H rKceZdZdZeZ ejdZdZ eje Z eje dzdzZ [ dZ d5de ded ee ed ffd ed ed e edfd e dddf dZd6dZd6dZd7dZdeddfdZd6dZdedefdZde eeefdeddfdZde eeffdZ de!e"eeffdZ#d6dZ$deddfdZ%d ede!e"eefffd! Z&d ede!e"ee!effd"Z'e(d6d#Z)d$eddfd%Z*d&eddffd' Z+e,defd(Z- d8d&ed)ed*e ee.eedfde ee.eeffd+Z/ d8d&ed)ed*e ee.eedfde!e ee.eeffd,Z0d-ede ee.eeffd.Z1d/e eeee.efdefd0Z2e(e3d&ed)ed/e eeee.efddfd1Z4e(e3d&ed)ed/e eeee.efddfd2Z5d&ed3eddffd4 Z6xZ7S)9raImplements specifics required to read git style configuration files. This variation behaves much like the :manpage:`git-config(1)` command, such that the configuration will be read on demand based on the filepath given during initialization. The changes will automatically be written once the instance goes out of scope, but can be triggered manually as well. The configuration file will be locked if you intend to change values preventing other instances to write concurrently. :note: The config is case-sensitive even when queried, hence section and option names must match perfectly. :note: If used as a context manager, this will release the locked file. z^\s*[#;]z\s*(?P