B O��j,-� @s�dZddddddddd d d d g Zd dlZdZdZdZeeZdZeddZdZ dZ eee eZ ddd�Z d dl Zd dlmZGdd�de�ZGdd �d ed�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 � ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits� hexdigits� octdigits� printable� punctuation� whitespace� Formatter�Template�Nz ZabcdefghijklmnopqrstuvwxyzZABCDEFGHIJKLMNOPQRSTUVWXYZ� 0123456789ZabcdefZABCDEFZ01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs|pd�dd�|�|�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|]}|��VqdS)N)� capitalize)�.0�x�r�+/opt/alt/python37/lib64/python3.7/string.py� <genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s )�ChainMapcs eZdZdZ�fdd�Z�ZS)�_TemplateMetaclassa/ %(delim)s(?: (?P<escaped>%(delim)s) | # Escape sequence of two delimiters (?P<named>%(id)s) | # delimiter and a Python identifier {(?P<braced>%(bid)s)} | # delimiter and a braced identifier (?P<invalid>) # Other ill-formed delimiter exprs ) csbtt|��|||�d|kr$|j}n$tjt�|j�|j|jp@|jd�}t� ||j tj B�|_dS)N�pattern)Zdelim�idZbid) �superr�__init__r�_re�escape� delimiter� idpattern�braceidpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)� __class__rrrAs z_TemplateMetaclass.__init__)�__name__� __module__� __qualname__rr� __classcell__rr)r+rr7src@sBeZdZdZdZdZdZejZ dd�Z dd�Z d d �Z d d �Z dS) r z.A string class for supporting $-substitutions.�$z(?a:[_a-z][_a-z0-9]*)NcCs ||_dS)N)�template)�selfr1rrrrZszTemplate.__init__cCsd|�d�}|jd|�jdd�}|s.d}d}n"|td�|dd���}t|�}td||f��dS)N�invalidT)�keepends�����z.Invalid placeholder in string: line %d, col %d)�startr1� splitlines�lenr� ValueError)r2�mo�i�lines�colno�linenorrr�_invalid_s zTemplate._invalidcsl|s td��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�j�|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr5zToo many positional argumentsr csd|�d�p|�d�}|dk r(t�|�S|�d�dk r<�jS|�d�dk rT��|�td�j��dS)N�named�braced�escapedr3z#Unrecognized named group in pattern)�group�strr"rAr;r)r<rB)�mappingr2rr�convertys  z$Template.substitute.<locals>.convert)� TypeErrorr:� _ChainMapr�subr1)�args�kwsrHr)rGr2r� substituteks  zTemplate.substitutecsl|s td��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�j�|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr5zToo many positional argumentsr cs||�d�p|�d�}|dk rBy t�|�Stk r@|��SX|�d�dk rV�jS|�d�dk rl|��Std�j��dS)NrBrCrDr3z#Unrecognized named group in pattern)rErF�KeyErrorr"r;r)r<rB)rGr2rrrH�s  z)Template.safe_substitute.<locals>.convert)rIr:rJrrKr1)rLrMrHr)rGr2r�safe_substitute�s  zTemplate.safe_substitute)r,r-r.�__doc__r"r#r$r � IGNORECASEr&rrArNrPrrrrr Ns )� metaclassc@sVeZdZdd�Zdd�Zddd�Zdd �Zd d �Zd d �Zdd�Z dd�Z dd�Z dS)r cOsN|s td��|^}}y |^}}Wntk r>td�d�YnX|�|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argumentz@format() missing 1 required positional argument: 'format_string')rIr;�vformat)rL�kwargsr2� format_stringrrr�format�s  zFormatter.formatcCs.t�}|�||||d�\}}|�|||�|S)N�)�set�_vformat�check_unused_args)r2rVrLrU� used_args�result�_rrrrT�szFormatter.vformatr c Cs�|dkrtd��g}x�|�|�D]�\}} } } |r:|�|�| dk r | dkrl|dkrZtd��t|�} |d7}n| ��r�|r�td��d}|�| ||�\} } |�| �|�| | �} |j| ||||d|d�\} }|�|� | | ��q Wd� |�|fS)Nr zMax string recursion exceededr6FzJcannot switch from manual field specification to automatic field numberingr5)�auto_arg_index) r;�parse�appendrF�isdigit� get_field�add� convert_fieldrZ� format_fieldr)r2rVrLrUr\Zrecursion_depthr_r]Z literal_text� field_name� format_spec� conversion�objZarg_usedrrrrZ�s4     zFormatter._vformatcCst|t�r||S||SdS)N)� isinstance�int)r2�keyrLrUrrr� get_value�s zFormatter.get_valuecCsdS)Nr)r2r\rLrUrrrr[�szFormatter.check_unused_argscCs t||�S)N)rW)r2�valuerhrrrrfszFormatter.format_fieldcCsN|dkr |S|dkrt|�S|dkr,t|�S|dkr<t|�Std�|���dS)Nr�r�az"Unknown conversion specifier {0!s})rF�repr�asciir;rW)r2rorirrrreszFormatter.convert_fieldcCs t�|�S)N)�_stringZformatter_parser)r2rVrrrr`szFormatter.parsec CsNt�|�\}}|�|||�}x(|D] \}}|r:t||�}q"||}q"W||fS)N)rtZformatter_field_name_splitrn�getattr) r2rgrLrU�first�restrjZis_attrr=rrrrc$s  zFormatter.get_fieldN)r ) r,r-r.rWrTrZrnr[rfrer`rcrrrrr �s  5 )N)rQ�__all__rtr rrrrrrr rr�rer � collectionsrrJ�typerr r rrrr�<module>s&     a