Your IP : 3.133.127.131


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



���]q�+@s�dddddddddd	d
gZyddlmZWnek
rOYnXdd
lmZddlmZddlm	Z	ddl
mZyddlm
Z
Wn%ek
r�Gdd�d�Z
YnXdWZdXZeedd�Zeedd�Zedd�Zedd�Zed d!�Zed"d#�Zed$d%�Zed&d'�Zed(d)�Zed*d+�Zed,d-�Zed.d/�Zed0d1�Zed2d3�Zd4d5efd6efd7efgd6d7efd4efd5efgd5d4efd7efd6efgd7d6efd5efd4efgiZd8d�Z d9d�Z!ydd:lm!Z!Wnek
rzYnXd;d�Z"ydd<lm"Z"Wnek
r�YnXGd=d	�d	e#�Z$ed>d?d@dAdBg�Z%GdCdD�dDe&�Z'e#�fe(e)e*e+dE�he,e-e+e.dFdG�Z/dHdIdJd�Z0dKdL�Z1yddMlm1Z1Wnek
rsYnXdNdO�Z2dEdPdQ�Z3dRdS�Z4dTdU�Z5dVd
�Z6dES)Y�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�)r)�get_cache_token)�
namedtuple)�MappingProxyType)�WeakKeyDictionary)�RLockc@s(eZdZdd�Zdd�ZdS)rcCsdS)N�)�selfrr�./opt/alt/python35/lib64/python3.5/functools.py�	__enter__szRLock.__enter__cCsdS)Nr)r�exctype�excinst�exctbrrr�__exit__szRLock.__exit__N)�__name__�
__module__�__qualname__rrrrrrrsrrrr�__doc__�__annotations__�__dict__c
Cs�xF|D]>}yt||�}Wntk
r4YqXt|||�qWx0|D](}t||�jt||i��qPW||_|S)N)�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�valuerrrr+s


&	cCsttd|d|d|�S)Nr&r'r()r	r)r&r'r(rrrrIscCs0|j|�}||kr|S|o/||kS)N)�__lt__)r�other�NotImplemented�	op_resultrrr�_gt_from_ltasr/cCs|j|�}|p||kS)N)r+)rr,r-r.rrr�_le_from_lthsr0cCs$|j|�}||kr|S|S)N)r+)rr,r-r.rrr�_ge_from_ltmsr1cCs0|j|�}||kr|S|p/||kS)N)�__le__)rr,r-r.rrr�_ge_from_letsr3cCs/|j|�}||kr|S|o.||kS)N)r2)rr,r-r.rrr�_lt_from_le{sr4cCs$|j|�}||kr|S|S)N)r2)rr,r-r.rrr�_gt_from_le�sr5cCs0|j|�}||kr|S|o/||kS)N)�__gt__)rr,r-r.rrr�_lt_from_gt�sr7cCs|j|�}|p||kS)N)r6)rr,r-r.rrr�_ge_from_gt�sr8cCs$|j|�}||kr|S|S)N)r6)rr,r-r.rrr�_le_from_gt�sr9cCs0|j|�}||kr|S|p/||kS)N)�__ge__)rr,r-r.rrr�_le_from_ge�sr;cCs/|j|�}||kr|S|o.||kS)N)r:)rr,r-r.rrr�_gt_from_ge�sr<cCs$|j|�}||kr|S|S)N)r:)rr,r-r.rrr�_lt_from_ge�sr=r+r6r2r:cs{�fdd�tD�}|s+td��t|�}x=t|D]1\}}||krB||_t�||�qBW�S)Ncs:g|]0}t�|d�tt|d�k	r|�qS)N)r �object)�.0�op)�clsrr�
<listcomp>�s	z"total_ordering.<locals>.<listcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr")rA�roots�root�opname�opfuncr)rArr�s	cs G�fdd�dt�}|S)Ncs�eZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dS)N)rJ)rrJrrr�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS)Nr)rJ)rr,)�mycmprrr+�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkS)Nr)rJ)rr,)rLrrr6�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkS)Nr)rJ)rr,)rLrr�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkS)Nr)rJ)rr,)rLrrr2�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkS)Nr)rJ)rr,)rLrrr:�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rKr+r6rMr2r:�__hash__r)rLrr�K�s	rP)r>)rLrPr)rLrr�s)rcs�t�d�rJ�j���jj�}|j��|�~�j����fdd�}�|_�|_�|_|S)N�funccs*�j�}|j|���||�S)N)�copyr#)ZfargsZ	fkeywordsZnewkeywords)�argsrQ�keywordsrr�newfunc�s
zpartial.<locals>.newfunc)�hasattrrSrTrRr#rQ)rQrSrTZtmpkwrUr)rSrQrTrr	�s

				)r	c@sReZdZdd�Zdd�Zdd�Zdd�Zed	d
