ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/weakref.cpython-35.opt-2.pyc



���]�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�finalizecsXeZdZdZddd�Z�fdd	�Zd
d�Zdd
�Zej	Z	�S)r�	_func_ref�
_meth_type�_alive�__weakref__Ncs�y|j}|j}Wn0tk
rHtdjt|���d�YnX��fdd�}tj|||�}t||�|_t|�|_	d|_
t|��|S)Nz)argument should be a bound method, not {}cs5��}|jr1d|_�dk	r1�|�dS)NF)r)�arg�self)�callback�self_wr��,/opt/alt/python35/lib64/python3.5/weakref.py�_cb3s
			zWeakMethod.__new__.<locals>._cbT)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrr)rrrr",s	

		zWeakMethod.__new__csGt�j�}|j�}|dks3|dkr7dS|j||�S)N)�super�__call__rr)rr%r&)�	__class__rrr(Bs
zWeakMethod.__call__cCsSt|t�rO|js#|jr-||kStj||�oN|j|jkSdS)NF)�
isinstancerrr�__eq__r)r�otherrrrr+Is

"zWeakMethod.__eq__cCsSt|t�rO|js#|jr-||k	Stj||�pN|j|jkSdS)NT)r*rrr�__ne__r)rr,rrrr-Ps

"zWeakMethod.__ne__)rrrr)
�__name__�
__module__�__qualname__�	__slots__r"r(r+r-r�__hash__rr)r)rr$sc@seZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZeZdd�Z
ddd�Zdd�Zdd�ZeZdd�Zdd�Zd d!�Zd"d#�Zdd$d%�Zd&d'�Zd(d)�ZdS)*rcs�|std��|^}}t|�dkrFtdt|���t|�t�fdd�}||_g|_t�|_i|_�|j	||�dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument�z$expected at most 1 arguments, got %dcsH|�}|dk	rD|jr4|jj|j�n|�|j�dS)N)�
_iterating�_pending_removals�append�key)�wr�selfref�_atomic_removalr)�drr�removems
		z,WeakValueDictionary.__init__.<locals>.remove)
r�lenrr	�_remover5�setr4�data�update)�args�kwrr<r)r;r�__init__fs			
zWeakValueDictionary.__init__cCs<|j}|j}x#|r7|j�}t||�qWdS)N)r5r@�popr	)r�lr;r7rrr�_commit_removals}s
			z$WeakValueDictionary._commit_removalscCsF|jr|j�|j|�}|dkr>t|��n|SdS)N)r5rGr@�KeyError)rr7�orrr�__getitem__�s	
zWeakValueDictionary.__getitem__cCs!|jr|j�|j|=dS)N)r5rGr@)rr7rrr�__delitem__�s	
zWeakValueDictionary.__delitem__cCs |jr|j�t|j�S)N)r5rGr=r@)rrrr�__len__�s	
zWeakValueDictionary.__len__cCsJ|jr|j�y|j|�}Wntk
r?dSYnX|dk	S)NF)r5rGr@rH)rr7rIrrr�__contains__�s	

	z WeakValueDictionary.__contains__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.�id)rrrr�__repr__�szWeakValueDictionary.__repr__cCs3|jr|j�t||j|�|j|<dS)N)r5rG�KeyedRefr>r@)rr7�valuerrr�__setitem__�s	
zWeakValueDictionary.__setitem__cCs_|jr|j�t�}x<|jj�D]+\}}|�}|dk	r,|||<q,W|S)N)r5rGrr@�items)r�newr7r8rIrrr�copy�s	
		zWeakValueDictionary.copycCs{ddlm}|jr#|j�|j�}xE|jj�D]4\}}|�}|dk	r?|||||�<q?W|S)Nr)�deepcopy)rUrVr5rGr)r@rS)r�memorVrTr7r8rIrrr�__deepcopy__�s	
	z WeakValueDictionary.__deepcopy__NcCs^|jr|j�y|j|}Wntk
r<|SYnX|�}|dkrV|S|SdS)N)r5rGr@rH)rr7�defaultr8rIrrr�get�s	

		zWeakValueDictionary.getc
csk|jr|j�t|��Ex=|jj�D],\}}|�}|dk	r0||fVq0WWdQRXdS)N)r5rGrr@rS)r�kr8�vrrrrS�s	

	zWeakValueDictionary.itemsc
cs_|jr|j�t|��9x1|jj�D] \}}|�dk	r0|Vq0WWdQRXdS)N)r5rGrr@rS)rr[r8rrr�keys�s	

zWeakValueDictionary.keysc	cs=|jr|j�t|��|jj�EdHWdQRXdS)N)r5rGrr@�values)rrrr�
itervaluerefs�s
	

