Your IP : 18.117.254.202


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/functools.cpython-310.opt-2.pyc

o

6��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.lmZWn	e y�Ynwe!�Z"e"fd/d0�Z#zdd1lm#Z#Wn	e y�YnwGd2d3�d3�Z$zdd4lm$Z$Wn	e y�YnwGd5d6�d6e!�Z%d7d8�Z&ed9gd:��Z'Gd;d<�d<e(�Z)e!�fe*e+he,e-e.fd=d>�Z/dWdAdB�Z0dCdD�Z1zddElm1Z1Wn
e �y:YnwdFdG�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	Csf	|D]}zt||�}Wn	tyYqwt|||�q|D]}t||��t||i��q||_|S�N)�getattr�AttributeError�setattr�update�__wrapped__)�wrapper�wrapped�assigned�updated�attr�value�r'�0/opt/alt/python310/lib64/python3.10/functools.pyr#s�rcCs	tt|||d�S)N�r"r#r$)r
rr)r'r'r(rAs�rcC�,	t|��||�}||ur|S|o||kSr��type�__lt__��self�other�NotImplemented�	op_resultr'r'r(�_gt_from_ltY�
r3cC�*	t|��||�}||ur|S|p||kSrr+r.r'r'r(�_le_from_lt`�
r6cC�$	t|��||�}||ur|S|Srr+r.r'r'r(�_ge_from_ltg�
r9cC�,	t|��||�}||ur|S|p||kSr�r,�__le__r.r'r'r(�_ge_from_lenr4r>cC�*	t|��||�}||ur|S|o||kSrr<r.r'r'r(�_lt_from_leur7r@cCr8rr<r.r'r'r(�_gt_from_le|r:rAcCr*r�r,�__gt__r.r'r'r(�_lt_from_gt�r4rDcCr5rrBr.r'r'r(�_ge_from_gt�r7rEcCr8rrBr.r'r'r(�_le_from_gt�r:rFcCr;r�r,�__ge__r.r'r'r(�_le_from_ge�r4rIcCr?rrGr.r'r'r(�_gt_from_ge�r7rJcCr8rrGr.r'r'r(�_lt_from_ge�r:rKrCr=rHr-)r-r=rCrHcsX	�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>�s(z!total_ordering.<locals>.<setcomp>z6must define at least one ordering operation: < > <= >=)�_convert�
ValueError�maxrr)rP�roots�root�opname�opfuncr'rOr(r�s�rcs	G�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�rY)r/rYr'r'r(�__init__�s
zcmp_to_key.<locals>.K.__init__cs�|j|j�dkS�NrrZ�r/r0��mycmpr'r(r-��zcmp_to_key.<locals>.K.__lt__cs�|j|j�dkSr\rZr]r^r'r(rC�r`zcmp_to_key.<locals>.K.__gt__cs�|j|j�dkSr\rZr]r^r'r(�__eq__�r`zcmp_to_key.<locals>.K.__eq__cs�|j|j�dkSr\rZr]r^r'r(r=�r`zcmp_to_key.<locals>.K.__le__cs�|j|j�dkSr\rZr]r^r'r(rH�r`zcmp_to_key.<locals>.K.__ge__N)rrr�	__slots__r[r-rCrar=rH�__hash__r'r^r'r(�K�srd)rL)r_rdr'r^r(r�sr)rcCsT	t|�}|turzt|�}Wntytd�d�w|}|D]}|||�}q |S)Nz0reduce() of empty iterable with no initial value)�iter�_initial_missing�next�
StopIteration�	TypeError)ZfunctionZsequence�initial�itr&Zelementr'r'r(r	�s ���r	)r	csHeZdZ	dZ�fdd�Zdd�Ze�dd��Zdd	�Zd
d�Z	�Z
S)r
)�func�args�keywordsr�__weakref__cs^t|�std��t|d�r|j|}i|j�|�}|j}tt|��|�}||_||_||_|S)Nz#the first argument must be callablerl)	�callableri�hasattrrmrnrl�superr
�__new__)rPrlrmrnr/��	__class__r'r(rss

