Your IP : 18.224.44.207


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/functools.cpython-39.opt-2.pyc

a

R�f��@s�gd�ZddlmZddlmZddlmZddlmZddl	m
Z
dZdZeefd	d
�Z
eefdd�Zefd
d�Zefdd�Zefdd�Zefdd�Zefdd�Zefdd�Zefdd�Zefdd�Zefdd�Zefdd �Zefd!d"�Zefd#d$�Zd%efd&efd'efgd'efd(efd%efgd(efd'efd&efgd&efd%efd(efgd)�Zd*d+�Zd,d-�Zzdd.lmZWne �y�Yn0e!�Z"e"fd/d0�Z#zdd1lm#Z#Wne �y�Yn0Gd2d3�d3�Z$zdd4lm$Z$Wne �y�Yn0Gd5d6�d6e!�Z%d7d8�Z&ed9gd:��Z'Gd;d<�d<e(�Z)e!�fe*e+he,e-e.fd=d>�Z/dWdAdB�Z0dCdD�Z1zddElm1Z1Wne �yxYn0dFdG�Z2dHdI�Z3dXdKdL�Z4dMdN�Z5dOdP�Z6dQdR�Z7GdSdT�dT�Z8e!�Z9GdUdV�dV�Z:dJS)Y)�update_wrapper�wraps�WRAPPER_ASSIGNMENTS�WRAPPER_UPDATES�total_ordering�cache�
cmp_to_key�	lru_cache�reduce�partial�
partialmethod�singledispatch�singledispatchmethod�cached_property�)�get_cache_token)�
namedtuple)�recursive_repr)�RLock)�GenericAlias)�
__module__�__name__�__qualname__�__doc__�__annotations__)�__dict__c	Csd|D]2}zt||�}Wnty(Yq0t|||�q|D]}t||��t||i��q<||_|S�N)�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�value�r'�./opt/alt/python39/lib64/python3.9/functools.pyr#srcCstt|||d�S)N�r"r#r$)r
rr)r'r'r(rAs�rcCs*t|��||�}||ur|S|o(||kSr��type�__lt__��self�other�NotImplemented�	op_resultr'r'r(�_gt_from_ltYsr2cCs(t|��||�}||ur|S|p&||kSrr*r-r'r'r(�_le_from_lt`sr3cCs"t|��||�}||ur|S|Srr*r-r'r'r(�_ge_from_ltgsr4cCs*t|��||�}||ur|S|p(||kSr�r+�__le__r-r'r'r(�_ge_from_lensr7cCs(t|��||�}||ur|S|o&||kSrr5r-r'r'r(�_lt_from_leusr8cCs"t|��||�}||ur|S|Srr5r-r'r'r(�_gt_from_le|sr9cCs*t|��||�}||ur|S|o(||kSr�r+�__gt__r-r'r'r(�_lt_from_gt�sr<cCs(t|��||�}||ur|S|p&||kSrr:r-r'r'r(�_ge_from_gt�sr=cCs"t|��||�}||ur|S|Srr:r-r'r'r(�_le_from_gt�sr>cCs*t|��||�}||ur|S|p(||kSr�r+�__ge__r-r'r'r(�_le_from_ge�srAcCs(t|��||�}||ur|S|o&||kSrr?r-r'r'r(�_gt_from_ge�srBcCs"t|��||�}||ur|S|Srr?r-r'r'r(�_lt_from_ge�srCr;r6r@r,)r,r6r;r@csV�fdd�tD�}|std��t|�}t|D]"\}}||vr.||_t�||�q.�S)Ncs(h|] }t�|d�tt|d�ur|�qSr)r�object)�.0�op��clsr'r(�	<setcomp>��z!total_ordering.<locals>.<setcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)rH�roots�root�opname�opfuncr'rGr(r�srcsG�fdd�dt�}|S)NcsZeZdZdgZdd�Z�fdd�Z�fdd�Z�fdd	�Z�fd
d�Z�fdd
�Z	dZ
dS)zcmp_to_key.<locals>.K�objcSs
||_dSr�rR)r.rRr'r'r(�__init__�szcmp_to_key.<locals>.K.__init__cs�|j|j�dkS�NrrS�r.r/��mycmpr'r(r,�szcmp_to_key.<locals>.K.__lt__cs�|j|j�dkSrUrSrVrWr'r(r;�szcmp_to_key.<locals>.K.__gt__cs�|j|j�dkSrUrSrVrWr'r(�__eq__�szcmp_to_key.<locals>.K.__eq__cs�|j|j�dkSrUrSrVrWr'r(r6�szcmp_to_key.<locals>.K.__le__cs�|j|j�dkSrUrSrVrWr'r(r@�szcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__rTr,r;rYr6r@�__hash__r'rWr'r(�K�sr\)rD)rXr\r'rWr(r�sr)rcCsXt|�}|tur<zt|�}Wq@ty8td�d�Yq@0n|}|D]}|||�}qD|S)Nz0reduce() of empty sequence with no initial value)�iter�_initial_missing�next�
StopIteration�	TypeError)ZfunctionZsequence�initial�itr&Zelementr'r'r(r	�sr	)r	csFeZdZdZ�fdd�Zdd�Ze�dd��Zdd	�Zd
d�Z	�Z
S)r
)�func�args�keywordsr�__weakref__cs^t|�std��t|d�r8|j|}i|j�|�}|j}tt|��|�}||_||_||_|S)Nz#the first argument must be callablerd)	�callablera�hasattrrerfrd�superr
�__new__)rHrdrerfr.��	__class__r'r(rks

zpartial.__new__cOs*i|j�|�}|jg|j�|�Ri|��Sr�rfrdre)r.rerfr'r'r(�__call__*szpartial.__call__cCs�t|�j}t|j�g}|�dd�|jD��|�dd�|j��D��t|�jdkrld|�dd�	|��d�S|�dd�	|��d�S)	Ncss|]}t|�VqdSr)�repr)rE�xr'r'r(�	<genexpr>2rJz#partial.__repr__.<locals>.<genexpr>css |]\}}|�d|��VqdS)�=Nr'�rE�k�vr'r'r(rr3rJ�	functoolsz
functools.�(�, �))
r+rrprd�extendrerf�itemsr�join)r.�qualnamerer'r'r(�__repr__.s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jp$dffSr)r+rdrerfr�r.r'r'r(�
__reduce__8s�zpartial.__reduce__cCs�t|t�std��t|�dkr0tdt|�����|\}}}}t|�rrt|t�rr|dur`t|t�rr|durzt|t�sztd��t|�}|dur�i}nt|�tur�t|�}|dur�i}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tuplera�lenrh�dictr+rrdrerf)r.�staterdre�kwds�	namespacer'r'r(�__setstate__<s4
����zpartial.__setstate__)rrrrZrkrorrr�r��
__classcell__r'r'rlr(r
s
	r
)r
c@sBeZdZdd�Zdd�Zdd�Zddd	�Zed
d��Ze	e
�ZdS)
rcOsft|�s t|d�s td�|���t|t�rP|j|_|j||_i|j�|�|_n||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)	rhrira�formatr�rrdrerf)r.rdrerfr'r'r(rTbs�
zpartialmethod.__init__cCsNd�tt|j��}d�dd�|j��D��}d}|j|jj|jj	|j
||d�S)Nrycss|]\}}d�||�VqdS)z{}={!r}N)r�rtr'r'r(rrws�z)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerHrdrerf)r}�maprprerfr|r�rmrrrd)r.rerf�
format_stringr'r'r(rus
�
�zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs,i�j�|�}�j|g�j�|�Ri|��Srrn)�cls_or_selfrerfr�r'r(�_method�sz3partialmethod._make_unbound_method.<locals>._method)�__isabstractmethod__�_partialmethod)r.r�r'r�r(�_make_unbound_method�sz"partialmethod._make_unbound_methodNcCs�t|jdd�}d}|durh|||�}||jurht|g|j�Ri|j��}z|j|_WntyfYn0|dur�|���||�}|S)Nr�)	rrdr
rerf�__self__rr�r�)r.rRrH�get�result�new_funcr'r'r(r��s

zpartialmethod.__get__cCst|jdd�S�Nr�F�rrdr�r'r'r(r��sz"partialmethod.__isabstractmethod__)N)rrrrTrr�r��propertyr��classmethodr�__class_getitem__r'r'r'r(rZs

rcCst|t�r|j}q|Sr)r�r
rd�rdr'r'r(�_unwrap_partial�s
r��	CacheInfo)�hits�misses�maxsize�currsizec@s$eZdZdZefdd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs||dd�<||�|_dSr�r�)r.�tup�hashr'r'r(rT�sz_HashedSeq.__init__cCs|jSrr�r�r'r'r(r[�sz_HashedSeq.__hash__N)rrrrZr�rTr[r'r'r'r(r��sr�c
s�|}|r&||7}|��D]}	||	7}q|rh||�fdd�|D��7}|r�||�fdd�|��D��7}n$||�dkr��|d�|vr�|dSt|�S)Nc3s|]}�|�VqdSrr'�rErv�r+r'r(rr�rJz_make_key.<locals>.<genexpr>c3s|]}�|�VqdSrr'r�r�r'r(rr�rJ�r)r|�valuesr�)
rer��typed�kwd_mark�	fasttypesr�r+r��key�itemr'r�r(�	_make_key�s
 r��Fcs~t�t�r�dkrld�nTt��r\t�t�r\�d}�t|��t�}��fdd�|_t||�S�durltd����fdd�}|S)Nrr�cs
