ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/weakref.cpython-36.opt-2.pyc

3

��2a�O�
@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	�Zd
d�Zdd
�Zej	Z	�Z
S)r�	_func_ref�
_meth_type�_alive�__weakref__Ncs~y|j}|j}Wn(tk
r8tdjt|���d�YnX��fdd�}tj|||�}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/python36/lib64/python3.6/weakref.py�_cb3s
zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrr)rrrr",s

zWeakMethod.__new__cs2t�j�}|j�}|dks"|dkr&dS|j||�S)N)�super�__call__rr)rr%r&)�	__class__rrr(Bs

zWeakMethod.__call__cCs>t|t�r:|js|jr"||kStj||�o8|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr+Is

zWeakMethod.__eq__cCs>t|t�r:|js|jr"||k	Stj||�p8|j|jkSdS)NT)r*rrr�__ne__r)rr,rrrr-Ps

zWeakMethod.__ne__)rrrr)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),rcst|std��|^}}t|�dkr0tdt|���t|�tf�fdd�	}||_g|_t�|_i|_�|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcs4|�}|dk	r0|jr$|jj|j�n|�|j�dS)N)�
_iterating�_pending_removals�append�key)�wr�selfref�_atomic_removalr)�drr�removems
z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover6�setr5�data�update)�args�kwrr=r)r<r�__init__fs	
zWeakValueDictionary.__init__cCs,|j}|j}x|r&|j�}t||�qWdS)N)r6rA�popr	)r�lr<r8rrr�_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|j�|j|�}|dkr,t|��n|SdS)N)r6rHrA�KeyError)rr8�orrr�__getitem__�s
zWeakValueDictionary.__getitem__cCs|jr|j�|j|=dS)N)r6rHrA)rr8rrr�__delitem__�szWeakValueDictionary.__delitem__cCs|jr|j�t|j�S)N)r6rHr>rA)rrrr�__len__�szWeakValueDictionary.__len__cCs<|jr|j�y|j|�}Wntk
r2dSX|dk	S)NF)r6rHrArI)rr8rJrrr�__contains__�sz WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs&|jr|j�t||j|�|j|<dS)N)r6rH�KeyedRefr?rA)rr8�valuerrr�__setitem__�szWeakValueDictionary.__setitem__cCsF|jr|j�t�}x,|jj�D]\}}|�}|dk	r |||<q W|S)N)r6rHrrA�items)r�newr8r9rJrrr�copy�szWeakValueDictionary.copycCsZddlm}|jr|j�|j�}x2|jj�D]$\}}|�}|dk	r.|||||�<q.W|S)Nr)�deepcopy)rVrWr6rHr)rArT)r�memorWrUr8r9rJrrr�__deepcopy__�sz WeakValueDictionary.__deepcopy__NcCsL|jr|j�y|j|}Wntk
r0|SX|�}|dkrD|S|SdS)N)r6rHrArI)rr8�defaultr9rJrrr�get�szWeakValueDictionary.getc
csV|jr|j�t|��6x.|jj�D] \}}|�}|dk	r$||fVq$WWdQRXdS)N)r6rHrrArT)r�kr9�vrrrrT�s
zWeakValueDictionary.itemsc
csN|jr|j�t|��.x&|jj�D]\}}|�dk	r$|Vq$WWdQRXdS)N)r6rHrrArT)rr\r9rrr�keys�s

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

