Your IP : 3.147.54.100


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

o

6��f8T�@s�	ddlmZmZmZmZmZmZmZmZddl	m
Z
mZddlZddl
Z
ddlZeefZgd�Zej�e
�ej�e
�Gdd�de�ZGdd�dej�ZGd	d
�d
e�ZGdd�dej�ZGd
d�d�ZdS)�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardN)
rrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecsBeZdZ	dZddd�Z�fdd�Zdd�Zd	d
�Zej	Z	�Z
S)r)�	_func_ref�
_meth_type�_alive�__weakref__Ncsxz|j}|j}Wntytd�t|���d�w��fdd�}t�|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs.��}|jrd|_�dur�|�dSdSdS�NF)r)�arg�self��callbackZself_wr��./opt/alt/python310/lib64/python3.10/weakref.py�_cb6s�zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�clsZmethr�obj�funcrrrrrr#/s"

���
zWeakMethod.__new__cs2t���}|��}|dus|durdS|�||�S�N)�super�__call__rr)rr%r&��	__class__rrr)Es

zWeakMethod.__call__cCs:t|t�r|jr|js||uSt�||�o|j|jkStSr')�
isinstancerrr�__eq__r�NotImplemented�r�otherrrrr-L�

zWeakMethod.__eq__cCs:t|t�r|jr|js||uSt�||�p|j|jkStSr')r,rrr�__ne__rr.r/rrrr2Sr1zWeakMethod.__ne__r')�__name__�
__module__�__qualname__�	__slots__r#r)r-r2r�__hash__�
__classcell__rrr*rr's
rc@s�eZdZ	d1dd�Zefdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZeZ
dd�Zd2dd�Zdd�Zdd�ZeZdd�Zdd �Zd!d"�Zd#d$�Zd2d%d&�Zd2d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�ZdS)3rrcKsBt|�tfdd�}||_g|_t�|_i|_|j|fi|��dS)NcSs<|�}|dur|jr|j�|j�dS||j|j�dSdSr')�
_iterating�_pending_removals�append�key�data)�wr�selfref�_atomic_removalrrrr�removejs�z,WeakValueDictionary.__init__.<locals>.remove)rr	�_remover:�setr9r=�update)rr0�kwrArrr�__init__is	zWeakValueDictionary.__init__cCs<|jj}|j}	z|�}Wn
tyYdSw|||�qr')r:�popr=�
IndexError)rr@rG�dr<rrr�_commit_removalszs
�
�z$WeakValueDictionary._commit_removalscCs.|jr|��|j|�}|durt|��|Sr'�r:rJr=�KeyError�rr<�orrr�__getitem__�szWeakValueDictionary.__getitem__cCs|jr|��|j|=dSr')r:rJr=�rr<rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|��t|j�Sr')r:rJ�lenr=�rrrr�__len__�s
zWeakValueDictionary.__len__cCs:|jr|��z|j|�}W|duStyYdSwrrKrMrrr�__contains__�s��z WeakValueDictionary.__contains__cC�d|jjt|�fS�Nz<%s at %#x>�r+r3�idrSrrr�__repr__��zWeakValueDictionary.__repr__cCs&|jr|��t||j|�|j|<dSr')r:rJ�KeyedRefrBr=�rr<�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsl|jr|��t�}t|��|j��D]\}}|�}|dur#|||<qWd�|S1s/wY|Sr')r:rJrrr=�items)r�newr<r>rNrrr�copy�s
��
��zWeakValueDictionary.copycCs�ddlm}|jr
|��|��}t|��!|j��D]\}}|�}|dur-|||||�<qWd�|S1s9wY|S�Nr)�deepcopy)rbrdr:rJr+rr=r`)r�memordrar<r>rNrrr�__deepcopy__�s
��
��z WeakValueDictionary.__deepcopy__NcCsJ|jr|��z|j|}Wnty|YSw|�}|dur#|S|Sr'rK)rr<�defaultr>rNrrr�get�s�zWeakValueDictionary.getccsj�|jr|��t|��|j��D]\}}|�}|dur"||fVqWd�dS1s.wYdSr'�r:rJrr=r`)r�kr>�vrrrr`�s�

��"�zWeakValueDictionary.itemsccsb�|jr|��t|��|j��D]\}}|�dur|VqWd�dS1s*wYdSr'ri)rrjr>rrr�keys�s�

��"�zWeakValueDictionary.keysccsP�	|jr	|��t|��|j��EdHWd�dS1s!wYdSr'�r:rJrr=�valuesrSrrr�
itervaluerefs�s�	
"�z!WeakValueDictionary.itervaluerefsccsb�|jr|��t|��|j��D]}|�}|dur|VqWd�dS1s*wYdSr'rm�rr>r%rrrrn�s�
��"�zWeakValueDictionary.valuescCs6|jr|��	|j��\}}|�}|dur||fSqr')r:rJr=�popitem)rr<r>rNrrrrq�s�zWeakValueDictionary.popitemcGsX|jr|��z	|j�|��}Wntyd}Ynw|dur*|r&|dSt|��|S)Nr)r:rJr=rGrL)rr<�argsrNrrrrGs�zWeakValueDictionary.popcCsZz|j|�}Wntyd}Ynw|dur+|jr|��t||j|�|j|<|S|Sr')r=rLr:rJr\rB)rr<rgrNrrr�
setdefaults�zWeakValueDictionary.setdefaultcKsz|jr|��|j}|dur)t|d�st|�}|��D]
\}}t||j|�||<q|��D]
\}}t||j|�||<q-dS�Nr`)r:rJr=�hasattr�dictr`r\rB)rr0�kwargsrIr<rNrrrrD"s
�zWeakValueDictionary.updatecCs	|jr|��t|j���Sr')r:rJ�listr=rnrSrrr�	valuerefs.s	zWeakValueDictionary.valuerefscC�|�|�|Sr'�rDr/rrr�__ior__<�
zWeakValueDictionary.__ior__cC�&t|tj�r|��}|�|�|StSr'�r,�_collections_abc�MappingrbrDr.�rr0�crrr�__or__@�

zWeakValueDictionary.__or__cC�0t|tj�r|��}|�|�|�|�|StSr'�r,r�r�r+rDr.r�rrr�__ror__G�

zWeakValueDictionary.__ror__)rr')r3r4r5rFr	rJrOrQrTrUrZr_rb�__copy__rfrhr`rl�__iter__rornrqrGrsrDryr|r�r�rrrrr]s6
		
			