��d�S�N�r�r�r'r'r�r'r(�<lambda>�rJzlru_cache.<locals>.<lambda>z=Expected first argument to be an integer, a callable, or Nonecs(t|��t�}��fdd�|_t||�S)Ncs
��d�Sr�r'r'r�r'r(r�rJz8lru_cache.<locals>.decorating_function.<locals>.<lambda>)�_lru_cache_wrapper�
_CacheInfo�cache_parametersr)�
user_functionr!r�r'r(�decorating_functionsz&lru_cache.<locals>.decorating_function)	r��intrh�boolr�r�r�rra)r�r�r�r!r�r'r�r(r�s


�rcs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkrh�
�fdd�}nN�dur����	��
���fdd�}n*���������	�
���
���fdd�}���	�
��
fdd	�}���	�
�
�fd
d�}||_||_|S)N)rr���rFcs�d7��|i|��}|S�Nr�r')rer�r�)r�r�r'r(r!sz#_lru_cache_wrapper.<locals>.wrappercsL�||��}�|��}|�ur*�d7�|S�d7��|i|��}|�|<|Sr�r')rer�r�r�)r�	cache_getr��make_keyr��sentinelr�r�r'r(r!&s
csp�
||��}�	���|�}|dur�|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|Wd�S�d7�Wd�n1s�0Y�|i|��}�	��|�vr�n���r�
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n6�
�}|�
||g}||�<�
�<�|<���k�Wd�n1�sb0Y|Sr�r')rer�r��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTrr��	cache_len�fullr��lockr�r�r�rOr�r�r'r(r!5sB&
*cs8�� �������Wd�S1s*0YdSrr'r')r�r�r�r�r�r�r'r(�
cache_infonsz&_lru_cache_wrapper.<locals>.cache_infocsP��8�����ddg�dd�<d��d�Wd�n1sB0YdS)NrF)�clearr')rr�r�r�r�rOr'r(�cache_clearss
z'_lru_cache_wrapper.<locals>.cache_clear)rDr�r��__len__rr�r�)r�r�r�r�r!r�r�r')r�r�r�r�r�rr�r�r�r�r�r�r�r�rOr�r�r�r(r�s**9	r�)r�cCstdd�|�S)N)r�)r)r�r'r'r(r�srcCs�g}dd�|D�}|s|S|D]2}|d}|D]}||dd�vr.d}qq.qRq|durbtd��|�|�|D]}|d|krp|d=qpqdS)NcSsg|]}|r|�qSr'r'�rE�sr'r'r(�
<listcomp>�rJz_c3_merge.<locals>.<listcomp>rr�zInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqr'r'r(�	_c3_merge�s"
r�Nc
stt|j��D]$\}�t�d�rt|j�|}q8qd}�rDt��ng�t|jd|��}g}t|j|d��}�D]0�t|��rtt�fdd�|jD��st|���qt|D]���	��q��fdd�|D�}�fdd�|D�}�fdd�|D�}	t
|gg|||	|g|g|g�S)	N�__abstractmethods__rc3s|]}t|��VqdSr)�
issubclass)rE�b)�baser'r(rr�sz_c3_mro.<locals>.<genexpr>csg|]}t|�d��qS���abcs��_c3_mro�rEr�r�r'r(r��rJz_c3_mro.<locals>.<listcomp>csg|]}t|�d��qSr�r�r�r�r'r(r��rJcsg|]}t|�d��qSr�r�r�r�r'r(r��rJ)�	enumerate�reversed�	__bases__rir��listr��anyr��remover�)
rHr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr')r�r�r(r��sD
��������r�cs�t�j����fdd���fdd��D���fdd���fdd��D��t���g}�D]�}g}|��D]0}|�vrht�|�rh|��fdd�|jD��qh|s�|�|�qX|jtd	d
�|D] }|D]}||vr�|�|�q�q�qXt�|d�S)Ncs(|�vo&t|d�o&t|t�o&t�|�S)N�__mro__)rir�rr�)�typ)�basesrHr'r(�
is_related�s

