Your IP : 3.145.161.42


Current Path : /lib64/python3.6/__pycache__/
Upload File :
Current File : //lib64/python3.6/__pycache__/string.cpython-36.pyc

3


 \.�@s�dZddddddddd	d
ddgZd
dlZdZdZdZeeZdZeddZdZ	dZ
eee
eZddd�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|pdjdd�|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�/usr/lib64/python3.6/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>%(id)s)}   |   # delimiter and a braced identifier
      (?P<invalid>)              # Other ill-formed delimiter exprs
    )
    csXtt|�j|||�d|kr$|j}ntjtj|j�|jd�}tj||j	tj
B�|_dS)N�pattern)Zdelim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)�	__class__rrrAs
z_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr�
__classcell__rr)r*rr7src@s>eZdZdZdZdZejZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rz.A string class for supporting $-substitutions.�$z(?-i:[_a-zA-Z][_a-zA-Z0-9]*)cCs
||_dS)N)�template)�selfr0rrrrXszTemplate.__init__cCsd|jd�}|jd|�jdd�}|s.d}d}n"|tdj|dd���}t|�}td||f��dS)N�invalidT)�keepends��z.Invalid placeholder in string: line %d, col %d���)�startr0�
splitlines�lenr�
ValueError)r1�mo�i�lines�colno�linenorrr�_invalid]s
zTemplate._invalidcsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
csd|jd�p|jd�}|dk	r(t�|�S|jd�dk	r<�jS|jd�dk	rT�j|�td�j��dS)N�named�braced�escapedr2z#Unrecognized named group in pattern)�group�strr"r@r:r)r;rA)�mappingr1rr�convertws
z$Template.substitute.<locals>.convert)�	TypeErrorr9�	_ChainMapr�subr0)�args�kwsrGr)rFr1r�
substituteiszTemplate.substitutecsl|std��|^�}t|�dkr(td��|s2|�n|rFt||d��n|d���fdd�}�jj|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr4zToo many positional argumentsr
cs||jd�p|jd�}|dk	rByt�|�Stk
r@|j�SX|jd�dk	rV�jS|jd�dk	rl|j�Std�j��dS)NrArBrCr2z#Unrecognized named group in pattern)rDrE�KeyErrorr"r:r)r;rA)rFr1rrrG�s
z)Template.safe_substitute.<locals>.convert)rHr9rIrrJr0)rKrLrGr)rFr1r�safe_substitute�s
zTemplate.safe_substituteN)
r+r,r-�__doc__r"r#r �
IGNORECASEr%rr@rMrOrrrrrMs)�	metaclassc@sVeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOsz|std��|^}}y|^}}WnJtk
rjd|kr\|jd�}ddl}|jdtdd�n
td�d�YnX|j|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argument�
format_stringr
z9Passing 'format_string' as keyword argument is deprecated�)�
stacklevelz@format() missing 1 required positional argument: 'format_string')rHr:�pop�warnings�warn�DeprecationWarning�vformat)rK�kwargsr1rSrWrrr�format�s

zFormatter.formatcCs.t�}|j||||d�\}}|j|||�|S)NrT)�set�_vformat�check_unused_args)r1rSrKr[�	used_args�result�_rrrrZ�szFormatter.vformatr
c	Cs�|dkrtd��g}x�|j|�D]�\}}	}
}|r:|j|�|	dk	r |	dkrl|dkrZtd��t|�}	|d7}n|	j�r�|r�td��d}|j|	||�\}}
|j|
�|j||�}|j|
||||d|d�\}
}|j|j	||
��q Wdj
|�|fS)Nr
zMax string recursion exceededr5FzJcannot switch from manual field specification to automatic field numberingr4)�auto_arg_index)r:�parse�appendrE�isdigit�	get_field�add�
convert_fieldr^�format_fieldr)r1rSrKr[r`Zrecursion_depthrcraZliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr^�s4


zFormatter._vformatcCst|t�r||S||SdS)N)�
isinstance�int)r1�keyrKr[rrr�	get_value�s
zFormatter.get_valuecCsdS)Nr)r1r`rKr[rrrr_szFormatter.check_unused_argscCs
t||�S)N)r\)r1�valuerlrrrrjszFormatter.format_fieldcCsN|dkr|S|dkrt|�S|dkr,t|�S|dkr<t|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})rE�repr�asciir:r\)r1rsrmrrrriszFormatter.convert_fieldcCs
tj|�S)N)�_stringZformatter_parser)r1rSrrrrdszFormatter.parsec	CsNtj|�\}}|j|||�}x(|D] \}}|r:t||�}q"||}q"W||fS)N)rxZformatter_field_name_splitrr�getattr)	r1rkrKr[�first�restrnZis_attrr<rrrrg(szFormatter.get_fieldN)r
)r+r,r-r\rZr^rrr_rjrirdrgrrrrr�s
5	)N)rP�__all__rxr
rrrrrrr	rr�rer �collectionsrrI�typerrrrrrr�<module>s&


`