Your IP : 18.188.195.90


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/string.cpython-35.pyc



��YfN.�@s�dZddddddddd	d
ddgZd
dlZdZdZdZeeZdZeddZdZ	dZ
eee
eZddd�Zd
dl
Zd
dlmZGdd�de�ZGdd�dde�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)|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/python35/lib64/python3.5/string.py�	<genexpr>0szcapwords.<locals>.<genexpr>)�join�split)�s�seprrrr%s)�ChainMapcs(eZdZdZ�fdd�Z�S)�_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
    )
    cstt|�j|||�d|kr4|j}n(tjdtj|j�d|ji}tj||j	tj
B�|_dS)N�patternZdelim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�basesZdctr)�	__class__rrrAsz_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rrrr)r*rr7src@s[eZdZdZdZdZejZdd�Z	dd�Z
dd	�Zd
d�ZdS)
rz.A string class for supporting $-substitutions.�$z[_a-z][_a-z0-9]*cCs
||_dS)N)�template)�selfr/rrrrTszTemplate.__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)r0�mo�i�lines�colno�linenorrr�_invalidYs	#zTemplate._invalidcs�|std��|^�}t|�dkr<td��|sK|�n&|rgt||d��n
|d���fdd�}�jj|�j�S)Nz>descriptor 'substitute' of 'Template' object needs an argumentr3zToo many positional argumentsr
cs�|jd�p|jd�}|dk	r?�|}d|fS|jd�dk	r[�jS|jd�dk	r}�j|�td�j��dS)N�named�bracedz%s�escapedr1z#Unrecognized named group in pattern)�groupr"r?r9r)r:r@�val)�mappingr0rr�convertss

z$Template.substitute.<locals>.convert)�	TypeErrorr8�	_ChainMapr�subr/)�args�kwsrFr)rEr0r�
substitutees	
zTemplate.substitutecs�|std��|^�}t|�dkr<td��|sK|�n&|rgt||d��n
|d���fdd�}�jj|�j�S)NzCdescriptor 'safe_substitute' of 'Template' object needs an argumentr3zToo many positional argumentsr
cs�|jd�p|jd�}|dk	r\yd�|fSWntk
r[|j�SYnX|jd�dk	rx�jS|jd�dk	r�|j�Std�j��dS)Nr@rAz%srBr1z#Unrecognized named group in pattern)rC�KeyErrorr"r9r)r:r@)rEr0rrrF�s

z)Template.safe_substitute.<locals>.convert)rGr8rHrrIr/)rJrKrFr)rEr0r�safe_substitute�s	
zTemplate.safe_substituteN)
r+r,r-�__doc__r"r#r �
IGNORECASEr%rr?rLrNrrrrrMs	�	metaclassc@seZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)rcOs�|std��|^}}y|^}}Wnatk
r�d|kr~|jd�}ddl}|jdtdd�ntd�d�YnX|j|||�S)Nz;descriptor 'format' of 'Formatter' object needs an argument�
format_stringr
z9Passing 'format_string' as keyword argument is deprecated�
stacklevel�z@format() missing 1 required positional argument: 'format_string')rGr9�pop�warnings�warn�DeprecationWarning�vformat)rJ�kwargsr0rRrVrrr�format�s
		zFormatter.formatcCsAt�}|j||||d�\}}|j|||�|S)NrT)�set�_vformat�check_unused_args)r0rRrJrZ�	used_args�result�_rrrrY�s	!zFormatter.vformatr
c	CsU|dkrtd��g}x!|j|�D]\}}	}
}|rS|j|�|	dk	r.|	dkr�|dkr�td��t|�}	|d7}n$|	j�r�|r�td��d}|j|	||�\}}
|j|
�|j||�}|j|
||||dd|�\}
}|j|j	||
��q.Wdj
|�|fS)Nr
zMax string recursion exceededr4FzJcannot switch from manual field specification to automatic field numberingr3�auto_arg_index)r9�parse�append�str�isdigit�	get_field�add�
convert_fieldr]�format_fieldr)r0rRrJrZr_Zrecursion_depthrbr`Zliteral_text�
field_name�format_spec�
conversion�objZarg_usedrrrr]�s4


	
zFormatter._vformatcCs#t|t�r||S||SdS)N)�
isinstance�int)r0�keyrJrZrrr�	get_value�szFormatter.get_valuecCsdS)Nr)r0r_rJrZrrrr^szFormatter.check_unused_argscCs
t||�S)N)r[)r0�valuerlrrrrjszFormatter.format_fieldcCsk|dkr|S|dkr&t|�S|dkr<t|�S|dkrRt|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})re�repr�asciir9r[)r0rsrmrrrris


zFormatter.convert_fieldcCs
tj|�S)N)�_stringZformatter_parser)r0rRrrrrc szFormatter.parsec	Csmtj|�\}}|j|||�}x6|D].\}}|rUt||�}q1||}q1W||fS)N)rxZformatter_field_name_splitrr�getattr)	r0rkrJrZ�first�restrnZis_attrr;rrrrg)szFormatter.get_fieldN)r+r,r-r[rYr]rrr^rjrircrgrrrrr�s5	)rO�__all__rxr
rrrrrrr	rr�rer �collectionsrrH�typerrrrrrr�<module>s&
a

?>