zpartial.__new__cOs*i|j�|�}|jg|j�|�Ri|��Sr�rnrlrm)r/rmrnr'r'r(�__call__+szpartial.__call__cCs�t|�j}t|j�g}|�dd�|jD��|�dd�|j��D��t|�jdkr6d|�dd�	|��d�S|�dd�	|��d�S)	Ncss�|]}t|�VqdSr)�repr)rM�xr'r'r(�	<genexpr>3��z#partial.__repr__.<locals>.<genexpr>css"�|]\}}|�d|��VqdS)�=Nr'�rM�k�vr'r'r(rz4s� �	functoolsz
functools.�(�, �))
r,rrxrl�extendrmrn�itemsr�join)r/�qualnamermr'r'r(�__repr__/s
zpartial.__repr__cCs*t|�|jf|j|j|jpd|jpdffSr)r,rlrmrnr�r/r'r'r(�
__reduce__9s�zpartial.__reduce__cCs�t|t�s	td��t|�dkrtdt|�����|\}}}}t|�r9t|t�r9|dur0t|t�r9|dur=t|t�s=td��t|�}|durHi}n
t|�turRt|�}|durXi}||_||_||_	||_
dS)Nz(argument to __setstate__ must be a tuple�zexpected 4 items in state, got zinvalid partial state)�
isinstance�tupleri�lenrp�dictr,rrlrmrn)r/�staterlrm�kwds�	namespacer'r'r(�__setstate__=s(

zpartial.__setstate__)rrrrbrsrwrr�r�r��
__classcell__r'r'rtr(r
s
	r
)r
c@sDeZdZ	dd�Zdd�Zdd�Zddd	�Zed
d��Ze	e
�ZdS)
rcOsht|�st|d�std�|���t|t�r)|j|_|j||_i|j�|�|_dS||_||_||_dS)N�__get__z${!r} is not callable or a descriptor)	rprqri�formatr�rrlrmrn)r/rlrmrnr'r'r(r[cs�

zpartialmethod.__init__cCsNd�tt|j��}d�dd�|j��D��}d}|j|jj|jj	|j
||d�S)Nr�css �|]\}}d�||�VqdS)z{}={!r}N)r�r}r'r'r(rzxs��z)partialmethod.__repr__.<locals>.<genexpr>z*{module}.{cls}({func}, {args}, {keywords}))�modulerPrlrmrn)r��maprxrmrnr�r�rurrrl)r/rmrn�
format_stringr'r'r(r�vs
�
�zpartialmethod.__repr__cs�fdd�}�j|_�|_|S)Ncs,i�j�|�}�j|g�j�|�Ri|��Srrv)�cls_or_selfrmrnr�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}|dur4|||�}||jur4t|g|j�Ri|j��}z|j|_Wn	ty3Ynw|dur@|���||�}|S)Nr�)	rrlr
rmrn�__self__rr�r�)r/rYrP�get�result�new_funcr'r'r(r��s

�zpartialmethod.__get__cC�t|jdd�S�Nr�F�rrlr�r'r'r(r���z"partialmethod.__isabstractmethod__r)rrrr[r�r�r��propertyr��classmethodr�__class_getitem__r'r'r'r(r[s

rcCst|t�r
|j}t|t�s|Sr)r�r
rl�rlr'r'r(�_unwrap_partial�s

�r��	CacheInfo)�hits�misses�maxsize�currsizec@s&eZdZ	dZefdd�Zdd�ZdS)�
_HashedSeq�	hashvaluecCs||dd�<||�|_dSr�r�)r/�tup�hashr'r'r(r[�sz_HashedSeq.__init__cCs|jSrr�r�r'r'r(rc�sz_HashedSeq.__hash__N)rrrrbr�r[rcr'r'r'r(r��s
r�c
s�	|}|r||7}|��D]}	||	7}q
|r8||�fdd�|D��7}|r4||�fdd�|��D��7}t|�S||�dkrJ�|d�|vrJ|dSt|�S)Nc3��|]}�|�VqdSrr'�rMr�r,r'r(rz�r{z_make_key.<locals>.<genexpr>c3r�rr'r�r�r'r(rz�r{�r)r��valuesr�)
rmr��typed�kwd_mark�	fasttypesr�r,r��key�itemr'r�r(�	_make_key�s
�r��Fcs�	t�t�r
�dkrd�n*t��r/t�t�r/�d}�t|��t�}��fdd�|_t||�S�dur7td����fdd�}|S)Nrr�c�
��d�S�N�r�r�r'r'r�r'r(�<lambda>�
zlru_cache.<locals>.<lambda>z=Expected first argument to be an integer, a callable, or Nonecs(t|��t�}��fdd�|_t||�S)Ncr�r�r'r'r�r'r(r�r�z8lru_cache.<locals>.decorating_function.<locals>.<lambda>)�_lru_cache_wrapper�
_CacheInfo�cache_parametersr)�
user_functionr!r�r'r(�decorating_functions
z&lru_cache.<locals>.decorating_function)	r��intrp�boolr�r�r�rri)r�r�r�r!r�r'r�r(r�s 
�

�rcs�t��t�d\����i�d�	�
d��j��j�t��
g���ddg�dd�<�dkr4�
�fdd�}n'�durF���	��
���fdd�}n���������	�
���
���fdd�}���	�
��
fdd	�}���	�
�
�fd
d�}||_||_|S)N)rr���rFcs�d7��|i|��}|S�Nr�r')rmr�r�)r�r�r'r(r!sz#_lru_cache_wrapper.<locals>.wrappercsL�||��}�|��}|�ur�d7�|S�d7��|i|��}|�|<|Sr�r')rmr�r�r�)r�	cache_getr��make_keyr��sentinelr�r�r'r(r!'s
cs��
||��}�	�C�|�}|dur@|\}}}}||�<||�<�
�}||�<�
�<||�<�
|�<�d7�|Wd�S�d7�Wd�n1sNwY�|i|��}�	�a|�vrbnK�r��
}	||	�<||	�<|	��
�
�}
�
�}d�
�<�
�<�|
=|	�|<n+�
�}|�
||g}||�<�
�<�|<���k�Wd�|SWd�|SWd�|S1s�wY|Sr�r')rmr�r��linkZ	link_prevZ	link_nextZ_keyr�ZlastZoldrootZoldkeyZ	oldresult)�KEY�NEXT�PREV�RESULTrr��	cache_len�fullr��lockr�r�r�rVr�r�r'r(r!6sX�

�

�$�
�$�
�$�$cs:	���������Wd�S1swYdSrr'r')r�r�r�r�r�r�r'r(�
cache_infoos$�z&_lru_cache_wrapper.<locals>.cache_infocsT	�������ddg�dd�<d��d�Wd�dS1s#wYdS)NrF)�clearr')rr�r�r�r�rVr'r(�cache_clearts"�z'_lru_cache_wrapper.<locals>.cache_clear)rLr�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�rVr�r�r�r(r�
s**9	r�)r�cCs	tdd�|�S)N)r�)r)r�r'r'r(r�srcCs�	g}	dd�|D�}|s|S|D]}|d}|D]}||dd�vr'd}nqnq|dur3td��|�|�|D]}|d|krE|d=q:q)NTcSsg|]}|r|�qSr'r'�rM�sr'r'r(�
<listcomp>�sz_c3_merge.<locals>.<listcomp>rr�zInconsistent hierarchy)�RuntimeError�append)�	sequencesr��s1�	candidate�s2�seqr'r'r(�	_c3_merge�s.��
��r�Nc
s	tt|j��D]\}�t�d�rt|j�|}nqd}�r#t��ng�t|jd|��}g}t|j|d��}�D]�t|��rSt�fdd�|jD��sS|���q;|D]���	��qV�fdd�|D�}�fdd�|D�}�fdd�|D�}	t
|gg|||	|g|g|g�S)	N�__abstractmethods__rc3s�|]}t|��VqdSr)�
issubclass)rM�b)�baser'r(rz�s�

�z_c3_mro.<locals>.<genexpr>c�g|]}t|�d��qS���abcs��_c3_mro�rMr�r�r'r(r���z_c3_mro.<locals>.<listcomp>cr�r�r�r�r�r'r(r��r�cr�r�r�r�r�r'r(r��r�)�	enumerate�reversed�	__bases__rqr��listr��anyr��remover�)
rPr��i�boundary�explicit_bases�abstract_bases�other_bases�explicit_c3_mros�abstract_c3_mros�
other_c3_mrosr')r�r�r(r��sJ
��
��������r�cs�	t�j����fdd���fdd��D���fdd���fdd��D��t���g}�D]C}g}|��D]}|�vrMt�|�rM|��fdd�|jD��q5|sV|�|�q-|jtd	d
�|D]}|D]}||vrn|�|�qcq_q-t�|d�S)Ncs(|�vot|d�ot|t�ot�|�S)N�__mro__)rqr�rr�)�typ)�basesrPr'r(�
is_related�s

