o w[eF)@sdZgdZddlZdZdZdZeeZdZedd Zd Z d Z eee eZ dd d Z ddl ZddlmZiZGdddZeGdddZdS)anA collection of string constants. Public module variables: whitespace -- a string containing all ASCII whitespace ascii_lowercase -- a string containing all ASCII lowercase letters ascii_uppercase -- a string containing all ASCII uppercase letters ascii_letters -- a string containing all ASCII letters digits -- a string containing all ASCII decimal digits hexdigits -- a string containing all ASCII hexadecimal digits octdigits -- a string containing all ASCII octal digits punctuation -- a string containing all ASCII punctuation characters printable -- a string containing all ASCII characters considered printable ) ascii_lettersascii_lowercaseascii_uppercasecapwordsdigits hexdigits octdigits printable punctuation whitespace FormatterTemplateNz abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789abcdefABCDEF01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pddd||DS)acapwords(s [,sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. If the optional second argument sep is absent or None, runs of whitespace characters are replaced by a single space and leading and trailing whitespace are removed, otherwise sep is used to split and join the words.  css|]}|VqdSN) capitalize).0xr/usr/lib/python3.10/string.py 0szcapwords..)joinsplit)sseprrrr%s r)ChainMapcsZeZdZdZdZdZdZejZ fddZ ddZ d d Z e fd d Ze fd dZZS)r z.A string class for supporting $-substitutions.$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)clsr"delimidbid __class__rrr$Es    zTemplate.__init_subclass__cCs ||_dSr)template)selfr4rrr__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)startr4 splitlineslenr ValueError)r5moilinescolnolinenorrr_invalid\s zTemplate._invalidc :tur|n|rt|fdd}j|jS)Ncs`|dp |d}|durt|S|ddurjS|ddur*|tdjNnamedbracedescapedr8z#Unrecognized named group in pattern)groupstrr(rFr@r"rArImappingr5rrconvertns  z$Template.substitute..convert_sentinel_dict _ChainMapr"subr4r5rPkwsrQrrOr substitutehs   zTemplate.substitutec rG)Ncs||dp |d}|dur#zt|WSty"|YSw|ddur-jS|ddur8|StdjrH)rLrMKeyErrorr(r@r"rNrOrrrQs  z)Template.safe_substitute..convertrRrVrrOrsafe_substitute{s   zTemplate.safe_substitute)__name__ __module__ __qualname____doc__r(r)r*r& IGNORECASEr,r$r6rFrSrXrZ __classcell__rrr2rr 9s  r c@sXeZdZddZddZ dddZdd Zd d Zd d ZddZ ddZ ddZ dS)r cOs||||Sr)vformat)r5 format_stringargskwargsrrrformatszFormatter.formatcCs.t}|||||d\}}|||||S)N)set_vformatcheck_unused_args)r5rbrcrd used_argsresult_rrrraszFormatter.vformatr c Cs|dkrtdg}||D]^\}} } } |r||| durm| dkr5|dur,tdt|} |d7}n | rA|r?tdd}|| ||\} } || || | } |j| ||||d|d\} }|| | | qd ||fS)Nr zMax string recursion exceededr;FzJcannot switch from manual field specification to automatic field numberingr:)auto_arg_index) r@parseappendrMisdigit get_fieldadd convert_fieldrh format_fieldr)r5rbrcrdrjrecursion_depthrmrk literal_text field_name format_spec conversionobjarg_usedrrrrhs8     zFormatter._vformatcCst|tr ||S||Sr) isinstanceint)r5keyrcrdrrr get_values zFormatter.get_valuecCsdSrr)r5rjrcrdrrrriszFormatter.check_unused_argscCs t||Sr)re)r5valuerxrrrrtr7zFormatter.format_fieldcCsJ|dur|S|dkrt|S|dkrt|S|dkrt|Std|)Nrraz"Unknown conversion specifier {0!s})rMreprasciir@re)r5rryrrrrsszFormatter.convert_fieldcCs t|Sr)_stringformatter_parser)r5rbrrrrnr7zFormatter.parsec CsJt|\}}||||}|D]\}}|rt||}q||}q||fSr)rformatter_field_name_splitrgetattr) r5rwrcrdfirstrestrzis_attrrBrrrrq s   zFormatter.get_fieldN)r ) r[r\r]rerarhrrirtrsrnrqrrrrr s 6 r r)r^__all__rr rrrrrrr rrrer& collectionsr rTrSr r$r rrrrs&   Y