z!WeakValueDictionary.itervaluerefsc
csN|jr|j�t|��.x&|jj�D]}|�}|dk	r$|Vq$WWdQRXdS)N)r6rHrrAr_)rr9r%rrrr_�s
zWeakValueDictionary.valuescCs<|jr|j�x(|jj�\}}|�}|dk	r||fSqWdS)N)r6rHrA�popitem)rr8r9rJrrrra�szWeakValueDictionary.popitemcGs`|jr|j�y|jj|��}Wntk
r8d}YnX|dkrX|rN|dSt|��n|SdS)Nr)r6rHrArFrI)rr8rCrJrrrrFs

zWeakValueDictionary.popcCs`y|j|�}Wntk
r(d}YnX|dkrX|jr@|j�t||j|�|j|<|S|SdS)N)rArIr6rHrQr?)rr8rZrJrrr�
setdefaults
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkr0tdt|���|r<|dnd}|jrN|j�|j}|dk	r�t|d�srti�|�}x&|j�D]\}}t||j	|�||<q|Wt|�r�|j
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr4z$expected at most 1 arguments, got %drrT)rr>r6rHrA�hasattrr!rTrQr?rB)rC�kwargsr�dictr<r8rJrrrrB s 
zWeakValueDictionary.updatecCs|jr|j�t|jj��S)N)r6rH�listrAr_)rrrr�	valuerefs3s
zWeakValueDictionary.valuerefs)N)N)r.r/r0rErHrKrLrMrNrPrSrV�__copy__rYr[rTr^�__iter__r`r_rarFrbrBrgrrrrrZs,			

			

cs(eZdZdZdd�Z�fdd�Z�ZS)rQr8cCstj|||�}||_|S)N)rr"r8)r!�obrr8rrrrr"NszKeyedRef.__new__cst�j||�dS)N)r'rE)rrjrr8)r)rrrESszKeyedRef.__init__)r8)r.r/r0r1r"rEr3rr)r)rrQBs
rQc@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|j|�dS)NcSs.|�}|dk	r*|jr"|jj|�n|j|=dS)N)r5r6r7rA)r\r:rrrrr=ds
z*WeakKeyDictionary.__init__.<locals>.removeF)rArr?r6r@r5�
_dirty_lenrB)rrer=rrrrEbszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||j�=Wqtk
r4YqXqWdS)N)r6rArFrI)rrGr<rrrrHssz"WeakKeyDictionary._commit_removalscs&|j��fdd�|jD�|_d|_dS)Ncsg|]}|�kr|�qSrr)�.0r\)r<rr�
<listcomp>�sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)rAr6rk)rr)r<r�_scrub_removals�sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rkrAr)rr8rrrrL�szWeakKeyDictionary.__delitem__cCs|jt|�S)N)rAr)rr8rrrrK�szWeakKeyDictionary.__getitem__cCs(|jr|jr|j�t|j�t|j�S)N)rkr6rnr>rA)rrrrrM�szWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.rO)rrrrrP�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)rArr?)rr8rRrrrrS�szWeakKeyDictionary.__setitem__cCs8t�}x,|jj�D]\}}|�}|dk	r|||<qW|S)N)rrArT)rrUr8rRrJrrrrV�szWeakKeyDictionary.copycCsLddlm}|j�}x2|jj�D]$\}}|�}|dk	r |||�||<q W|S)Nr)rW)rVrWr)rArT)rrXrWrUr8rRrJrrrrY�szWeakKeyDictionary.__deepcopy__cCs|jjt|�|�S)N)rAr[r)rr8rZrrrr[�szWeakKeyDictionary.getcCs,yt|�}Wntk
r dSX||jkS)NF)rrrA)rr8r9rrrrN�s
zWeakKeyDictionary.__contains__c
csHt|��6x.|jj�D] \}}|�}|dk	r||fVqWWdQRXdS)N)rrArT)rr9rRr8rrrrT�s

zWeakKeyDictionary.itemsc
cs<t|��*x"|jD]}|�}|dk	r|VqWWdQRXdS)N)rrA)rr9r%rrrr^�s

zWeakKeyDictionary.keysc
cs@t|��.x&|jj�D]\}}|�dk	r|VqWWdQRXdS)N)rrArT)rr9rRrrrr_�s

zWeakKeyDictionary.valuescCs
t|j�S)N)rfrA)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCs4d|_x(|jj�\}}|�}|dk	r||fSqWdS)NT)rkrAra)rr8rRrJrrrra�szWeakKeyDictionary.popitemcGsd|_|jjt|�f|��S)NT)rkrArFr)rr8rCrrrrF�szWeakKeyDictionary.popcCs|jjt||j�|�S)N)rArbrr?)rr8rZrrrrb�szWeakKeyDictionary.setdefaultcKs`|j}|dk	rJt|d�s$ti�|�}x$|j�D]\}}||t||j�<q.Wt|�r\|j|�dS)NrT)rArcr!rTrr?r>rB)rrerdr<r8rRrrrrB�s
zWeakKeyDictionary.update)N)N)N)N)r.r/r0rErHrnrLrKrMrPrSrVrhrYr[rNrTr^rir_rorarFrbrBrrrrrWs,

	

c@s�eZdZfZiZdZej�ZdZ	dZ
Gdd�d�Zdd�Zddd�Z
d	d
�Zdd�Zed
d��Zedd��Zejdd��Zdd�Zedd��Zedd��ZdS)rFc@seZdZdZdS)	zfinalize._Info�weakrefr&rCrd�atexit�indexN)rpr&rCrdrqrr)r.r/r0r1rrrr�_InfosrscOsp|js ddl}|j|j�dt_|j�}t||�|_||_||_	|pFd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitrq�register�	_exitfuncrrsrrpr&rCrd�next�_index_iterrr�	_registry�_dirty)rr%r&rCrdrq�inforrrrEs

zfinalize.__init__NcCs2|jj|d�}|r.|jr.|j|j|jp*i�SdS)N)ryrF�	_shutdownr&rCrd)r�_r{rrrr(szfinalize.__call__cCsH|jj|�}|o|j�}|dk	rD|jj|d�rD||j|j|jp@ifSdS)N)ryr[rprFr&rCrd)rr{r%rrr�detach&szfinalize.detachcCs:|jj|�}|o|j�}|dk	r6||j|j|jp2ifSdS)N)ryr[rpr&rCrd)rr{r%rrr�peek.sz
finalize.peekcCs
||jkS)N)ry)rrrr�alive6szfinalize.alivecCs|jj|�}t|�o|jS)N)ryr[�boolrq)rr{rrrrq;szfinalize.atexitcCs|jj|�}|rt|�|_dS)N)ryr[r�rq)rrRr{rrrrqAscCs^|jj|�}|o|j�}|dkr6dt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)ryr[rpr!r.rO)rr{r%rrrrPGszfinalize.__repr__cCs2dd�|jj�D�}|jdd�d�dd�|D�S)NcSsg|]\}}|jr||f�qSr)rq)rl�f�irrrrmSsz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr4)rr)�itemrrr�<lambda>Tsz+finalize._select_for_exit.<locals>.<lambda>)r8cSsg|]\}}|�qSrr)rlr�r�rrrrmUs)ryrT�sort)r#�Lrrr�_select_for_exitPszfinalize._select_for_exitcCs�d}z�|jr�ddl}|j�r(d}|j�d}x\|dks<tjrJ|j�}dt_|sPP|j�}y
|�Wq.tk
r�t	j
t	j��Yq.Xq.WWddt_|r�|j
�XdS)NFrT)ry�gc�	isenabled�disablerrzr�rF�	Exception�sys�
excepthook�exc_infor|�enable)r#�reenable_gcr��pendingr�rrrrvWs.
zfinalize._exitfunc)N)r.r/r0r1ryr|�	itertools�countrxrzrtrsrEr(r~r�propertyr�rq�setterrP�classmethodr�rvrrrrr�s"
	)�_weakrefrrrrrrrr	�_weakrefsetr
r�collectionsr�r�r
�__all__r�MutableMappingrrQrrrrrr�<module>s (

6i

Zerion Mini Shell 1.0