AlkantarClanX12

Your IP : 18.117.71.213


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/weakref.cpython-37.opt-2.pyc

B

YI~dT�
@s�ddlmZmZmZmZmZmZmZmZddl	m
Z
mZddlZddl
Z
ddlZeefZdddddd	d
ddd
dddg
ZGdd�de�ZGdd
�d
ej�ZGdd�de�ZGdd�dej�ZGdd�d�ZdS)�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardNrrrr�WeakKeyDictionaryrrr�
ProxyTypes�WeakValueDictionaryr
�
WeakMethod�finalizecs@eZdZdZddd�Z�fdd�Zdd�Zd	d
�Zej	Z	�Z
S)r)�	_func_ref�
_meth_type�_alive�__weakref__Ncs~y|j}|j}Wn(tk
r8td�t|���d�YnX��fdd�}t�|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs&��}|jr"d|_�dk	r"�|�dS)NF)r)�arg�self)�callback�self_wr��,/opt/alt/python37/lib64/python3.7/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�clsZmethr�obj�funcrrr)rrrr",s

zWeakMethod.__new__cs2t���}|��}|dks"|dkr&dS|�||�S)N)�super�__call__rr)rr$r%)�	__class__rrr'Bs

zWeakMethod.__call__cCs:t|t�r6|jr|js||kSt�||�o4|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr*Is

zWeakMethod.__eq__cCs:t|t�r6|jr|js||k	St�||�p4|j|jkSdS)NT)r)rrr�__ne__r)rr+rrrr,Ps

zWeakMethod.__ne__)N)�__name__�
__module__�__qualname__�	__slots__r"r'r*r,r�__hash__�
__classcell__rr)r(rr$s
c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZeZdd�Z
d*dd�Zdd�Zdd�ZeZdd�Zdd�Zd d!�Zd"d#�Zd+d$d%�Zd&d'�Zd(d)�ZdS),rcOsl|std��|^}}t|�dkr0tdt|���t|�tfdd�}||_g|_t�|_i|_|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcSs6|�}|dk	r2|jr$|j�|j�n||j|j�dS)N)�
_iterating�_pending_removals�append�key�data)�wr�selfrefZ_atomic_removalrrrr�removems
z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover5�setr4r8�update)�args�kwrr;rrr�__init__fs	zWeakValueDictionary.__init__cCs,|j}|j}x|r&|��}t||�qWdS)N)r5r8�popr	)r�l�dr7rrr�_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|��|j|�}|dkr,t|��n|SdS)N)r5rFr8�KeyError)rr7�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|��|j|=dS)N)r5rFr8)rr7rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|��t|j�S)N)r5rFr<r8)rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|��y|j|�}Wntk
r2dSX|dk	S)NF)r5rFr8rG)rr7rHrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r(r-�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|��t||j|�|j|<dS)N)r5rF�KeyedRefr=r8)rr7�valuerrr�__setitem__�szWeakValueDictionary.__setitem__c	CsZ|jr|��t�}t|��4x,|j��D]\}}|�}|dk	r*|||<q*WWdQRX|S)N)r5rFrrr8�items)r�newr7r9rHrrr�copy�s
zWeakValueDictionary.copyc	Csnddlm}|jr|��|��}t|��:x2|j��D]$\}}|�}|dk	r8|||||�<q8WWdQRX|S)Nr)�deepcopy)rTrUr5rFr(rr8rR)r�memorUrSr7r9rHrrr�__deepcopy__�s
z WeakValueDictionary.__deepcopy__NcCsL|jr|��y|j|}Wntk
r0|SX|�}|dkrD|S|SdS)N)r5rFr8rG)rr7�defaultr9rHrrr�get�szWeakValueDictionary.getc	csV|jr|��t|��6x.|j��D] \}}|�}|dk	r$||fVq$WWdQRXdS)N)r5rFrr8rR)r�kr9�vrrrrR�s
zWeakValueDictionary.itemsc	csN|jr|��t|��.x&|j��D]\}}|�dk	r$|Vq$WWdQRXdS)N)r5rFrr8rR)rrZr9rrr�keys�s

