Your IP : 3.21.105.222


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

a

R�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�finalizecs@eZdZdZddd�Z�fdd�Zdd�Zd	d
�Zej	Z	�Z
S)r)�	_func_ref�
_meth_type�_alive�__weakref__Ncs|z|j}|j}Wn&ty6td�t|���d�Yn0��fdd�}t�|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dur"�|�dS�NF)r)�arg�self��callbackZself_wr��,/opt/alt/python39/lib64/python3.9/weakref.py�_cb6s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�clsZmethr�obj�funcrrrrrr#/s 
��
zWeakMethod.__new__cs2t���}|��}|dus"|dur&dS|�||�S�N)�super�__call__rr)rr%r&��	__class__rrr)Es

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

zWeakMethod.__eq__cCs:t|t�r6|jr|js||uSt�||�p4|j|jkStSr')r,rrr�__ne__rr.r/rrrr1Ss

zWeakMethod.__ne__)N)�__name__�
__module__�__qualname__�	__slots__r#r)r-r1r�__hash__�
__classcell__rrr*rr's
rc@s�eZdZd1dd�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$�Zd3d%d&�Zd4d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�ZdS)5rrcKsBt|�tfdd�}||_g|_t�|_i|_|j|fi|��dS)NcSs6|�}|dur2|jr$|j�|j�n||j|j�dSr')�
_iterating�_pending_removals�append�key�data)�wr�selfref�_atomic_removalrrrr�removejs
z,WeakValueDictionary.__init__.<locals>.remove)rr	�_remover9�setr8r<�update)rr0�kwr@rrr�__init__is	zWeakValueDictionary.__init__cCs>|jj}|j}z
|�}Wnty,YdS0|||�qdSr')r9�popr<�
IndexError)rr?rF�dr;rrr�_commit_removalszs
z$WeakValueDictionary._commit_removalscCs4|jr|��|j|�}|dur,t|��n|SdSr'�r9rIr<�KeyError�rr;�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|��|j|=dSr')r9rIr<�rr;rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|��t|j�Sr')r9rI�lenr<�rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|��z|j|�}Wnty2YdS0|duSrrJrLrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS�Nz<%s at %#x>�r+r2�idrRrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|��t||j|�|j|<dSr')r9rI�KeyedRefrAr<�rr;�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsj|jr|��t�}t|��:|j��D]\}}|�}|dur(|||<q(Wd�n1s\0Y|Sr')r9rIrrr<�items)r�newr;r=rMrrr�copy�s
(zWeakValueDictionary.copycCs~ddlm}|jr|��|��}t|��@|j��D]$\}}|�}|dur6|||||�<q6Wd�n1sp0Y|S�Nr)�deepcopy)r_rar9rIr+rr<r])r�memorar^r;r=rMrrr�__deepcopy__�s
.z WeakValueDictionary.__deepcopy__NcCsN|jr|��z|j|}Wnty2|YS0|�}|durF|S|SdSr'rJ)rr;�defaultr=rMrrr�get�s
zWeakValueDictionary.getccsf|jr|��t|��<|j��D] \}}|�}|dur"||fVq"Wd�n1sX0YdSr'�r9rIrr<r])r�kr=�vrrrr]�s
zWeakValueDictionary.itemsccs^|jr|��t|��4|j��D]\}}|�dur"|Vq"Wd�n1sP0YdSr'rf)rrgr=rrr�keys�s

zWeakValueDictionary.keysccsJ|jr|��t|�� |j��EdHWd�n1s<0YdSr'�r9rIrr<�valuesrRrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsccs^|jr|��t|��4|j��D]}|�}|dur"|Vq"Wd�n1sP0YdSr'rj�rr=r%rrrrk�s
zWeakValueDictionary.valuescCs8|jr|��|j��\}}|�}|dur||fSqdSr')r9rIr<�popitem)rr;r=rMrrrrn�szWeakValueDictionary.popitemcGs^|jr|��z|j�|��}Wnty6d}Yn0|durV|rL|dSt|��n|SdS)Nr)r9rIr<rFrK)rr;�argsrMrrrrFs

