Your IP : 3.133.153.110


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



���]|Q�
@s[ddlZddlZddlZddlZddlmZ	ddddddgZ
dd	d
dddd
d�Zd	d
ddddd�Zdd�Z
dd�Zdd�ZGdd�d�Zdd�ZGdd�d�Zdd�Zeeeeeeeeed�h�Zdd�Zddd�Zdd�Z e!dkrWe�dS) �N)�StringIO�pprint�pformat�
isreadable�isrecursive�saferepr�
PrettyPrinter��P�compactFcCs8td|d|d|d|d|�}|j|�dS)N�stream�indent�width�depthr)rr)�objectrr
rrrZprinter�r�+/opt/alt/python35/lib64/python3.5/pprint.pyr/s	c	Cs(td|d|d|d|�j|�S)Nr
rrr)rr)rr
rrrrrrr7scCst|idd�dS)Nr)�
_safe_repr)rrrrr<scCst|idd�dS)Nrr	)r)rrrrr@scCst|idd�dS)Nr�)r)rrrrrDsc@s1eZdZdgZdd�Zdd�ZdS)�	_safe_key�objcCs
||_dS)N)r)�selfrrrr�__init__Tsz_safe_key.__init__cCssy|j|jkSWnXtk
rntt|j��t|j�ftt|j��t|j�fkSYnXdS)N)r�	TypeError�str�type�id)r�otherrrr�__lt__Ws

!z_safe_key.__lt__N)�__name__�
__module__�__qualname__�	__slots__rrrrrrrHs
	rcCst|d�t|d�fS)Nrr	)r)�trrr�_safe_tuple^sr$c@sXeZdZdddddddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZiZ	dd�Z
e
e	ej<dd�Z
e
e	ejj<dd�Zee	ej<dd�Zee	ej<dd�Zee	ej<ee	ej<dd�Zee	ej<dd�Zee	ej<d d!�Zee	ej<d"d#�Zee	ejj<d$d%�Z d&d'�Z!d(d)�Z"d*d+�Z#d,d-�Z$e$e	ej%j<d.d/�Z&e&e	ej'j<d0d1�Z(e(e	ej)j<d2d3�Z*e*e	ej+j<d4d5�Z,e,e	ej-j<d6d7�Z.e.e	ej/j<d8d9�Z0e0e	ej1j<dS):rr	r
NrFcCs�t|�}t|�}|dkr0td��|dk	rT|dkrTtd��|sftd��||_||_||_|dk	r�||_ntj|_t|�|_	dS)Nrzindent must be >= 0zdepth must be > 0zwidth must be != 0)
�int�
ValueError�_depth�_indent_per_level�_width�_stream�_sys�stdout�bool�_compact)rr
rrrrrrrrcs			zPrettyPrinter.__init__cCs3|j||jddid�|jjd�dS)Nr�
)�_formatr*�write)rrrrrr�szPrettyPrinter.pprintcCs/t�}|j||ddid�|j�S)Nr)�	_StringIOr0�getvalue)rr�siorrrr�s	zPrettyPrinter.pformatcCs|j|idd�dS)Nrr)�format)rrrrrr�szPrettyPrinter.isrecursivecCs,|j|idd�\}}}|o+|S)Nr)r5)rr�s�readable�	recursiverrrr�s!zPrettyPrinter.isreadablec	Cs-t|�}||krA|jt|��d|_d|_dS|j|||�}|j||}	t|�|	kr|jj	t
|�jd�}
|
dk	r�d||<|
|||||||d�||=dSt|t
�rd||<|j||||||d�||=dS|j|�dS)NTFr	)rr1�
_recursion�
_recursive�	_readable�_reprr)�len�	_dispatch�getr�__repr__�
isinstance�dict�_pprint_dict)rrrr
�	allowance�context�level�objid�rep�	max_width�prrrr0�s,		
 
zPrettyPrinter._formatc
Cs�|j}|d�|jdkr7||jdd�t|�}|r�t|j�dt�}	|j|	|||d||�|d�dS)N�{r	� �key�})r1r(r=�sorted�itemsr$�_format_dict_items)
rrrr
rDrErFr1�lengthrPrrrrC�s	

zPrettyPrinter._pprint_dictcCs�t|�s#|jt|��dS|j}|j|jd�|jt|j��||t|j�d|d||�|jd�dS)N�(r	�))r=r1�repr�	__class__rr0�listrP)rrrr
rDrErF�clsrrr�_pprint_ordered_dict�s	
z"PrettyPrinter._pprint_ordered_dictcCs>|jd�|j||||d||�|jd�dS)N�[r	�])r1�
_format_items)rrrr
rDrErFrrr�_pprint_list�s