��ZdS)r
cOs�t|�r2t|d�r2tdj|���t|t�r�|j|_|j||_|jj	�|_|jj
|�n||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)�callablerV�	TypeError�format�
isinstancer
rQrSrTrRr#)rrQrSrTrrrrKs			zpartialmethod.__init__cCs}djtt|j��}djdd�|jj�D��}d}|jd|jjd|jj	d|j
d|d	|�S)
Nz, css'|]\}}dj||�VqdS)z{}={!r}N)rZ)r?�k�vrrr�	<genexpr>)sz)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords})�modulerArQrSrT)�join�map�reprrSrT�itemsrZ�	__class__rrrQ)rrSrT�
format_stringrrr�__repr__'s	zpartialmethod.__repr__cs+�fdd�}�j|_�|_|S)NcsR�jj�}|j|�|^}}|f�jt|�}�j||�S)N)rTrRr#rS�tuplerQ)rSrT�
call_keywords�cls_or_self�rest�	call_args)rrr�_method3s

z3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)rrlr)rr�_make_unbound_method2s	z"partialmethod._make_unbound_methodcCs�t|jdd�}d}|dk	r�|||�}||jk	r�t||j|j�}y|j|_Wntk
r�YnX|dkr�|j�j||�}|S)NrW)	r rQr	rSrT�__self__r!rorW)rrJrA�get�result�new_funcrrrrW=s
zpartialmethod.__get__cCst|jdd�S)NrmF)r rQ)rrrrrmPsz"partialmethod.__isabstractmethod__N)	rrrrKrfrorW�propertyrmrrrrr
s
�	CacheInfo�hits�misses�maxsize�currsizec@s1eZdZdZedd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs#||dd�<||�|_dS)N)r{)r�tup�hashrrrrKdsz_HashedSeq.__init__cCs|jS)N)r{)rrrrrOhsz_HashedSeq.__hash__N)rrrrNr}rKrOrrrrrz[srzNc	s�|}	|rC||j��}
|	|7}	x|
D]}|	|7}	q/W|r�|	|�fdd�|D��7}	|r�|	|�fdd�|
D��7}	n0||	�dkr��|	d�|kr�|	dSt|	�S)Nc3s|]}�|�VqdS)Nr)r?r])�typerrr^�sz_make_key.<locals>.<genexpr>c3s!|]\}}�|�VqdS)Nr)r?r\r])r~rrr^�s�r)rcrz)rS�kwds�typed�kwd_mark�	fasttypes�sortedrgr~�len�key�sorted_items�itemr)r~r�	_make_keyks

#&(r��FcsA�dk	r(t�t�r(td����fdd�}|S)Nz)Expected maxsize to be an integer or Nonecs"t|��t�}t||�S)N)�_lru_cache_wrapper�
_CacheInfor)�
user_functionr%)rxr�rr�decorating_function�sz&lru_cache.<locals>.decorating_function)r[�intrY)rxr�r�r)rxr�rr�scsYt��t�
d\����i�d��d��j�t��	g�
�
�
ddg�
dd�<�dkr���fdd�}nr�dkr�����
����fdd�}n<���������	�
���
��fd	d�}����	��fd
d�}����	��
fdd
�}||_||_|S)Nrr��Fcs�||�}�d7�|S)Nrr)rSr�rr)rwr�rrr%�s
z#_lru_cache_wrapper.<locals>.wrappercsb�||��}�|��}|�k	r;�d7�|S�||�}|�|<�d7�|S)Nrr)rSr�r�rr)�cache�	cache_getrv�make_keyrw�sentinelr�r�rrr%�s


cs��	||�
�}����|�}|dk	r�|\}}}}||�<||�<��}||�<��<||�<�|�<�d7�|SWdQRX�||�}���|�kr�n��r%�}	||	�<||	�<|	����}
��}d��<��<�|
=|	�|<nH��}|�||g}||�<��<�|<�j��
k��d7�WdQRX|S)Nr)�__len__)rSr�r��linkZ	link_prevZ	link_next�_keyrrZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTr�r��fullrv�lockr�rxrwrGr�r�rrr%�sB












cs+�������j��SWdQRXdS)N)r�r)r�r�rvr�rxrwrr�
cache_info
sz&_lru_cache_wrapper.<locals>.cache_infocsH��;�j���ddg�dd�<d��d�WdQRXdS)NrF)�clearr)r�r�rvr�rwrGrr�cache_clears