��z _compose_mro.<locals>.is_relatedcsg|]}�|�r|�qSr'r'�rM�n)rr'r(r��r�z _compose_mro.<locals>.<listcomp>cs&�D]}||kr||jvrdSqdS)NTF)r)rr0)�typesr'r(�is_strict_base�s
�z$_compose_mro.<locals>.is_strict_basecsg|]}�|�s|�qSr'r'r	)rr'r(r��r�csg|]}|�vr|�qSr'r'r�)�type_setr'r(r��r�T)r��reverser�)�setr�__subclasses__r�r��sortr�r�)rPr�mror�found�sub�subclsr')rrPrrr
rr(�_compose_mro�s4
�

���rcCsv	t||���}d}|D])}|dur/||vr-||jvr-||jvr-t||�s-td�||���n||vr5|}q|�|�S)NzAmbiguous dispatch: {} or {})r�keysrr�r�r�r�)rP�registryr�match�tr'r'r(�
_find_impls"	
���
rcs�	ddl}ddl}i�|���d����fdd��dd��d�����fdd�	���fdd	�}t|d
d��|�t<�|_�|_|���|_�j	|_
t||�|S)
Nrcsz	�durt�}�|kr���|�z�|}W|Sty<z�|}Wnty4t|��}Ynw|�|<Y|Swr)rr��KeyErrorr)rP�
current_token�impl)�cache_token�dispatch_cacherr'r(�dispatch2s$
��
�z singledispatch.<locals>.dispatchcSst|t�o
t|t�Sr)r�r,rrOr'r'r(�_is_valid_dispatch_typeIsz/singledispatch.<locals>._is_valid_dispatch_typecs�	���r|dur��fdd�Sn?|durtd��d���t�di�}|s-td��d����}dd	lm}tt||�����\}����sPtd
|�d��d���|��<�dur`t�d�r`t����	�|S)
Ncs
��|�Srr')�f)rP�registerr'r(r�Ur�z2singledispatch.<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�)
rir�typingr%rgrer�rqrr�)rPrl�annr%�argname)r"rr r$rrOr(r$Ls<���
���z singledispatch.<locals>.registercs*|s	t��d����|dj�|i|��S)Nz( requires at least 1 positional argumentr)riru)rm�kw)r!�funcnamer'r(r!tszsingledispatch.<locals>.wrapperrzsingledispatch functionr)r�weakref�WeakKeyDictionaryrrLr$r!�MappingProxyTyperr��_clear_cacher)rlrr+r!r')r"rr!r r*r$rr(r s"(
rc@s6eZdZ	dd�Zd
dd�Zd
dd�Zedd	��ZdS)r
cCs4t|�st|d�st|�d���t|�|_||_dS)Nr�z  is not callable or a descriptor)rprqrir�
dispatcherrl�r/rlr'r'r(r[�s

zsingledispatchmethod.__init__NcCs	|jj||d�S)Nr�)r/r$)r/rP�methodr'r'r(r$�szsingledispatchmethod.registercs0���fdd�}�j|_�j|_t|�j�|S)Ncs(�j�|dj�}|����|i|��Sr\)r/r!rur�)rm�kwargsr1�rPrYr/r'r(r��sz-singledispatchmethod.__get__.<locals>._method)r�r$rrl)r/rYrPr�r'r3r(r��s
zsingledispatchmethod.__get__cCr�r�r�r�r'r'r(r��r�z)singledispatchmethod.__isabstractmethod__r)rrrr[r$r�r�r�r'r'r'r(r
�s


r
c@s.eZdZdd�Zdd�Zddd�Zee�ZdS)	rcCs ||_d|_|j|_t�|_dSr)rl�attrnamerrr�r0r'r'r(r[�szcached_property.__init__cCs:|jdur
||_dS||jkrtd|j�d|�d���dS)Nz?Cannot assign the same cached_property to two different names (z and z).)r4ri)r/�owner�namer'r'r(�__set_name__�s


����zcached_property.__set_name__Nc	Cs|dur|S|jdurtd��z|j}Wnty-dt|�j�d|j�d�}t|�d�w|�|jt�}|tur�|j�B|�|jt�}|turn|�	|�}z|||j<Wn!tymdt|�j�d|j�d�}t|�d�wWd�|SWd�|S1s�wY|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 )
r4rirrr,rr��
_NOT_FOUNDr�rl)r/�instancer5r�msg�valr'r'r(r��sL
�
��
�
��
��
�
�
�
�
zcached_property.__get__r)	rrrr[r7r�r�rr�r'r'r'r(r�s

	r)r�Fr);�__all__�abcr�collectionsr�reprlibr�_threadrrrrrrrr1r3r6r9r>r@rArDrErFrIrJrKrRrr�
_functools�ImportErrorrLrfr	r
rr�r�r�r�r��strr�r,r�r�rr�rr�r�rrrr
r8rr'r'r'r(�<module>s�

�
��������	A�J	
�
.t�	
-*f(

?>