zWeakValueDictionary.popcCs^z|j|�}Wnty&d}Yn0|durV|jr>|��t||j|�|j|<|S|SdSr')r<rKr9rIrYrA)rr;rdrMrrr�
setdefaults
zWeakValueDictionary.setdefaultcKsz|jr|��|j}|durRt|d�s.t|�}|��D]\}}t||j|�||<q6|��D]\}}t||j|�||<qZdS�Nr])r9rIr<�hasattr�dictr]rYrA)rr0�kwargsrHr;rMrrrrC"s
zWeakValueDictionary.updatecCs|jr|��t|j���Sr')r9rI�listr<rkrRrrr�	valuerefs.s
zWeakValueDictionary.valuerefscCs|�|�|Sr'�rCr/rrr�__ior__<s
zWeakValueDictionary.__ior__cCs&t|tj�r"|��}|�|�|StSr'�r,�_collections_abc�Mappingr_rCr.�rr0�crrr�__or__@s

zWeakValueDictionary.__or__cCs0t|tj�r,|��}|�|�|�|�|StSr'�r,rzr{r+rCr.r|rrr�__ror__Gs

zWeakValueDictionary.__ror__)r)N)N)N)r2r3r4rEr	rIrNrPrSrTrXr\r_�__copy__rcrer]ri�__iter__rlrkrnrFrprCrvrxr~r�rrrrr]s2
		
			

rcs(eZdZdZdd�Z�fdd�Z�ZS)rY�r;cCst�|||�}||_|Sr')rr#r;)r"�obrr;rrrrr#\szKeyedRef.__new__cst��||�dSr')r(rE)rr�rr;r*rrrEaszKeyedRef.__init__)r2r3r4r5r#rEr7rrr*rrYPs
rYc@s�eZdZd0dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
d1dd�Zdd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd2d&d'�Zd3d(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)4rNcCsFi|_t|�fdd�}||_g|_t�|_d|_|durB|�|�dS)NcSsF|�}|durB|jr"|j�|�n z|j|=Wnty@Yn0dSr')r8r9r:r<rK)rgr>rrrrr@rsz*WeakKeyDictionary.__init__.<locals>.removeF)r<rrAr9rBr8�
_dirty_lenrC)rrsr@rrrrEps
zWeakKeyDictionary.__init__cCsR|jj}|j}z
|�}Wnty,YdS0z
||=WqtyJYq0qdSr')r9rFr<rGrK)rrFrHr;rrrrI�s