��z _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSr'r'�rE�n)r�r'r(r��rJz _compose_mro.<locals>.<listcomp>cs&�D]}||kr||jvrdSqdS)NTF)r�)r�r/)�typesr'r(�is_strict_base�sz$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSr'r'r�)r�r'r(r��rJcsg|]}|�vr|�qSr'r'r�)�type_setr'r(r��rJT)r��reverser�)�setr��__subclasses__r�r��sortr�r�)rHr��mror��found�sub�subclsr')r�rHr�r�r�r�r(�_compose_mro�s*

rcCstt||���}d}|D]R}|dur\||vrX||jvrX||jvrXt||�sXtd�||���qj||vr|}q|�|�S)NzAmbiguous dispatch: {} or {})r�keysr�r�r�r�r�)rH�registryr�match�tr'r'r(�
_find_impls 
���rcs�ddl}ddl}i�|���d����fdd��dd��d�����fdd�	���fdd	�}t|d
d��|�t<�|_�|_|���|_�j	|_
t||�|S)
Nrcsx�dur"t�}�|kr"���|�z�|}WnDtyrz�|}Wntydt|��}Yn0|�|<Yn0|Sr)rr��KeyErrorr)rH�
current_token�impl)�cache_token�dispatch_cacherr'r(�dispatch1sz singledispatch.<locals>.dispatchcSst|t�ot|t�Sr)r�r+rrGr'r'r(�_is_valid_dispatch_typeHsz/singledispatch.<locals>._is_valid_dispatch_typecs����r |dur���fdd�Sn~|dur8td��d���t�di�}|sXtd��d����}dd	lm}tt||�����\}����s�td
|�d��d���|��<�dur�t�d�r�t����	�|S)
Ncs
��|�Srr')�f)rH�registerr'r(r�TrJz2singledispatch.<locals>.register.<locals>.<lambda>z(Invalid first argument to `register()`. z is not a class.rz(Invalid first argument to `register()`: zS. Use either `@register(some_class)` or plain `@register` on an annotated function.r)�get_type_hintszInvalid annotation for z. r�)
rar�typingrr_r]r|rirr�)rHrd�annr�argname)rrrrrrGr(rKs8��
���z singledispatch.<locals>.registercs*|st��d����|dj�|i|��S)Nz( requires at least 1 positional argumentr)rarm)re�kw)r�funcnamer'r(r!sszsingledispatch.<locals>.wrapperrzsingledispatch function)N)r��weakref�WeakKeyDictionaryrrDrr�MappingProxyTyperr��_clear_cacher)rdr�rr!r')rrrrrrrr(rs (
rc@s4eZdZdd�Zd
dd�Zddd�Zedd	��ZdS)r
cCsRt|�s t|d�s t|�d���t|�|_||_t|ttf�rH|j	|_
n||_
dS)Nr�z  is not callable or a descriptor)rhrirar�
dispatcherrdr��staticmethodr��__func__�
_wrapped_func�r.rdr'r'r(rT�s

zsingledispatchmethod.__init__NcCs.t|ttf�rt|jdi�|_|jj||d�S)Nrr�)r�r r�rr!rrr)r.rH�methodr'r'r(r�s	zsingledispatchmethod.registercs0���fdd�}�j|_�j|_t|�j�|S)Ncs(�j�|dj�}|����|i|��SrU)rrrmr�)re�kwargsr$�rHrRr.r'r(r��sz-singledispatchmethod.__get__.<locals>._method)r�rrr")r.rRrHr�r'r&r(r��s
zsingledispatchmethod.__get__cCst|jdd�Sr�r�r�r'r'r(r��sz)singledispatchmethod.__isabstractmethod__)N)N)rrrrTrr�r�r�r'r'r'r(r
�s