zWeakValueDictionary.keysc	cs6|jr|��t|��|j��EdHWdQRXdS)N)r5rFrr8�values)rrrr�
itervaluerefs�s

z!WeakValueDictionary.itervaluerefsc	csN|jr|��t|��.x&|j��D]}|�}|dk	r$|Vq$WWdQRXdS)N)r5rFrr8r])rr9r$rrrr]�s
zWeakValueDictionary.valuescCs<|jr|��x(|j��\}}|�}|dk	r||fSqWdS)N)r5rFr8�popitem)rr7r9rHrrrr_�szWeakValueDictionary.popitemcGs`|jr|��y|j�|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r5rFr8rCrG)rr7r@rHrrrrCs

zWeakValueDictionary.popcCs`y|j|�}Wntk
r(d}YnX|dkrX|jr@|��t||j|�|j|<|S|SdS)N)r8rGr5rFrOr=)rr7rXrHrrr�
setdefaults
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|jrN|��|j}|dk	r�t|d�srti�|�}x&|��D]\}}t||j	|�||<q|Wt|�r�|�
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr3z$expected at most 1 arguments, got %drrR)rr<r5rFr8�hasattrr!rRrOr=r?)r@�kwargsr�dictrEr7rHrrrr?"s 
zWeakValueDictionary.updatecCs|jr|��t|j���S)N)r5rF�listr8r])rrrr�	valuerefs5s
zWeakValueDictionary.valuerefs)N)N)r-r.r/rBrFrIrJrKrLrNrQrT�__copy__rWrYrRr\�__iter__r^r]r_rCr`r?rerrrrrZs,			
			

cs(eZdZdZdd�Z�fdd�Z�ZS)rO)r7cCst�|||�}||_|S)N)rr"r7)r!�obrr7rrrrr"PszKeyedRef.__new__cst��||�dS)N)r&rB)rrhrr7)r(rrrBUszKeyedRef.__init__)r-r.r/r0r"rBr2rr)r(rrODs
rOc@s�eZdZd*dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
d+dd�Zdd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zd,d&d'�Zd-d(d)�ZdS).rNcCsFi|_t|�fdd�}||_g|_t�|_d|_|dk	rB|�|�dS)NcSs.|�}|dk	r*|jr"|j�|�n|j|=dS)N)r4r5r6r8)rZr:rrrrr;fs
z*WeakKeyDictionary.__init__.<locals>.removeF)r8rr=r5r>r4�
_dirty_lenr?)rrcr;rrrrBdszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||��=Wqtk
r4YqXqWdS)N)r5r8rCrG)rrDrErrrrFusz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0rZ)rErr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r8r5ri)rr)rEr�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rir8r)rr7rrrrJ�szWeakKeyDictionary.__delitem__cCs|jt|�S)N)r8r)rr7rrrrI�szWeakKeyDictionary.__getitem__cCs(|jr|jr|��t|j�t|j�S)N)rir5rlr<r8)rrrrrK�szWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r(r-rM)rrrrrN�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)r8rr=)rr7rPrrrrQ�szWeakKeyDictionary.__setitem__c	CsLt�}t|��4x,|j��D]\}}|�}|dk	r|||<qWWdQRX|S)N)rrr8rR)rrSr7rPrHrrrrT�s
zWeakKeyDictionary.copyc	Cs`ddlm}|��}t|��:x2|j��D]$\}}|�}|dk	r*|||�||<q*WWdQRX|S)Nr)rU)rTrUr(rr8rR)rrVrUrSr7rPrHrrrrW�s
zWeakKeyDictionary.__deepcopy__cCs|j�t|�|�S)N)r8rYr)rr7rXrrrrY�szWeakKeyDictionary.getcCs,yt|�}Wntk
r dSX||jkS)NF)rrr8)rr7r9rrrrL�s
zWeakKeyDictionary.__contains__c	csHt|��6x.|j��D] \}}|�}|dk	r||fVqWWdQRXdS)N)rr8rR)rr9rPr7rrrrR�s

zWeakKeyDictionary.itemsc	cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rr8)rr9r$rrrr\�s

