fl ddlmZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z gdZ e ZdZdZGddeZGd d eZGd d eZGd deZGddeZGddeZGddeZGddeZGddeZGddeZGddeZeZGddZGdd eZ Gd!d"eZ!Gd#d$eZ"Gd%d&eZ#Gd'd(e#Z$Gd)d*e$Z%Gd+d,eZ&Gd-d.eZ'dS)/)MutableMapping)ChainMapN)NoSectionErrorDuplicateOptionErrorDuplicateSectionError NoOptionErrorInterpolationErrorInterpolationDepthErrorInterpolationMissingOptionErrorInterpolationSyntaxError ParsingErrorMissingSectionHeaderError ConfigParserSafeConfigParserRawConfigParser InterpolationBasicInterpolationExtendedInterpolationLegacyInterpolation SectionProxyConverterMapping DEFAULTSECTMAX_INTERPOLATION_DEPTHDEFAULT c"eZdZ ddZdZeZdS)ErrorcJ||_t||dSN)message Exception__init__)selfmsgs 3/opt/alt/python311/lib64/python3.11/configparser.pyr#zError.__init__s% 4%%%%%c|jSr )r!r$s r&__repr__zError.__repr__s |r'N)r)__name__ __module__ __qualname__r#r*__str__r'r&rrs;1&&&&GGGr'rceZdZ dZdS)rc`t|d|||_|f|_dS)Nz No section: )rr#sectionargsr$r2s r&r#zNoSectionError.__init__s1 tt:;;; K r'Nr+r,r-r#r/r'r&rrs&<     r'rceZdZ ddZdS)rNct|dg}|hdt|g}|(|d||d|||}n|ddt |d|||_||_ ||_ |||f|_ dS)N already existsWhile reading from  [line {0:2d}]z : section rzSection r) reprappendformatextendinsertrr#joinr2sourcelinenor3)r$r2rArBr%r!s r&r#zDuplicateSectionError.__init__sG}}/0  ,d6ll;G!/66v>>??? NN< ( ( ( NN3   CC JJq* % % % tRWWS\\***   ff- r'NNr5r/r'r&rrs-......r'rceZdZ ddZdS)rNct|dt|dg}|hdt|g}|(|d||d|||}n|ddt |d|||_||_ ||_ ||_ ||||f|_ dS) Nz in section r8r9r:z : option rzOption r) r;r<r=r>r?rr#r@r2optionrArBr3)r$r2rFrArBr%r!s r&r#zDuplicateOptionError.__init__sF||^T']] "  ,d6ll;G!/66v>>??? NN; ' ' ' NN3   CC JJq) $ $ $ tRWWS\\***    fff5 r'rCr5r/r'r&rrs- 666666r'rceZdZ dZdS)rcvt|d|d|||_||_||f|_dS)Nz No option z in section: rr#rFr2r3)r$rFr2s r&r#zNoOptionError.__init__sJ tt) * * *  W% r'Nr5r/r'r&rrs&+&&&&&r'rceZdZ dZdS)r clt||||_||_|||f|_dSr rI)r$rFr2r%s r&r#zInterpolationError.__init__s6 tS!!!  Wc* r'Nr5r/r'r&r r s&:+++++r'r ceZdZ dZdS)r cd||||}t||||||_||||f|_dS)NzBad value substitution: option {!r} in section {!r} contains an interpolation key {!r} which is not a valid option name. Raw value: {!r})r=r r# referencer3)r$rFr2rawvalrNr%s r&r#z(InterpolationMissingOptionError.__init__ sV!!'F!K!K  ##D&'3???"Wfi8 r'Nr5r/r'r&r r s&K99999r'r ceZdZdS)r N)r+r,r-r/r'r&r r sr'r ceZdZ dZdS)r cd||t|}t|||||||f|_dS)NzRecursion limit exceeded in value substitution: option {!r} in section {!r} contains an interpolation key which cannot be substituted in {} steps. Raw value: {!r})r=rr r#r3)r$rFr2rOr%s r&r#z InterpolationDepthError.__init__ sU&*A!! ##D&'3???Wf- r'Nr5r/r'r&r r s&:.....r'r cTeZdZ ddZedZejdZdZdS)r Nc|r|rtd|s|std|r|}t|d|z||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r) ValueErrorrr#rAerrorsr3)r$rAfilenames r&r#zParsingError.__init__-s   -.. . & DEE E  F tAFJKKK  J r'cJ tjdtd|jSNzNThe 'filename' attribute will be removed in Python 3.12. Use 'source' instead. stacklevelwarningswarnDeprecationWarningrAr)s r&rWzParsingError.filename<s2'  $ 1    {r'cN tjdtd||_dSrYr]r$values r&rWzParsingError.filenameFs5(  $ 1     r'ch|j||f|xjd||fzz c_dS)Nz [line %2d]: %s)rVr<r!)r$rBlines r&r<zParsingError.appendPs: FD>*** ,~== r'rC)r+r,r-r#propertyrWsetterr<r/r'r&r r *srH    X__>>>>>r'r ceZdZ dZdS)rct|d|||fz||_||_||_|||f|_dS)Nz7File contains no section headers. file: %r, line: %d %r)rr#rArBrer3)r$rWrBres r&r#z"MissingSectionHeaderError.__init__XsV   G vt $ % & & &   vt, r'Nr5r/r'r&rrUs&J-----r'rc(eZdZ dZdZdZdZdS)rc|Sr r/)r$parserr2rFrcdefaultss r& before_getzInterpolation.before_getl r'c|Sr r/r$rlr2rFrcs r& before_setzInterpolation.before_setoror'c|Sr r/rqs r& before_readzInterpolation.before_readrror'c|Sr r/rqs r& before_writezInterpolation.before_writeuror'N)r+r,r-rnrrrtrvr/r'r&rrisSLr'rcBeZdZ ejdZdZdZdZdS)rz %\(([^)]+)\)sc fg}|||||||dd|SNr_interpolate_somer@r$rlr2rFrcrmLs r&rnzBasicInterpolation.before_get7  vvq%(ANNNwwqzzr'c|dd}|jd|}d|vr'td||dfz|S)Nz%%r%1invalid interpolation syntax in %r at position %dreplace_KEYCREsubrUfindr$rlr2rFrc tmp_values r&rrzBasicInterpolation.before_setpMM$++ L$$R33 )  +.3Y^^C5H5H-IJKK K r'c |||d|}|tkrt||||r|d} | dkr||dS| dkr'||d| || d}|dd} | dkr |d|dd}n| dkr|j|} | t||d|z|| d} || d} || } n!#t$rt|||| dwxYwd| vr| |||| |||dzn*|| nt||d ||dSdS) NTrawfallbackrrrzrZ('bad interpolation variable reference %rz+'%' must be followed by '%' or '(', found: )getrr rr<rmatchr optionxformgroupendKeyErrorr r|)r$rlrFaccumrestr2mapdepthrOpcmvarvs r&r|z$BasicInterpolation._interpolate_somes/GVEE * * *)&'6BB B" + #A1uu T"""1uu T"1"X&&&ABBxQqS ACxx S!!!ABBxcL&&t,,9267ADHJJJ((44AEEGGHH~@CAA@@@966;?@@!88**665!+2CDDDDLLOOOO.GG#'4*+++?" +" +" +" +" +s E E*N r+r,r-recompilerrnrrr|r/r'r&rrys[ Ibj)**G '+'+'+'+'+r'rcBeZdZ ejdZdZdZdZdS)rz \$\{([^}]+)\}c fg}|||||||dd|Sryr{r}s r&rnz ExtendedInterpolation.before_getrr'c|dd}|jd|}d|vr'td||dfz|S)Nz$$r$rrrs r&rrz ExtendedInterpolation.before_setrr'c 6|||d|}|tkrt||||r`|d} | dkr||dS| dkr'||d| || d}|dd} | dkr!|d|dd}n| dkr|j|} | t||d|z| d d } || d}|} |} t| dkr$| | d}||}nct| dkr<| d} | | d}|| |d }nt||d |nA#tttf$r't!|||d | dwxYwd|vrA|||||| t'|| d |dzn*||nt||d ||^dSdS) NTrrrrzrZ{r:)rzMore than one ':' found: z+'$' must be followed by '$' or '{', found: )rrr rr<rrr rsplitrlenrrrrr r@r|dictitems)r$rlrFrrr2rrrOrrrpathsectoptrs r&r|z'ExtendedInterpolation._interpolate_somesGVEE * * *)&'6BB B/ + #A1uu T"""1uu T"1"X&&&ABBxQqS ACxx S!!!ABBxcL&&t,,9267ADHJJJwwqzz'',,AEEGGHH~K4yyA~~$00a99HTa#Aw$00a99"JJtSdJ;;6"GG=ATCEEE!.-@KKK9$AAFJKK!88**63q$+/ Tt 0L0L+M+M+0196666LLOOOO.GG#'4*+++Y/ +/ +/ +/ +/ +s BG$$>H"Nrr/r'r&rrsZ>bj)**G 4+4+4+4+4+r'rcbeZdZ ejdZfdZdZdZe dZ xZ S)rz%\(([^)]*)\)s|.crtj|i|tjdtddS)NzLegacyInterpolation has been deprecated since Python 3.2 and will be removed from the configparser module in Python 3.13. Use BasicInterpolation or ExtendedInterpolation instead.rZr[superr#r^r_r`r$r3kwargs __class__s r&r#zLegacyInterpolation.__init__sO$)&)))  G 1       r'c@|}t}|r{|dz}|rqd|vrmtj|j|}|j||} ||z}n1#t $r#} t|||| jddd} ~ wwxYwn|{|rd|vrt||||S)Nrzz%()rlr) r functoolspartial_interpolation_replacerrrr r3r ) r$rlr2rFrcvarsrOrres r&rnzLegacyInterpolation.before_gets'  QJE #+D,G39;;; ((%88F!DLEEFFF9<d'Z*d(Z+d)Z,d*Z-d+Z.d,Z/d-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7d7d7d8d9Z:e;d:Z<xZ=S)?rz \[ # [ (?P
.+) # very permissive! \] # ] a (?P