Your IP : 18.119.119.119


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/string.cpython-34.pyo

�
i f�,�@s�dZddlZdZdZdZeeZdZeddZd	Zd
Z	eee	eZ
ddd�Zddl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�	<genexpr>,szcapwords.<locals>.<genexpr>)�join�split)�s�seprrr�capwords!sr)�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
    )
    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	�Zd
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.<locals>.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 argumentsrcs�|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.<locals>.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�ZdS)�	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	octdigitsZpunctuationZ	printabler�rer�collectionsr�typerr#rFrrrr�<module>s 
a

?>