o ?OgF)@s gdZddlZdZdZdZeeZdZeddZd Zd Z eee eZ dd d Z ddl Z dd lmZiZGdddZeGdddZdS)) ascii_lettersascii_lowercaseascii_uppercasecapwordsdigits hexdigits octdigits printable punctuation whitespace FormatterTemplateNz ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs |pddd||DS)N css|]}|VqdSN) capitalize).0xr-/opt/alt/python310/lib64/python3.10/string.py 0szcapwords..)joinsplit)sseprrrr%s r)ChainMapcsXeZdZ dZdZdZejZfddZ ddZ dd Z e fd d Z e fd d ZZS)r $z(?a:[_a-z][_a-z0-9]*)Nc srtd|jvr|j}nt|j}|j}|jp|j}d|d|d|d|d }t ||j tj B|_dS)Npatternz z(?: (?PzC) | # Escape sequence of two delimiters (?PzJ) | # delimiter and a Python identifier {(?Pz)} | # delimiter and a braced identifier (?P) # Other ill-formed delimiter exprs ) ) super__init_subclass____dict__r_reescape delimiter idpatternbraceidpatterncompileflagsVERBOSE)clsrZdelimidZbid __class__rrrEs    zTemplate.__init_subclass__cCs ||_dSr)template)selfr-rrr__init__W zTemplate.__init__cCs`|d}|jd|jdd}|sd}d}n|td|dd}t|}td||f)NinvalidT)keependsz.Invalid placeholder in string: line %d, col %d)startr- splitlineslenr ValueError)r.moilinescolnolinenorrr_invalid\s zTemplate._invalidc :tur|n|rt|fdd}j|jS)Ncs`|dp |d}|durt|S|ddurjS|ddur*|tdjNnamedZbracedZescapedr1z#Unrecognized named group in pattern)groupstrr#r?r9rr:rBmappingr.rrconvertns  z$Template.substitute..convert_sentinel_dict _ChainMaprsubr-r.rGZkwsrHrrFr substitutehs   zTemplate.substitutec r@)Ncs||dp |d}|dur#zt|WSty"|YSw|ddur-jS|ddur8|StdjrA)rCrDKeyErrorr#r9rrErFrrrHs  z)Template.safe_substitute..convertrIrMrrFrsafe_substitute{s   zTemplate.safe_substitute)__name__ __module__ __qualname__r#r$r%r! IGNORECASEr'rr/r?rJrNrP __classcell__rrr+rr 9s  r c@sXeZdZddZddZ dddZdd Zd d Zd d ZddZ ddZ ddZ dS)r cOs||||Sr)vformat)r. format_stringargskwargsrrrformatszFormatter.formatcCs.t}|||||d\}}|||||S)N)set_vformatcheck_unused_args)r.rWrXrY used_argsresult_rrrrVszFormatter.vformatr c Cs|dkrtdg}||D]^\}} } } |r||| durm| dkr5|dur,tdt|} |d7}n | rA|r?tdd}|| ||\} } || || | } |j| ||||d|d\} }|| | | qd ||fS)Nr zMax string recursion exceededr4FzJcannot switch from manual field specification to automatic field numberingr3)auto_arg_index) r9parseappendrDisdigit get_fieldadd convert_fieldr] format_fieldr)r.rWrXrYr_Zrecursion_depthrbr`Z literal_text field_name format_spec conversionobjZarg_usedrrrr]s8     zFormatter._vformatcCst|tr ||S||Sr) isinstanceint)r.keyrXrYrrr get_values zFormatter.get_valuecCsdSrr)r.r_rXrYrrrr^szFormatter.check_unused_argscCs t||Sr)rZ)r.valuerkrrrrir0zFormatter.format_fieldcCsJ|dur|S|dkrt|S|dkrt|S|dkrt|Std|)Nrraz"Unknown conversion specifier {0!s})rDreprasciir9rZ)r.rrrlrrrrhszFormatter.convert_fieldcCs t|Sr)_stringZformatter_parser)r.rWrrrrcr0zFormatter.parsec CsJt|\}}||||}|D]\}}|rt||}q||}q||fSr)rwZformatter_field_name_splitrqgetattr) r.rjrXrYfirstrestrmZis_attrr;rrrrf s   zFormatter.get_fieldN)r ) rQrRrSrZrVr]rqr^rirhrcrfrrrrr s 6 r r)__all__rwr rrrrrrr rrrer! collectionsrrKrJr rr rrrrs&   Y