grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î ¤ fµ,ã@sÑdZddlZdZdZdZeeZdZeddZd Zd Z eee eZ dd d „Z ddl Z dd lmZGdd„deƒZGdd„ddeƒZGdd„dƒZdS)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 éNz ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZÚ 0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs)|p djdd„|j|ƒDƒƒS)a‘capwords(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|]}|jƒVqdS)N)Ú capitalize)Ú.0Úx©rú+/opt/alt/python34/lib64/python3.4/string.pyú ,szcapwords..)ÚjoinÚsplit)ÚsÚseprrrÚcapwords!s r)ÚChainMapcs(eZdZdZ‡fdd†Z‡S)Ú_TemplateMetaclassa/ %(delim)s(?: (?P%(delim)s) | # Escape sequence of two delimiters (?P%(id)s) | # delimiter and a Python identifier {(?P%(id)s)} | # delimiter and a braced identifier (?P) # Other ill-formed delimiter exprs ) cs�tt|ƒj|||ƒd|kr4|j}n*tjitj|jƒd6|jd6}tj||j tj Bƒ|_dS)NÚpatternZdelimÚid) ÚsuperrÚ__init__rÚ_reÚescapeÚ delimiterÚ idpatternÚcompileÚflagsÚVERBOSE)ÚclsÚnameÚbasesZdctr)Ú __class__rrr=s   z_TemplateMetaclass.__init__)Ú__name__Ú __module__Ú __qualname__rrrr)rrr3s rc@s[eZdZdZdZdZejZdd„Z dd„Z dd „Z d d „Z d S) ÚTemplatez.A string class for supporting $-substitutions.ú$z[_a-z][_a-z0-9]*cCs ||_dS)N)Útemplate)Úselfr%rrrrPszTemplate.__init__cCsŒ|jdƒ}|jd|…jddƒ}|sCd}d}n/|tdj|dd…ƒƒ}t|ƒ}td||fƒ‚dS)NÚinvalidÚkeependsTéÚz.Invalid placeholder in string: line %d, col %déÿÿÿÿ)Ústartr%Ú splitlinesÚlenr Ú ValueError)r&ÚmoÚiÚlinesZcolnoÚlinenorrrÚ_invalidUs # zTemplate._invalidcs¢|stdƒ‚n|^‰}t|ƒdkrBtdƒ‚n|sQ|‰n&|rmt||dƒ‰n |d‰‡‡fdd†}ˆjj|ˆjƒS)Nz>descriptor 'substitute' of 'Template' object needs an argumentr)zToo many positional argumentsrcs–|jdƒp|jdƒ}|dk r?ˆ|}d|fS|jdƒdk r[ˆjS|jdƒdk r€ˆj|ƒntdˆjƒ‚dS)NÚnamedÚbracedz%sÚescapedr'z#Unrecognized named group in pattern)Úgrouprr4r/r)r0r5Úval)Úmappingr&rrÚconvertos   z$Template.substitute..convert)Ú TypeErrorr.rrÚsubr%)ÚargsÚkwsr;r)r:r&rÚ substituteas   zTemplate.substitutecs¢|stdƒ‚n|^‰}t|ƒdkrBtdƒ‚n|sQ|‰n&|rmt||dƒ‰n |d‰‡‡fdd†}ˆjj|ˆjƒS)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr)zToo many positional argumentsrc s°|jdƒp|jdƒ}|dk r_ydˆ|fSWq_tk r[|jƒSYq_Xn|jdƒdk r{ˆjS|jdƒdk rš|jƒStdˆjƒ‚dS)Nr5r6z%sr7r'z#Unrecognized named group in pattern)r8ÚKeyErrorrr/r)r0r5)r:r&rrr;�s   z)Template.safe_substitute..convert)r<r.rrr=r%)r>r?r;r)r:r&rÚsafe_substitutes   zTemplate.safe_substituteN) r r!r"Ú__doc__rrrÚ IGNORECASErrr4r@rBrrrrr#Is    r#Ú metaclassc@seZdZdd„Zdd„Zddd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dS)Ú Formatterc Os†|stdƒ‚n|^}}y|^}}Wn?tk rrd|kr_|jdƒ}ntdƒd‚YnX|j|||ƒS)Nz;descriptor 'format' of 'Formatter' object needs an argumentÚ format_stringz@format() missing 1 required positional argument: 'format_string')r<r/ÚpopÚvformat)r>Úkwargsr&rGrrrÚformat«s     zFormatter.formatcCsAtƒ}|j||||dƒ\}}|j|||ƒ|S)Né)ÚsetÚ_vformatÚcheck_unused_args)r&rGr>rJÚ used_argsÚresultÚ_rrrrIºs !zFormatter.vformatrc Csg|dkrtdƒ‚ng}x0|j|ƒD]\}} } } |rY|j|ƒn| dk r1| dkr¥|dkrŒtdƒ‚nt|ƒ} |d7}n*| jƒrÏ|rÆtdƒ‚nd}n|j| ||ƒ\} } |j| ƒ|j| | ƒ} |j| ||||dd|ƒ\} }|j|j | | ƒƒq1q1Wdj |ƒ|fS)NrzMax string recursion exceededr*FzJcannot switch from manual field specification to automatic field numberingr)Úauto_arg_index) r/ÚparseÚappendÚstrÚisdigitÚ get_fieldÚaddÚ convert_fieldrNÚ format_fieldr )r&rGr>rJrPZrecursion_depthrSrQZ literal_textÚ field_nameÚ format_specÚ conversionÚobjZarg_usedrrrrNÀs4            zFormatter._vformatcCs#t|tƒr||S||SdS)N)Ú isinstanceÚint)r&Úkeyr>rJrrrÚ get_valueöszFormatter.get_valuecCsdS)Nr)r&rPr>rJrrrrOýszFormatter.check_unused_argscCs t||ƒS)N)rK)r&Úvaluer]rrrr[szFormatter.format_fieldcCsk|dkr|S|dkr&t|ƒS|dkr<t|ƒS|dkrRt|ƒStdj|ƒƒ‚dS)Nr ÚrÚaz"Unknown conversion specifier {0!s})rVÚreprÚasciir/rK)r&rdr^rrrrZs       zFormatter.convert_fieldcCs tj|ƒS)N)Ú_stringZformatter_parser)r&rGrrrrTszFormatter.parsec Csmtj|ƒ\}}|j|||ƒ}x6|D].\}}|rUt||ƒ}q1||}q1W||fS)N)riZformatter_field_name_splitrcÚgetattr) r&r\r>rJÚfirstÚrestr_Zis_attrr1rrrrX"szFormatter.get_fieldN) r r!r"rKrIrNrcrOr[rZrTrXrrrrrFªs   5     rF)rCriZ whitespaceZascii_lowercaseZascii_uppercaseZ ascii_lettersZdigitsZ hexdigitsZ octdigitsZ punctuationZ printablerÚrerÚ collectionsrÚtyperr#rFrrrrÚs    a