z'_lru_cache_wrapper.<locals>.cache_clear)rrr�r�)r>r�rqrr�r�)r�rxr�r�r%r�r�r)r�r�r�r�r�r�r�r�rvr�r�rxrwrGr�r�r�rr��s(	
		*<9!!			r�)r�cCs�g}x�dd�|D�}|s&|SxG|D]?}|d}x,|D]#}||dd�krDd}PqDWPq-W|dkr�td��|j|�x%|D]}|d|kr�|d=q�Wq	WdS)NcSsg|]}|r|�qSrr)r?�srrrrB1s	z_c3_merge.<locals>.<listcomp>rrzInconsistent hierarchy)�RuntimeError�append)�	sequencesrr�s1�	candidate�s2�seqrrr�	_c3_merge)s$




r�c
s�xLtt|j��D]/\}�t�d�rt|j�|}PqWd}�rat��ng�t|jd|��}g}t|j|d��}xM�D]E�t|��r�t�fdd�|jD��r�|j��q�Wx|D]��j	��q�W�fdd�|D�}�fdd�|D�}�fdd�|D�}	t
|gg|||	|g|g|g�S)	N�__abstractmethods__rc3s|]}t|��VqdS)N)�
issubclass)r?�b)�baserrr^asz_c3_mro.<locals>.<genexpr>cs"g|]}t|d���qS)�abcs)�_c3_mro)r?r�)r�rrrBhs	z_c3_mro.<locals>.<listcomp>cs"g|]}t|d���qS)r�)r�)r?r�)r�rrrBis	cs"g|]}t|d���qS)r�)r�)r?r�)r�rrrBjs	)�	enumerate�reversed�	__bases__rVr��listr��anyr��remover�)
rAr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr)r�r�rr�Ds("
 
r�cs]t�j����fdd���fdd��D���fdd���fdd��D��t���g}x��D]�}g}xR|j�D]D}|�kr�t�|�r�|j�fdd�|jD��q�W|s�|j|�q�|jd	td
d�x8|D]0}x'|D]}||kr"|j|�q"WqWq�Wt�d|�S)
Ncs(|�ko't|d�o't�|�S)N�__mro__)rVr�)�typ)�basesrArr�
is_relatedzsz _compose_mro.<locals>.is_relatedcs"g|]}�|�r|�qSrr)r?�n)r�rrrB}s	z _compose_mro.<locals>.<listcomp>cs4x-�D]%}||kr||jkrdSqWdS)NTF)r�)r�r,)�typesrr�is_strict_base�s
z$_compose_mro.<locals>.is_strict_basecs"g|]}�|�s|�qSrr)r?r�)r�rrrB�s	cs"g|]}|�kr|�qSrr)r?r�)�type_setrrrB�s	r��reverseTr�)�setr��__subclasses__r�r��sortr�r�)rAr��mror��found�sub�subclsr)r�rAr�r�r�r�r�_compose_mroqs*
'


r�cCs�t||j��}d}x|D]w}|dk	r�||kr�||jkr�||jkr�t||�r�tdj||���P||kr"|}q"W|j|�S)NzAmbiguous dispatch: {} or {})r��keysr�r�r�rZrq)rA�registryr��match�trrr�
_find_impl�s

	
r�cs�i�t��d����fdd��d����fdd���fdd�}|�t<�|_�|_t��|_�j|_t||�|S)Ncs��dk	r1t�}�|kr1�j�|�y�|}WnNtk
r�y�|}Wn!tk
r�t|��}YnX|�|<YnX|S)N)r
r��KeyErrorr�)rA�
current_token�impl)�cache_token�dispatch_cacher�rr�dispatch�s	


z singledispatch.<locals>.dispatchcs[|dkr��fdd�S|��<�dkrMt�d�rMt���j�|S)Ncs
��|�S)Nr)�f)rA�registerrr�<lambda>�sz2singledispatch.<locals>.register.<locals>.<lambda>r�)rVr
r�)rArQ)r�r�r�r�)rArr��s
	
z singledispatch.<locals>.registercs�|dj�||�S)Nr)rd)rS�kw)r�rrr%�szsingledispatch.<locals>.wrapper)	rr>r�r�rr�r��_clear_cacher)rQr%r)r�r�r�r�r�rr�s
	
		
)rrrrr)r)7�__all__�
_functoolsr�ImportError�abcr
�collectionsrr�r�weakrefr�_threadrrrrrr-r/r0r1r3r4r5r7r8r9r;r<r=rCrrr	r>r
r�r�rzr��str�	frozensetr~r�rgr�r�rr�r�r�r�r�rrrrr�<module>s�


				

N	%s
-)

?>