U e5df@sddlmZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z dddddd d d d d dddddddddddgZ e ZdZdZGdddeZGdddeZGdddeZGdddeZGd ddeZGd!ddeZGd"d d eZGd#d d eZGd$d d eZGd%d d eZGd&d d eZeZGd'ddZGd(ddeZ Gd)ddeZ!Gd*ddeZ"Gd+ddeZ#Gd,dde#Z$Gd-dde$Z%Gd.ddeZ&Gd/ddeZ'dS)0)MutableMapping)ChainMapNNoSectionErrorDuplicateOptionErrorDuplicateSectionError NoOptionErrorInterpolationErrorInterpolationDepthErrorInterpolationMissingOptionErrorInterpolationSyntaxError ParsingErrorMissingSectionHeaderError ConfigParserSafeConfigParserRawConfigParser InterpolationBasicInterpolationExtendedInterpolationLegacyInterpolation SectionProxyConverterMapping DEFAULTSECTMAX_INTERPOLATION_DEPTHZDEFAULT c@s"eZdZdddZddZeZdS)ErrorcCs||_t||dSN)message Exception__init__)selfmsgr"$/usr/lib64/python3.8/configparser.pyrszError.__init__cCs|jSr)rr r"r"r#__repr__szError.__repr__N)r)__name__ __module__ __qualname__rr%__str__r"r"r"r#rs rc@seZdZddZdS)rcCs$t|d|f||_|f|_dS)NzNo section: %r)rrsectionargsr r*r"r"r#rszNoSectionError.__init__Nr&r'r(rr"r"r"r#rsc@seZdZdddZdS)rNcCst|dg}|dk rRdt|g}|dk r8|d||d|||}n |ddt|d|||_||_ ||_ |||f|_ dS)N already existsWhile reading from  [line {0:2d}]z : section rzSection r) reprappendformatextendinsertrrjoinr*sourcelinenor+)r r*r7r8r!rr"r"r#rs     zDuplicateSectionError.__init__)NNr-r"r"r"r#rsc@seZdZdddZdS)rNcCst|dt|dg}|dk rZdt|g}|dk r@|d||d|||}n |ddt|d|||_||_ ||_ ||_ ||||f|_ dS) Nz in section r.r/r0z : option rzOption r) r1r2r3r4r5rrr6r*optionr7r8r+)r r*r9r7r8r!rr"r"r#rs"    zDuplicateOptionError.__init__)NNr-r"r"r"r#rsc@seZdZddZdS)rcCs.t|d||f||_||_||f|_dS)NzNo option %r in section: %rrrr9r*r+)r r9r*r"r"r#rs zNoOptionError.__init__Nr-r"r"r"r#rsc@seZdZddZdS)rcCs(t||||_||_|||f|_dSrr:)r r9r*r!r"r"r#rs zInterpolationError.__init__Nr-r"r"r"r#rsc@seZdZddZdS)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})r3rr referencer+)r r9r*rawvalr;r!r"r"r#r sz(InterpolationMissingOptionError.__init__Nr-r"r"r"r#r sc@s eZdZdS)r N)r&r'r(r"r"r"r#r sc@seZdZddZdS)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})r3rrrr+)r r9r*r<r!r"r"r#rsz InterpolationDepthError.__init__Nr-r"r"r"r#r sc@s8eZdZd ddZeddZejddZddZdS) r NcCsT|r|rtdn|s$|s$tdn|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) ValueErrorrrr7errorsr+)r r7filenamer"r"r#r,s  zParsingError.__init__cCstjdtdd|jSNzSThe 'filename' attribute will be removed in future versions. Use 'source' instead. stacklevelwarningswarnDeprecationWarningr7r$r"r"r#r?;s zParsingError.filenamecCstjdtdd||_dSr@rDr valuer"r"r#r?Es cCs*|j||f|jd||f7_dS)Nz [line %2d]: %s)r>r2r)r r8liner"r"r#r2OszParsingError.append)NN)r&r'r(rpropertyr?setterr2r"r"r"r#r )s    c@seZdZddZdS)r cCs8t|d|||f||_||_||_|||f|_dS)Nz7File contains no section headers. file: %r, line: %d %r)rrr7r8rJr+)r r?r8rJr"r"r#rWsz"MissingSectionHeaderError.__init__Nr-r"r"r"r#r Tsc@s,eZdZddZddZddZddZd S) rcCs|Srr")r parserr*r9rIdefaultsr"r"r# before_getkszInterpolation.before_getcCs|Srr"r rMr*r9rIr"r"r# before_setnszInterpolation.before_setcCs|Srr"rPr"r"r# before_readqszInterpolation.before_readcCs|Srr"rPr"r"r# before_writetszInterpolation.before_writeN)r&r'r(rOrQrRrSr"r"r"r#rhsc@s.eZdZedZddZddZddZdS) rz %\(([^)]+)\)sc Cs$g}|||||||dd|SNr_interpolate_somer6r rMr*r9rIrNLr"r"r#rOszBasicInterpolation.before_getcCs<|dd}|jd|}d|kr8td||df|S)Nz%%r%1invalid interpolation syntax in %r at position %dreplace_KEYCREsubr=findr rMr*r9rIZ tmp_valuer"r"r#rQs  zBasicInterpolation.before_setc Csj|j||d|d}|tkr&t||||rf|d} | dkrL||dS| dkrr||d| || d}|dd} | dkr|d|dd}q&| dkrR|j|} | dkrt||d||| d} || d}z || } Wn&t k rt |||| dYnXd| krF| |||| |||dn || q&t||d |fq&dS) NTrawfallbackrZrrUrA('bad interpolation variable reference %rz/'%%' must be followed by '%%' or '(', found: %r)getrr r`r2r^matchr optionxformgroupendKeyErrorr rW)r rMr9accumrestr*mapdepthr<pcmvarvr"r"r#rWs`            z$BasicInterpolation._interpolate_someN r&r'r(recompiler^rOrQrWr"r"r"r#rxs c@s.eZdZedZddZddZddZdS) rz \$\{([^}]+)\}c Cs$g}|||||||dd|SrTrVrXr"r"r#rOsz ExtendedInterpolation.before_getcCs<|dd}|jd|}d|kr8td||df|S)Nz$$r$r[r\rar"r"r#rQs  z ExtendedInterpolation.before_setc Cs|j||d|d}|tkr&t||||r|d} | dkrL||dS| dkrr||d| || d}|dd} | dkr|d|dd}q&| dkr|j|} | dkrt||d|| d d } || d}|} |}zrt | dkr| | d}||}nHt | dkrR| d} | | d}|j| |dd }nt||d |fWn2t ttfk rt|||d | dYnXd|kr|||||| t|j| dd |dn ||q&t||d |fq&dS) NTrbryrrUrA{rf:)rczMore than one ':' found: %rz-'$' must be followed by '$' or '{', found: %r)rgrr r`r2r^rhr rjsplitrklenrirlrrr r6rWdictitems)r rMr9rmrnr*rorpr<rqrrrspathZsectoptrur"r"r#rWsx           z'ExtendedInterpolation._interpolate_someNrvr"r"r"r#rs c@s2eZdZedZddZddZeddZ dS) rz%\(([^)]*)\)s|.c Cs|}t}|r|d8}|rd|krtj|j|d}|j||}z ||}Wqtk r} zt|||| jddW5d} ~ XYqXqqq|rd|krt ||||S)NrUz%()rMr) r functoolspartial_interpolation_replacer^r_rlr r+r ) r rMr*r9rIvarsr<rpr]er"r"r#rOs0    zLegacyInterpolation.before_getcCs|Srr"rPr"r"r#rQ$szLegacyInterpolation.before_setcCs,|d}|dkr|Sd||SdS)NrUz%%(%s)s)rjri)rhrMsr"r"r#r's z*LegacyInterpolation._interpolation_replaceN) r&r'r(rwrxr^rOrQ staticmethodrr"r"r"r#r s  c s2eZdZdZdZdZeZe eej Z e ej ddej Z e ej ddej Ze dZddddddddd Zd edfd d d ddeeed ddZddZddZddZddZddZdcddZddddZdedd Zdfd"d#Zdgd$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(dhd;d<Z)did=d>Z*d?d@Z+dAdBZ,dCdDZ-dEdFZ.dGdHZ/dIdJZ0dKdLZ1dMdNZ2dOdPZ3dQdRZ4dSdTZ5dUdVZ6dWdXZ7dYdZZ8d[d\Z9d]d]d]d^d_d`Z:e;dadbZ<Z=S)jrz \[ # [ (?P
[^]]+) # very permissive! \] # ] a (?P