rcs*eZdZ	dZdd�Z�fdd�Z�ZS)r\�r<cCst�|||�}||_|Sr')rr#r<)r"�obrr<rrrrr#\szKeyedRef.__new__cst��||�dSr')r(rF)rr�rr<r*rrrFa�zKeyedRef.__init__)r3r4r5r6r#rFr8rrr*rr\Ps
	r\c@s�eZdZ	d0dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
d0dd�Zdd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd0d&d'�Zd0d(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)1rNcCsJi|_t|�fdd�}||_g|_t�|_d|_|dur#|�|�dSdS)NcSsL|�}|dur$|jr|j�|�dSz|j|=WdSty#YdSwdSr')r9r:r;r=rL)rjr?rrrrrArs��z*WeakKeyDictionary.__init__.<locals>.removeF)r=rrBr:rCr9�
_dirty_lenrD)rrvrArrrrFps
�zWeakKeyDictionary.__init__cCsP|jj}|j}	z|�}Wn
tyYdSwz||=Wn	ty&Ynwqr')r:rGr=rHrL)rrGrIr<rrrrJ�s
�
��z"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�vr|�qSrr)�.0rj�rIrr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r=r:r�rSrr�r�_scrub_removals�s
z!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS�NT)r�r=rrPrrrrQ�szWeakKeyDictionary.__delitem__cCs|jt|�Sr')r=rrPrrrrO�szWeakKeyDictionary.__getitem__cCs(|jr
|jr
|��t|j�t|j�Sr')r�r:r�rRr=rSrrrrT�szWeakKeyDictionary.__len__cCrVrWrXrSrrrrZ�r[zWeakKeyDictionary.__repr__cCs||jt||j�<dSr')r=rrBr]rrrr_��zWeakKeyDictionary.__setitem__cCs^t�}t|��|j��D]\}}|�}|dur|||<q
Wd�|S1s(wY|Sr')rrr=r`)rrar<r^rNrrrrb�s
��
��zWeakKeyDictionary.copycCsrddlm}|��}t|��!|j��D]\}}|�}|dur&|||�||<qWd�|S1s2wY|Src)rbrdr+rr=r`)rrerdrar<r^rNrrrrf�s
��
��zWeakKeyDictionary.__deepcopy__cCs|j�t|�|�Sr')r=rhr�rr<rgrrrrh�r�zWeakKeyDictionary.getcCs,zt|�}Wn
tyYdSw||jvSr)rr r=)rr<r>rrrrU�s�
zWeakKeyDictionary.__contains__ccs\�t|��|j��D]\}}|�}|dur||fVqWd�dS1s'wYdSr'�rr=r`)rr>r^r<rrrr`�s�

��"�zWeakKeyDictionary.itemsccsP�t|��|jD]}|�}|dur|Vq	Wd�dS1s!wYdSr')rr=rprrrrl�s�

��"�zWeakKeyDictionary.keysccsT�t|��|j��D]\}}|�dur|VqWd�dS1s#wYdSr'r�)rr>r^rrrrn�s�

��"�zWeakKeyDictionary.valuescCs	t|j�Sr')rxr=rSrrr�keyrefs�s
	zWeakKeyDictionary.keyrefscCs.d|_	|j��\}}|�}|dur||fSqr�)r�r=rq)rr<r^rNrrrrq�s�zWeakKeyDictionary.popitemcGsd|_|jjt|�g|�R�Sr�)r�r=rGr)rr<rrrrrrG�szWeakKeyDictionary.popcCs|j�t||j�|�Sr')r=rsrrBr�rrrrs�r�zWeakKeyDictionary.setdefaultcKs`|j}|dur#t|d�sti�|�}|��D]\}}||t||j�<qt|�r.|�|�dSdSrt)r=rur"r`rrBrRrD)rrvrwrIr<r^rrrrD�s