zWeakKeyDictionary.keysc	cs@t|��.x&|j��D]\}}|�dk	r|VqWWdQRXdS)N)rr8rR)rr9rPrrrr]�s

zWeakKeyDictionary.valuescCs
t|j�S)N)rdr8)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs4d|_x(|j��\}}|�}|dk	r||fSqWdS)NT)rir8r_)rr7rPrHrrrr_�szWeakKeyDictionary.popitemcGsd|_|jjt|�f|��S)NT)rir8rCr)rr7r@rrrrC�szWeakKeyDictionary.popcCs|j�t||j�|�S)N)r8r`rr=)rr7rXrrrr`�szWeakKeyDictionary.setdefaultcKs`|j}|dk	rJt|d�s$ti�|�}x$|��D]\}}||t||j�<q.Wt|�r\|�|�dS)NrR)r8rar!rRrr=r<r?)rrcrbrEr7rPrrrr?�s
zWeakKeyDictionary.update)N)N)N)N)r-r.r/rBrFrlrJrIrKrNrQrTrfrWrYrLrRr\rgr]rmr_rCr`r?rrrrrYs,

	


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%r@rb�atexit�indexN)r-r.r/r0rrrr�_InfosrqcOst|�dkr|^}}}}nz|s(td��nld|krDtdt|�d��|�d�}t|�dkrf|^}}}n.d|kr�tdt|�d��|�d�}|^}}t|�}|js�ddl}|�|j�d	t_|�	�}t
||�|_||_||_
|p�d|_d	|_t|j�|_||j|<d	t_dS)
N�z<descriptor '__init__' of 'finalize' object needs an argumentr%z9finalize expected at least 2 positional arguments, got %dr3�r$rT)r<rrC�tuple�_registered_with_atexitro�register�	_exitfuncrrqrrnr%r@rb�next�_index_iterrp�	_registry�_dirty)r@rbrr$r%ro�inforrrrBs:




zfinalize.__init__NcCs0|j�|d�}|r,|js,|j|j|jp(i�SdS)N)rzrC�	_shutdownr%r@rb)r�_r|rrrr'7s
zfinalize.__call__cCsH|j�|�}|o|��}|dk	rD|j�|d�rD||j|j|jp@ifSdS)N)rzrYrnrCr%r@rb)rr|r$rrr�detach>szfinalize.detachcCs:|j�|�}|o|��}|dk	r6||j|j|jp2ifSdS)N)rzrYrnr%r@rb)rr|r$rrr�peekFsz
finalize.peekcCs
||jkS)N)rz)rrrr�aliveNszfinalize.alivecCs|j�|�}t|�o|jS)N)rzrY�boolro)rr|rrrroSszfinalize.atexitcCs|j�|�}|rt|�|_dS)N)rzrYr�ro)rrPr|rrrroYscCs^|j�|�}|o|��}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rzrYrnr!r-rM)rr|r$rrrrN_szfinalize.__repr__cCs2dd�|j��D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)ro)rj�f�irrrrkksz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr3)rp)�itemrrr�<lambda>l�z+finalize._select_for_exit.<locals>.<lambda>)r7cSsg|]\}}|�qSrr)rjr�r�rrrrkms)rzrR�sort)r#�Lrrr�_select_for_exithszfinalize._select_for_exitcCs�d}z�|jr�ddl}|��r(d}|��d}x\|dks<tjrJ|��}dt_|sPP|��}y
|�Wq.tk
r�t	j
t	���Yq.Xq.WWddt_|r�|�
�XdS)NFrT)rz�gcZ	isenabledZdisablerr{r�rC�	Exception�sys�
excepthook�exc_infor}Zenable)r#Zreenable_gcr�Zpendingr�rrrrwos.
zfinalize._exitfunc)N)r-r.r/r0rzr}�	itertools�countryr{rurqrBr'rr��propertyr�ro�setterrN�classmethodr�rwrrrrr�s"%
	)�_weakrefrrrrrrrr	Z_weakrefsetr
r�_collections_abcr�r�r
�__all__r�MutableMappingrrOrrrrrr�<module>s (

6k