z"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�vr|�qSrr)�.0rg�rHrr�
<listcomp>��z5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r<r9r�rRrr�r�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS�NT)r�r<rrOrrrrP�szWeakKeyDictionary.__delitem__cCs|jt|�Sr')r<rrOrrrrN�szWeakKeyDictionary.__getitem__cCs(|jr|jr|��t|j�t|j�Sr')r�r9r�rQr<rRrrrrS�szWeakKeyDictionary.__len__cCsd|jjt|�fSrUrVrRrrrrX�szWeakKeyDictionary.__repr__cCs||jt||j�<dSr')r<rrArZrrrr\�szWeakKeyDictionary.__setitem__cCs\t�}t|��:|j��D]\}}|�}|dur|||<qWd�n1sN0Y|Sr')rrr<r])rr^r;r[rMrrrr_�s
(zWeakKeyDictionary.copycCspddlm}|��}t|��@|j��D]$\}}|�}|dur(|||�||<q(Wd�n1sb0Y|Sr`)r_rar+rr<r])rrbrar^r;r[rMrrrrc�s
.zWeakKeyDictionary.__deepcopy__cCs|j�t|�|�Sr')r<rer�rr;rdrrrre�szWeakKeyDictionary.getcCs,zt|�}Wnty YdS0||jvSr)rr r<)rr;r=rrrrT�s
zWeakKeyDictionary.__contains__ccsXt|��<|j��D] \}}|�}|dur||fVqWd�n1sJ0YdSr'�rr<r])rr=r[r;rrrr]�s

zWeakKeyDictionary.itemsccsLt|��0|jD]}|�}|dur|VqWd�n1s>0YdSr')rr<rmrrrri�s


zWeakKeyDictionary.keysccsPt|��4|j��D]\}}|�dur|VqWd�n1sB0YdSr'r�)rr=r[rrrrk�s

zWeakKeyDictionary.valuescCs
t|j�Sr')rur<rRrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs0d|_|j��\}}|�}|dur||fSqdSr�)r�r<rn)rr;r[rMrrrrn�s
zWeakKeyDictionary.popitemcGsd|_|jjt|�g|�R�Sr�)r�r<rFr)rr;rorrrrF�szWeakKeyDictionary.popcCs|j�t||j�|�Sr')r<rprrAr�rrrrp�szWeakKeyDictionary.setdefaultcKs\|j}|durFt|d�s$ti�|�}|��D]\}}||t||j�<q,t|�rX|�|�dSrq)r<rrr"r]rrArQrC)rrsrtrHr;r[rrrrC�s
zWeakKeyDictionary.updatecCs|�|�|Sr'rwr/rrrrx	s
zWeakKeyDictionary.__ior__cCs&t|tj�r"|��}|�|�|StSr'ryr|rrrr~
s

zWeakKeyDictionary.__or__cCs0t|tj�r,|��}|�|�|�|�|StSr'rr|rrrr�s

zWeakKeyDictionary.__ror__)N)N)N)N)r2r3r4rErIr�rPrNrSrXr\r_r�rcrerTr]rir�rkr�rnrFrprCrxr~r�rrrrres2
	




rc@s�eZdZdZiZdZe��ZdZ	dZ
Gdd�d�Zdd�Zddd	�Z
d
d�Zdd
�Zedd��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)rrFc@seZdZdZdS)zfinalize._Info)�weakrefr&rort�atexit�indexN)r2r3r4r5rrrr�_Info6sr�cOsp|js ddl}|�|j�dt_|��}t||�|_||_||_	|pFd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitr��register�	_exitfuncrr�rr�r&rort�next�_index_iterr��	_registry�_dirty)rr%r&rortr��inforrrrE9s

zfinalize.__init__NcCs4|j�|d�}|r0|js0|j|ji|jp*i��SdSr')r�rF�	_shutdownr&rort)r�_r�rrrr)Js
zfinalize.__call__cCsH|j�|�}|o|��}|durD|j�|d�rD||j|j|jp@ifSdSr')r�rer�rFr&rort�rr�r%rrr�detachQszfinalize.detachcCs:|j�|�}|o|��}|dur6||j|j|jp2ifSdSr')r�rer�r&rortr�rrr�peekYsz
finalize.peekcCs
||jvSr')r�rRrrr�aliveaszfinalize.alivecCs|j�|�}t|�o|jSr'�r�re�boolr�)rr�rrrr�fszfinalize.atexitcCs|j�|�}|rt|�|_dSr'r�)rr[r�rrrr�lscCs^|j�|�}|o|��}|dur6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r�rer�r"r2rWr�rrrrXrs�zfinalize.__repr__cCs2dd�|j��D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)r��r��f�irrrr�~r�z-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)N�)r�)�itemrrr�<lambda>r�z+finalize._select_for_exit.<locals>.<lambda>r�cSsg|]\}}|�qSrrr�rrrr��r�)r�r]�sort)r$�Lrrr�_select_for_exit{szfinalize._select_for_exitcCs�d}z�|jr�ddl}|��r(d}|��d}|dus:tjrH|��}dt_|sNq�|��}z
|�Wq,ty�t	j
t	���Yq,0q,Wdt_|r�|�
�ndt_|r�|�
�0dS)NFrT)r��gcZ	isenabledZdisablerr�r�rF�	Exception�sys�
excepthook�exc_infor�Zenable)r$Zreenable_gcr�Zpendingr�rrrr��s2

�zfinalize._exitfunc)N)r2r3r4r5r�r��	itertools�countr�r�r�r�rEr)r�r��propertyr�r��setterrX�classmethodr�r�rrrrrs,



	
r)�_weakrefrrrrrrrr	Z_weakrefsetr
rrzr�r�r
�__all__�Setr��
MutableSetr�MutableMappingrrYrrrrrr�<module>s(
6t9

?>