�zWeakKeyDictionary.updatecCrzr'r{r/rrrr|	r}zWeakKeyDictionary.__ior__cCr~r'rr�rrrr�
r�zWeakKeyDictionary.__or__cCr�r'r�r�rrrr�r�zWeakKeyDictionary.__ror__r')r3r4r5rFrJr�rQrOrTrZr_rbr�rfrhrUr`rlr�rnr�rqrGrsrDr|r�r�rrrrres6

	




rc@s�eZdZ	dZiZdZe��ZdZ	dZ
Gdd�d�Zdd�Zddd	�Z
d
d�Zdd
�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)rrFc@seZdZdZdS)zfinalize._Info)�weakrefr&rrrw�atexit�indexN)r3r4r5r6rrrr�_Info6sr�cOsp|jsddl}|�|j�dt_|��}t||�|_||_||_	|p#d|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitr��register�	_exitfuncrr�rr�r&rrrw�next�_index_iterr��	_registry�_dirty)rr%r&rrrwr��inforrrrF9s


zfinalize.__init__NcCs:	|j�|d�}|r|js|j|ji|jpi��SdSdSr')r�rG�	_shutdownr&rrrw)r�_r�rrrr)Js

�zfinalize.__call__cCsN	|j�|�}|o|��}|dur#|j�|d�r%||j|j|jp!ifSdSdSr')r�rhr�rGr&rrrw�rr�r%rrr�detachQs�zfinalize.detachcCs<	|j�|�}|o|��}|dur||j|j|jpifSdSr')r�rhr�r&rrrwr�rrr�peekYs�z
finalize.peekcCs	||jvSr')r�rSrrr�aliveas
zfinalize.alivecCs	|j�|�}t|�o
|jSr'�r�rh�boolr�)rr�rrrr�fszfinalize.atexitcCs"|j�|�}|rt|�|_dSdSr'r�)rr^r�rrrr�ls�cCsZ|j�|�}|o|��}|durdt|�jt|�fSdt|�jt|�t|�jt|�fS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r�rhr�r"r3rYr�rrrrZrs�zfinalize.__repr__cCs2dd�|j��D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)r��r��f�irrrr�~sz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)N�)r�)�itemrrr�<lambda>s
z+finalize._select_for_exit.<locals>.<lambda>r�cSsg|]\}}|�qSrrr�rrrr��s)r�r`�sort)r$�Lrrr�_select_for_exit{szfinalize._select_for_exitcCs�d}zN|jrCddl}|��rd}|��d}	|dustjr%|��}dt_|s(n|��}z|�WntyAt	j
t	���YnwqWdt_|rO|�
�dSdSdt_|r[|�
�ww)NFrT)r��gcZ	isenabledZdisablerr�r�rG�	Exception�sys�
excepthook�exc_infor�Zenable)r$Zreenable_gcr�Zpendingr�rrrr��s<
�����
�zfinalize._exitfuncr')r3r4r5r6r�r��	itertools�countr�r�r�r�rFr)r�r��propertyr�r��setterrZ�classmethodr�r�rrrrrs0



	
r)�_weakrefrrrrrrrr	Z_weakrefsetr
rr�r�r�r
�__all__�Setr��
MutableSetr�MutableMappingrr\rrrrrr�<module>s"(
6t9

?>