z!WeakValueDictionary.itervaluerefsc
cs_|jr|j�t|��9x1|jj�D] }|�}|dk	r0|Vq0WWdQRXdS)N)r5rGrr@r^)rr8r%rrrr^�s	

	zWeakValueDictionary.valuescCsR|jr|j�x8|jj�\}}|�}|dk	r||fSqWdS)N)r5rGr@�popitem)rr7r8rIrrrr`�s	
	zWeakValueDictionary.popitemcGsx|jr|j�y|jj|��}Wntk
rFd}YnX|dkrp|ra|dSt|��n|SdS)Nr)r5rGr@rErH)rr7rBrIrrrrEs	

zWeakValueDictionary.popcCsvy|j|�}Wntk
r.d}YnX|dkrn|jrN|j�t||j|�|j|<|S|SdS)N)r@rHr5rGrPr>)rr7rYrIrrr�
setdefaults
	
zWeakValueDictionary.setdefaultcOs�|std��|^}}t|�dkrFtdt|���|rV|dnd}|jro|j�|j}|dk	r�t|d�s�ti�|�}x3|j�D]%\}}t||j	|�||<q�Wt|�r�|j
|�dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr3z$expected at most 1 arguments, got %drrS)rr=r5rGr@�hasattrr!rSrPr>rA)rB�kwargsr�dictr;r7rIrrrrA s 	
	zWeakValueDictionary.updatecCs&|jr|j�t|jj��S)N)r5rG�listr@r^)rrrr�	valuerefs3s
	
zWeakValueDictionary.valuerefs)r.r/r0rDrGrJrKrLrMrOrRrU�__copy__rXrZrSr]�__iter__r_r^r`rErarArfrrrrrZs,			
			
cs4eZdZdZdd�Z�fdd�Z�S)rPr7cCs"tj|||�}||_|S)N)rr"r7)r!�obrr7rrrrr"Ns	zKeyedRef.__new__cst�j||�dS)N)r'rD)rrirr7)r)rrrDSszKeyedRef.__init__)r7)r.r/r0r1r"rDrr)r)rrPBs
rPc@seZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZeZdd�Z
ddd�Zdd�Zdd�Zdd�ZeZdd�Zd d!�Zd"d#�Zd$d%�Zdd&d'�Zdd(d)�ZdS)*rNcCsbi|_t|�dd�}||_g|_t�|_d|_|dk	r^|j|�dS)NcSs?|�}|dk	r;|jr1|jj|�n
|j|=dS)N)r4r5r6r@)r[r9rrrrr<ds
		z*WeakKeyDictionary.__init__.<locals>.removeF)r@rr>r5r?r4�
_dirty_lenrA)rrdr<rrrrDbs				zWeakKeyDictionary.__init__cCsI|j}|j}x0|rDy||j�=Wqtk
r@YqXqWdS)N)r5r@rErH)rrFr;rrrrGss			
z"WeakKeyDictionary._commit_removalscs5|j��fdd�|jD�|_d|_dS)Ncs"g|]}|�kr|�qSrr)�.0r[)r;rr�
<listcomp>�s	z5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r@r5rj)rr)r;r�_scrub_removals�s	z!WeakKeyDictionary._scrub_removalscCsd|_|jt|�=dS)NT)rjr@r)rr7rrrrK�s	zWeakKeyDictionary.__delitem__cCs|jt|�S)N)r@r)rr7rrrrJ�szWeakKeyDictionary.__getitem__cCs6|jr|jr|j�t|j�t|j�S)N)rjr5rmr=r@)rrrrrL�s
zWeakKeyDictionary.__len__cCsd|jjt|�fS)Nz<%s at %#x>)r)r.rN)rrrrrO�szWeakKeyDictionary.__repr__cCs||jt||j�<dS)N)r@rr>)rr7rQrrrrR�szWeakKeyDictionary.__setitem__cCsLt�}x<|jj�D]+\}}|�}|dk	r|||<qW|S)N)rr@rS)rrTr7rQrIrrrrU�s		zWeakKeyDictionary.copycCshddlm}|j�}xE|jj�D]4\}}|�}|dk	r,|||�||<q,W|S)Nr)rV)rUrVr)r@rS)rrWrVrTr7rQrIrrrrX�s	zWeakKeyDictionary.__deepcopy__cCs|jjt|�|�S)N)r@rZr)rr7rYrrrrZ�szWeakKeyDictionary.getcCs6yt|�}Wntk
r(dSYnX||jkS)NF)rrr@)rr7r8rrrrM�s

	zWeakKeyDictionary.__contains__c