zPrettyPrinter._pprint_listcCsb|jd�t|�dkr%dnd}|j||||t|�||�|j|�dS)NrSr	z,)rT)r1r=r\)rrrr
rDrErF�endcharrrr�
_pprint_tuple�s


zPrettyPrinter._pprint_tuplec	Cs�t|�s#|jt|��dS|j}|tkrN|jd�d}n1|j|jd�d}|t|j�d7}t|dt�}|j||||t|�||�|j|�dS)NrKrNz({z})r	rM)	r=r1rUrV�setrrOrr\)	rrrr
rDrErF�typr^rrr�_pprint_set�s	
	
zPrettyPrinter._pprint_setcCsM|j}t|�s)|t|��dSg}|jd�}	|dkr^|d7}|d7}|j|}
}xFt|	�D]8\}}
t|
�}|t|	�dkr�|
|8}
t|�|
kr�|j|�q|tjd|
�}|j	�|}d}x�t|�D]�\}}||}|t|�dkrW|t|	�dkrW||8}tt|��|kr�|r�|jt|��|}q|}qW|r||jt|��q|Wt|�dkr�||�dS|dkr�|d�xBt|�D]4\}}|dkr%|dd|�||�q�W|dkrI|d	�dS)
NTr	z\S*\s*�rSrr/rLrT)
r1r=rU�
splitlinesr)�	enumerate�append�re�findall�pop)rrrr
rDrErFr1�chunks�linesZ
max_width1rI�i�linerH�partsZ
max_width2�current�j�part�	candidaterrr�_pprint_str�sT	




,
	


zPrettyPrinter._pprint_strcCs�|j}t|�dkr/|t|��dS|dk}|r_|d7}|d7}|d�d}	xIt||j||�D].}
||	�||
�|	sdd|}	qW|r�|d�dS)N�r	rSrcr/rLrT)r1r=rU�_wrap_bytes_reprr))rrrr
rDrErFr1Zparens�delimrHrrr�
_pprint_bytes's"	


 

zPrettyPrinter._pprint_bytescCsO|j}|d�|jt|�||d|d||d�|d�dS)Nz
bytearray(�
r	rT)r1rw�bytes)rrrr
rDrErFr1rrr�_pprint_bytearray<s
	
zPrettyPrinter._pprint_bytearraycCsH|jd�|j|j�||d|d||�|jd�dS)Nz
mappingproxy(�
r	rT)r1r0�copy)rrrr
rDrErFrrr�_pprint_mappingproxyEs
 
z"PrettyPrinter._pprint_mappingproxycCs�|j}||j7}dd|}t|�d}	x�t|�D]�\}
\}}|
|	k}
|j|||�}||�|d�|j|||t|�d|
r�|nd||�|
sA||�qAWdS)Nz,
rLr	z: r)r1r(r=rer<r0)rrPrr
rDrErFr1�delimnlZ
last_indexrlrM�ent�lastrHrrrrQMs	



z PrettyPrinter._format_dict_itemscCs�|j}||j7}|jdkr:||jdd�dd|}d}	|j|d}
}t|�}yt|�}
Wntk
r�dSYnXd}x|s�|
}yt|�}
Wn,tk
r�d}||8}|
|8}
YnX|jrk|j|||�}t|�d}|
|kr8|}
|	r8|}	|
|krk|
|8}
||	�d}	||�q�||	�|}	|j	||||r�|nd||�q�WdS)	Nr	rLz,
rcFTrz, )
r1r(r)�iter�next�
StopIterationr.r<r=r0)rrPrr
rDrErFr1r~rvrrI�itZnext_entr�rrH�wrrrr\^sN	

		

	



