Your IP : 3.142.135.24


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



���]N.�@s�dddddddddd	d
dgZdd
lZdZdZdZeeZdZeddZdZdZ	eee	eZ
d
dd�Zdd
lZ
ddlmZGdd�de�ZGdd�dde�ZGdd
�d
�Zd
S)�
ascii_letters�ascii_lowercase�ascii_uppercase�capwords�digits�	hexdigits�	octdigits�	printable�punctuation�
whitespace�	Formatter�Template�Nz 	

�abcdefghijklmnopqrstuvwxyz�ABCDEFGHIJKLMNOPQRSTUVWXYZ�
0123456789ZabcdefZABCDEF�01234567z !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~cCs)|p	djdd�|j|�D��S)N� 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�pattern�delim�id)�superr�__init__r�_re�escape�	delimiter�	idpattern�compile�flags�VERBOSE)�cls�name�bases�dctr)�	__class__rrr#Asz_TemplateMetaclass.__init__)�__name__�
__module__�__qualname__rr#rr)r/rr7src@sUeZdZdZdZejZdd�Zdd�Z	dd�Z
d	d
�ZdS)r�$z[_a-z][_a-z0-9]*cCs
||_dS)N)�template)�selfr4rrrr#TszTemplate.__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���)�startr4�
splitlines�lenr�
ValueError)r5�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 argumentr8zToo 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�escapedr6z#Unrecognized named group in pattern)�groupr&rDr>r)r?rE�val)�mappingr5rr�convertss

z$Template.substitute.<locals>.convert)�	TypeErrorr=�	_ChainMapr�subr4)�args�kwsrKr)rJr5r�
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 argumentr8zToo 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)NrErFz%srGr6z#Unrecognized named group in pattern)rH�KeyErrorr&r>r)r?rE)rJr5rrrK�s

z)Template.safe_substitute.<locals>.convert)rLr=rMrrNr4)rOrPrKr)rJr5r�safe_substitute�s	
zTemplate.safe_substituteN)r0r1r2r&r'r$�
IGNORECASEr)r#rDrQrSrrrrr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')rLr>�pop�warnings�warn�DeprecationWarning�vformat)rO�kwargsr5rVrZrrr�format�s
		zFormatter.formatcCsAt�}|j||||d�\}}|j|||�|S)NrX)�set�_vformat�check_unused_args)r5rVrOr^�	used_args�result�_rrrr]�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 exceededr9FzJcannot switch from manual field specification to automatic field numberingr8�auto_arg_index)r>�parse�append�str�isdigit�	get_field�add�
convert_fieldra�format_fieldr)r5rVrOr^rc�recursion_depthrfrd�literal_text�
field_name�format_spec�
conversion�obj�arg_usedrrrra�s4


	
zFormatter._vformatcCs#t|t�r||S||SdS)N)�
isinstance�int)r5�keyrOr^rrr�	get_value�szFormatter.get_valuecCsdS)Nr)r5rcrOr^rrrrbszFormatter.check_unused_argscCs
t||�S)N)r_)r5�valuerrrrrrnszFormatter.format_fieldcCsk|dkr|S|dkr&t|�S|dkr<t|�S|dkrRt|�Stdj|���dS)Nr�r�az"Unknown conversion specifier {0!s})ri�repr�asciir>r_)r5rzrsrrrrms


zFormatter.convert_fieldcCs
tj|�S)N)�_string�formatter_parser)r5rVrrrrg szFormatter.parsec	Csmtj|�\}}|j|||�}x6|D].\}}|rUt||�}q1||}q1W||fS)N)r�formatter_field_name_splitry�getattr)	r5rqrOr^�first�restrt�is_attrr@rrrrk)szFormatter.get_fieldN)r0r1r2r_r]raryrbrnrmrgrkrrrrr�s5	)�__all__rr
rrrrrrr	rr�rer$�collectionsrrM�typerrrrrrr�<module>s$
a

?>