o ?OgT@s ddlmZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z gdZ e ZdZdZGdddeZGd d d eZGd d d eZGd ddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZeZGdddZGdd d eZ Gd!d"d"eZ!Gd#d$d$eZ"Gd%d&d&eZ#Gd'd(d(e#Z$Gd)d*d*e$Z%Gd+d,d,eZ&Gd-d.d.eZ'dS)/)MutableMapping)ChainMapN)NoSectionErrorDuplicateOptionErrorDuplicateSectionError NoOptionErrorInterpolationErrorInterpolationDepthErrorInterpolationMissingOptionErrorInterpolationSyntaxError ParsingErrorMissingSectionHeaderError ConfigParserSafeConfigParserRawConfigParser InterpolationBasicInterpolationExtendedInterpolationLegacyInterpolation SectionProxyConverterMapping DEFAULTSECTMAX_INTERPOLATION_DEPTHZDEFAULT c@s$eZdZ dddZddZeZdS)ErrorcCs||_t||dSN)message Exception__init__)selfmsgr"3/opt/alt/python310/lib64/python3.10/configparser.pyrszError.__init__cC|jSr)rr r"r"r#__repr__zError.__repr__N)r)__name__ __module__ __qualname__rr&__str__r"r"r"r#rs  rc@eZdZ ddZdS)rcCs$t|d|f||_|f|_dS)NzNo section: %r)rrsectionargsr r-r"r"r#rs zNoSectionError.__init__Nr(r)r*rr"r"r"r#r rc@eZdZ dddZdS)rNcCst|dg}|dur)dt|g}|dur|d||d|||}n|ddt|d|||_||_ ||_ |||f|_ dS)N already existsWhile reading from  [line {0:2d}]z : section rzSection r) reprappendformatextendinsertrrjoinr-sourcelinenor.)r r-r<r=r!rr"r"r#rs     zDuplicateSectionError.__init__NNr0r"r"r"r#rsrc@r2)rNcCst|dt|dg}|dur-dt|g}|dur |d||d|||}n|ddt|d|||_||_ ||_ ||_ ||||f|_ dS) Nz in section r3r4r5z : option rzOption r) r6r7r8r9r:rrr;r-optionr<r=r.)r r-r?r<r=r!rr"r"r#rs"    zDuplicateOptionError.__init__r>r0r"r"r"r#rsrc@r,)rcCs.t|d||f||_||_||f|_dS)NzNo option %r in section: %rrrr?r-r.)r r?r-r"r"r#rs zNoOptionError.__init__Nr0r"r"r"r#rr1rc@r,)rcCs(t||||_||_|||f|_dSrr@)r r?r-r!r"r"r#rs zInterpolationError.__init__Nr0r"r"r"r#rr1rc@r,)r cCs8d||||}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})r8rr referencer.)r r?r-rawvalrAr!r"r"r#r s  z(InterpolationMissingOptionError.__init__Nr0r"r"r"r#r r1r c@s eZdZdS)r N)r(r)r*r"r"r"r#r sr c@r,)r cCs0d||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})r8rrrr.)r r?r-rBr!r"r"r#r sz InterpolationDepthError.__init__Nr0r"r"r"r#r r1r c@s:eZdZ d ddZeddZejddZddZdS) r NcCsP|r|rtd|s|std|r|}t|d|||_g|_|f|_dS)Nz:Cannot specify both `filename' and `source'. Use `source'.z%Required argument `source' not given.z"Source contains parsing errors: %r) ValueErrorrrr<errorsr.)r r<filenamer"r"r#r-s zParsingError.__init__cCs tjdtdd|jSNzNThe 'filename' attribute will be removed in Python 3.12. Use 'source' instead. stacklevelwarningswarnDeprecationWarningr<r%r"r"r#rE<s zParsingError.filenamecCs tjdtdd||_dSrFrJr valuer"r"r#rEFs  cCs*|j||f|jd||f7_dS)Nz [line %2d]: %s)rDr7r)r r=liner"r"r#r7PszParsingError.appendr>)r(r)r*rpropertyrEsetterr7r"r"r"r#r *s    r c@r,)r cCs8t|d|||f||_||_||_|||f|_dS)Nz7File contains no section headers. file: %r, line: %d %r)rrr<r=rPr.)r rEr=rPr"r"r#rXsz"MissingSectionHeaderError.__init__Nr0r"r"r"r#r Ur1r c@s.eZdZ ddZddZddZddZd S) rcC|Srr")r parserr-r?rOdefaultsr"r"r# before_getlzInterpolation.before_getcCrSrr"r rTr-r?rOr"r"r# before_setorWzInterpolation.before_setcCrSrr"rXr"r"r# before_readrrWzInterpolation.before_readcCrSrr"rXr"r"r# before_writeurWzInterpolation.before_writeN)r(r)r*rVrYrZr[r"r"r"r#ris  rc@0eZdZ edZddZddZddZdS) rz %\(([^)]+)\)sc C$g}|||||||dd|SNr_interpolate_somer;r rTr-r?rOrULr"r"r#rV zBasicInterpolation.before_getcC<|dd}|jd|}d|vrtd||df|S)Nz%%r%1invalid interpolation syntax in %r at position %dreplace_KEYCREsubrCfindr rTr-r?rOZ tmp_valuer"r"r#rY  zBasicInterpolation.before_setc Csb|j||d|d}|tkrt||||r|d} | dkr%||dS| dkr8||d| || d}|dd} | dkrN|d|dd}n]| dkr|j|} | durdt||d||| d} || d}z|| } Wnt yt |||| dwd| vr| |||| |||dn|| n t||d |f|sdSdS) NTrawfallbackrfrr_rG('bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)getrr rlr7rjmatchr optionxformgroupendKeyErrorr ra)r rTr?accumrestr-mapdepthrBpcmvarvr"r"r#rasX             z$BasicInterpolation._interpolate_someN r(r)r*recompilerjrVrYrar"r"r"r#rys   rc@r\) rz \$\{([^}]+)\}c Cr]r^r`rbr"r"r#rVrdz ExtendedInterpolation.before_getcCre)Nz$$r$rgrhrmr"r"r#rYrnz ExtendedInterpolation.before_setc Cs|j||d|d}|tkrt||||r|d} | dkr%||dS| dkr8||d| || d}|dd} | dkrN|d|dd}n| dkr|j|} | durdt||d|| d d } || d}|} |}z7t | dkr| | d}||}n#t | dkr| d} | | d}|j| |dd }n t||d |fWnt ttfyt|||d | dwd|vr|||||| t|j| dd |dn||n t||d |f|sdSdS) NTrorrr_rG{rs:)rpzMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rtrr rlr7rjrur rwsplitrxlenrvryrrr r;radictitems)r rTr?rzr{r-r|r}rBr~rrpathZsectoptrr"r"r#rast            z'ExtendedInterpolation._interpolate_someNrr"r"r"r#rs   rc@s4eZdZ edZddZddZeddZ dS) rz%\(([^)]*)\)s|.c Cs|}t}|r@|d8}|r=d|vr=tj|j|d}|j||}z||}Wnty<} z t|||| jddd} ~ wwn|s|rLd|vrLt ||||S)Nr_z%()rTr) r functoolspartial_interpolation_replacerjrkryr r.r ) r rTr-r?rOvarsrBr}rier"r"r#rVs0   zLegacyInterpolation.before_getcCrSrr"rXr"r"r#rY%rWzLegacyInterpolation.before_setcCs(|d}|dur |Sd||S)Nr_z%%(%s)s)rwrv)rurTsr"r"r#r(s z*LegacyInterpolation._interpolation_replaceN) r(r)r*rrrjrVrY staticmethodrr"r"r"r#r s rc s4eZdZ dZdZdZeZe eej Z e ej ddej Z e ej ddej Ze dZddddddddd Zd edfd d d ddeeed ddZddZddZddZddZddZdcddZdcddZdddd Zded"d#Zdcd$d%Zdd ed&d'd(Zd)d*Z dd ed&d+d,Z!dd ed&d-d.Z"dd ed&d/d0Z#dd ed&d1d2Z$edd ffd3d4 Z%d5d6Z&d7d8Z'd9d:Z(dcd;d<Z)dfd=d>Z*d?d@Z+dAdBZ,dCdDZ-dEdFZ.dGdHZ/dIdJZ0dKdLZ1dMdNZ2dOdPZ3dQdRZ4dSdTZ5dUdVZ6dWdXZ7dYdZZ8d[d\Z9d]d]d]d^d_d`Z:e;dadbZ<Z=S)grz \[ # [ (?P
.+) # very permissive! \] # ] a (?P