zPrettyPrinter._format_itemscCsL|j||j�|j|�\}}}|s9d|_|rHd|_|S)NFT)r5r|r'r;r:)rrrErFrUr7r8rrrr<�s		zPrettyPrinter._reprcCst||||�S)N)r)rrrE�	maxlevelsrFrrrr5�szPrettyPrinter.formatc	Cs�t|�s#|jt|��dS|j|j||�}|j}|t|j�d7}|jd|j|d|f�|j||||d||�|jd�dS)Nr	z	%s(%s,
%srLrT)r=r1rUr<�default_factoryrVrrC)	rrrr
rDrErFZrdfrXrrr�_pprint_default_dict�s	! z"PrettyPrinter._pprint_default_dictc	Cs�t|�s#|jt|��dS|j}|j|jd�|jdkrg|j|jdd�|j�}|j|||t|j�d|d||�|jd�dS)Nz({r	rLrz}))r=r1rUrVrr(�most_commonrQ)	rrrr
rDrErFrXrPrrr�_pprint_counter�s	
zPrettyPrinter._pprint_counterc
Cs�t|j�s&|jt|��dS|j}|j|jd�|t|j�d7}x�t|j�D]�\}}	|t|j�dkr�|j|	|||d||�|jd�qj|j|	||d||�|jdd|�qjWdS)NrSr	rTz,
rL)r=�mapsr1rUrVrrer0)
rrrr
rDrErFrXrl�mrrr�_pprint_chain_map�s	 zPrettyPrinter._pprint_chain_mapc	Cs�t|�s#|jt|��dS|j}|j|jd�|t|j�d7}|jd�|jdkr�|j||||d||�|jd�nO|j|||d||�|j|j||�}|jdd||f�dS)NrSr	rZrz])z],
%smaxlen=%s)rL)r=r1rUrVr�maxlenr\r<)	rrrr
rDrErFrXZrmlrrr�
_pprint_deque�s	


zPrettyPrinter._pprint_dequecCs'|j|j|||||d�dS)Nr	)r0�data)rrrr
rDrErFrrr�_pprint_user_dict�szPrettyPrinter._pprint_user_dictcCs'|j|j|||||d�dS)Nr	)r0r�)rrrr
rDrErFrrr�_pprint_user_list�szPrettyPrinter._pprint_user_listcCs'|j|j|||||d�dS)Nr	)r0r�)rrrr
rDrErFrrr�_pprint_user_string�sz!PrettyPrinter._pprint_user_string)2rr r!rrrrrr0r>rCrBr@rY�_collections�OrderedDictr]rWr_�tuplerbr`�	frozensetrsrrwryrz�	bytearrayr}�_types�MappingProxyTyperQr\r<r5r��defaultdictr��Counterr��ChainMapr��dequer��UserDictr��UserListr��
UserStringrrrrrbsZ&




1


)	cCsUt|�}|tkr+t|�ddfSt|dd�}t|t�r�|tjkr�|sedSt|�}|r�||kr�dd||kfS||kr�t|�ddfSd||<d}d}g}	|	j	}
|d7}t
}t|j�dt
�}x�|D]�\}
}||
|||�\}}}|||||�\}}}|
d||f�|ot|ot|}|s�|r	d}q	W||=d	d
j|	�||fSt|t�r�|tjks�t|t�r,|tjkr,t|t�r|sdSd}n+t|�dkr'd
}n|s1dSd}t|�}|rl||krl|dd||kfS||kr�t|�ddfSd||<d}d}g}	|	j	}
|d7}xN|D]F}t
||||�\}}}|
|�|s�d}|r�d}q�W||=|d
j|	�||fSt|�}||oN|jd�dfS)NTFr@�{}z{...}r	rMz%s: %sz{%s}z, �[]z[%s]z(%s,)�()z(%s)z...�<)r�TF)r�TF)r�TF)r�_builtin_scalarsrU�getattr�
issubclassrBr@rr9rfrrOrPr$�joinrWr�r=�
startswith)rrEr�rFra�rrGr7r8Z
componentsrfrrP�k�vZkreprZ	kreadableZkrecurZvreprZ	vreadableZvrecurr5�oZoreprZ	oreadableZorecurrHrrrr�s|
	

		
	



rcCsdt|�jt|�fS)Nz<Recursion on %s with id=%s>)rrr)rrrrr91sr9cCs�ddl}|dkrCddddgddd	d
ifgd}t�}|j�}t|idd�|j�}|j|�|j�}td||�td
||�dS)Nr�stringr	r�rt����i��z_safe_repr:zpformat:)r	r)�timerrr�print)rr�rJ�t1Zt2Zt3rrr�
_perfcheck6s+	
r�ccs�d}t|�dd}x�tdt|�d�D]r}|||d�}||}||krm||8}tt|��|kr�|r�t|�V|}q3|}q3W|r�t|�VdS)N�rtr)r=�rangerU)rrrDror�rlrqrrrrrruCs

	
ru�__main__)"�collectionsr�rg�sysr+�typesr��iorr2�__all__rrrrrrr$rrr�rryr�r%�float�complexr-rr�r9r�rurrrrr�<module>%s0	��D


?>