csXt|��Ex=|jj�D],\}}|�}|dk	r||fVqWWdQRXdS)N)rr@rS)rr8rQr7rrrrS�s

	zWeakKeyDictionary.itemsc
csFt|��3x+|jD] }|�}|dk	r|VqWWdQRXdS)N)rr@)rr8r%rrrr]�s

	zWeakKeyDictionary.keysc
csLt|��9x1|jj�D] \}}|�dk	r|VqWWdQRXdS)N)rr@rS)rr8rQrrrr^�s
zWeakKeyDictionary.valuescCs
t|j�S)N)rer@)rrrr�keyrefs�s
zWeakKeyDictionary.keyrefscCsHd|_x8|jj�\}}|�}|dk	r||fSqWdS)NT)rjr@r`)rr7rQrIrrrr`�s		zWeakKeyDictionary.popitemcGs"d|_|jjt|�|�S)NT)rjr@rEr)rr7rBrrrrE�s	zWeakKeyDictionary.popcCs|jjt||j�|�S)N)r@rarr>)rr7rYrrrra�szWeakKeyDictionary.setdefaultcKs�|j}|dk	rit|d�s6ti�|�}x0|j�D]"\}}||t||j�<qCWt|�r�|j|�dS)NrS)r@rbr!rSrr>r=rA)rrdrcr;r7rQrrrrA�s	zWeakKeyDictionary.update)r.r/r0rDrGrmrKrJrLrOrRrUrgrXrZrMrSr]rhr^rnr`rErarArrrrr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&rBrc�atexit�indexN)ror&rBrcrprq)r.r/r0r1rrrr�_InfosrrcOs�|js.ddl}|j|j�dt_|j�}t||�|_||_||_	|pgd|_
d|_t|j�|_
||j|<dt_dS)NrT)�_registered_with_atexitrp�register�	_exitfuncrrrrror&rBrc�next�_index_iterrq�	_registry�_dirty)rr%r&rBrcrp�inforrrrDs					
zfinalize.__init__NcCsE|jj|d�}|rA|jrA|j|j|jp=i�SdS)N)rxrE�	_shutdownr&rBrc)r�_rzrrrr(szfinalize.__call__cCsh|jj|�}|o!|j�}|dk	rd|jj|d�rd||j|j|jp`ifSdS)N)rxrZrorEr&rBrc)rrzr%rrr�detach&s!zfinalize.detachcCsS|jj|�}|o!|j�}|dk	rO||j|j|jpKifSdS)N)rxrZror&rBrc)rrzr%rrr�peek.sz
finalize.peekcCs
||jkS)N)rx)rrrr�alive6szfinalize.alivecCs%|jj|�}t|�o$|jS)N)rxrZ�boolrp)rrzrrrrp;szfinalize.atexitcCs+|jj|�}|r't|�|_dS)N)rxrZr�rp)rrQrzrrrrpAscCs�|jj|�}|o!|j�}|dkrMdt|�jt|�fSdt|�jt|�t|�jt|�fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rxrZror!r.rN)rrzr%rrrrOGszfinalize.__repr__cCsCdd�|jj�D�}|jddd��dd�|D�S)NcSs+g|]!\}}|jr||f�qSr)rp)rk�f�irrrrlSs	z-finalize._select_for_exit.<locals>.<listcomp>r7cSs|djS)Nr3)rq)�itemrrr�<lambda>Tsz+finalize._select_for_exit.<locals>.<lambda>cSsg|]\}}|�qSrr)rkr�r�rrrrlUs	)rxrS�sort)r#�Lrrr�_select_for_exitPszfinalize._select_for_exitcCs�d}z�|jr�ddl}|j�r:d}|j�d}xt|dksXtjrm|j�}dt_|stP|j�}y|�WqCtk
r�t	j
t	j��YqCXqCWWddt_|r�|j
�XdS)NFrT)rx�gc�	isenabled�disablerryr�rE�	Exception�sys�
excepthook�exc_infor{�enable)r#�reenable_gcr��pendingr�rrrruWs.	
	
	zfinalize._exitfunc)r.r/r0r1rxr{�	itertools�countrwryrsrrrDr(r}r~�propertyrrp�setterrO�classmethodr�rurrrrr�s"	)�_weakrefrrrrrrrr	�_weakrefsetr
r�collectionsr�r�r
�__all__r�MutableMappingrrPrrrrrr�<module>s:
		6��

Zerion Mini Shell 1.0