r
c@s.eZdZdd�Zdd�Zddd�Zee�ZdS)	rcCs ||_d|_|j|_t�|_dSr)rd�attrnamerrr�r#r'r'r(rT�szcached_property.__init__cCs8|jdur||_n"||jkr4td|j�d|�d���dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r'ra)r.�owner�namer'r'r(�__set_name__�s

���zcached_property.__set_name__Nc	Cs|dur|S|jdurtd��z
|j}Wn6ty^dt|�j�d|j�d�}t|�d�Yn0|�|jt�}|tu�r|j�v|�|jt�}|tur�|�	|�}z|||j<Wn6ty�dt|�j�d|j�d�}t|�d�Yn0Wd�n1s�0Y|S)NzGCannot use cached_property instance without calling __set_name__ on it.zNo '__dict__' attribute on z instance to cache z
 property.zThe '__dict__' attribute on z7 instance does not support item assignment for caching )
r'rarrr+rr��
_NOT_FOUNDr�rd)r.�instancer(r�msg�valr'r'r(r��s:
�
��

��.zcached_property.__get__)N)	rrrrTr*r�r�rr�r'r'r'r(r�s	
r)r�F)N);�__all__�abcr�collectionsr�reprlibr�_threadrr�rrrrrr0r2r3r4r7r8r9r<r=r>rArBrCrKrr�
_functools�ImportErrorrDr^r	r
rr�r�r�r�r��strr�r+r�r�rr�rr�r�rrrr
r+rr'r'r'r(�<module>s�
�
�
�����AJ	�

.t	
-*f5

?>