Hacked By AnonymousFox

Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/weakref.pyo

�
zfc@s�dZddlZddlmZmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
ddlmZeefZdddd	d
ddd
ddddgZdejfd��YZdefd��YZd
ejfd��YZdS(s{Weak reference support for Python.

This module is an implementation of PEP 205:

http://www.python.org/dev/peps/pep-0205/
i����N(tgetweakrefcounttgetweakrefstreftproxytCallableProxyTypet	ProxyTypet
ReferenceTypet_remove_dead_weakref(tWeakSett_IterationGuard(tReferenceErrorRRRRtWeakKeyDictionaryR
RRRt
ProxyTypestWeakValueDictionaryRcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZeZ
d�Zdd�Zd
�Zd�Zd�ZeZd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�ZRS(s�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    cOs�|std��n|d}|d}t|�dkrTtdt|���nt|�td�}||_g|_t�|_tjj	|||�dS(NsGdescriptor '__init__' of 'WeakValueDictionary' object needs an argumentiis$expected at most 1 arguments, got %dcSsN|�}|dk	rJ|jr4|jj|j�qJ||j|j�ndS(N(tNonet
_iteratingt_pending_removalstappendtkeytdata(twrtselfreft_atomic_removaltself((s/usr/lib64/python2.7/weakref.pytremove8s
		(
t	TypeErrortlenRRt_removeRtsetRtUserDictt__init__(targstkwRR((s/usr/lib64/python2.7/weakref.pyR0s

			cCs<|j}|j}x#|r7|j�}t||�qWdS(N(RRtpopR(RtltdR((s/usr/lib64/python2.7/weakref.pyt_commit_removalsGs
			cCsF|jr|j�n|j|�}|dkr>t|�n|SdS(N(RR$RRtKeyError(RRto((s/usr/lib64/python2.7/weakref.pyt__getitem__Ps	
cCs$|jr|j�n|j|=dS(N(RR$R(RR((s/usr/lib64/python2.7/weakref.pyt__delitem__Ys	
cCsI|jr|j�ny|j|�}Wntk
r>tSX|dk	S(N(RR$RR%tFalseR(RRR&((s/usr/lib64/python2.7/weakref.pyt__contains__^s	

cCsI|jr|j�ny|j|�}Wntk
r>tSX|dk	S(N(RR$RR%R)R(RRR&((s/usr/lib64/python2.7/weakref.pythas_keygs	

cCsdt|�S(Ns<WeakValueDictionary at %s>(tid(R((s/usr/lib64/python2.7/weakref.pyt__repr__pscCs6|jr|j�nt||j|�|j|<dS(N(RR$tKeyedRefRR(RRtvalue((s/usr/lib64/python2.7/weakref.pyt__setitem__ss	
cCs'|jr|j�n|jj�dS(N(RR$Rtclear(R((s/usr/lib64/python2.7/weakref.pyR1xs	
cCse|jr|j�nt�}x?|jj�D].\}}|�}|dk	r/|||<q/q/W|S(N(RR$R
RtitemsR(RtnewRRR&((s/usr/lib64/python2.7/weakref.pytcopy}s	
		cCs�ddlm}|jr&|j�n|j�}xH|jj�D]7\}}|�}|dk	rB|||||�<qBqBW|S(Ni����(tdeepcopy(R4R5RR$t	__class__RR2R(RtmemoR5R3RRR&((s/usr/lib64/python2.7/weakref.pyt__deepcopy__�s	
	cCs]|jr|j�ny|j|}Wntk
r;|SX|�}|dkrU|S|SdS(N(RR$RR%R(RRtdefaultRR&((s/usr/lib64/python2.7/weakref.pytget�s	

	cCsk|jr|j�ng}xH|jj�D]7\}}|�}|dk	r,|j||f�q,q,W|S(N(RR$RR2RR(RtLRRR&((s/usr/lib64/python2.7/weakref.pyR2�s	
	ccsm|jr|j�nt|��Ex=|jj�D],}|�}|dk	r3|j|fVq3q3WWdQXdS(N(RR$R	Rt
itervaluesRR(RRR/((s/usr/lib64/python2.7/weakref.pyt	iteritems�s	

	ccsL|jr|j�nt|��$x|jj�D]}|Vq3WWdQXdS(N(RR$R	Rtiterkeys(Rtk((s/usr/lib64/python2.7/weakref.pyR>�s
	

ccsL|jr|j�nt|��$x|jj�D]}|Vq3WWdQXdS(s�Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        N(RR$R	RR<(RR((s/usr/lib64/python2.7/weakref.pyt
itervaluerefs�s

	

ccsd|jr|j�nt|��<x4|jj�D]#}|�}|dk	r3|Vq3q3WWdQXdS(N(RR$R	RR<R(RRtobj((s/usr/lib64/python2.7/weakref.pyR<�s	

	cCsU|jr|j�nx8|jj�\}}|�}|dk	r||fSqWdS(N(RR$RtpopitemR(RRRR&((s/usr/lib64/python2.7/weakref.pyRB�s	
	cGsw|jr|j�ny|jj|��}Wntk
rHd}nX|dkro|rc|dSt|�n|SdS(Ni(RR$RR!R%R(RRRR&((s/usr/lib64/python2.7/weakref.pyR!�s	


cCsx|jr|j�ny|j|�}Wntk
rCd}nX|dkrpt||j|�|j|<|S|SdS(N(RR$RR%RR.R(RRR9R&((s/usr/lib64/python2.7/weakref.pyt
setdefault�s	


cOs|std��n|d}|d}t|�dkrTtdt|���n|rd|dnd}|jr�|j�n|j}|dk	r�t|d�s�ti�|�}nx6|j�D]%\}}t	||j
|�||<q�Wnt|�r|j|�ndS(NsEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentiis$expected at most 1 arguments, got %dR2(RRRRR$RthasattrttypeR2R.Rtupdate(RtkwargsRtdictR#RR&((s/usr/lib64/python2.7/weakref.pyRF�s"

	
	 cCs#|jr|j�n|jj�S(s~Return a list of weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        (RR$Rtvalues(R((s/usr/lib64/python2.7/weakref.pyt	valuerefss
	
cCs_|jr|j�ng}x<|jj�D]+}|�}|dk	r,|j|�q,q,W|S(N(RR$RRIRR(RR;RR&((s/usr/lib64/python2.7/weakref.pyRIs	
	N(t__name__t
__module__t__doc__RR$R'R(R*R+R-R0R1R4t__copy__R8RR:R2R=R>t__iter__R@R<RBR!RCRFRJRI(((s/usr/lib64/python2.7/weakref.pyR
$s4														
		
									
		R.cBs&eZdZdZd�Zd�ZRS(s[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    RcCs"tj|||�}||_|S(N(Rt__new__R(REtobtcallbackRR((s/usr/lib64/python2.7/weakref.pyRP6s	cCstt|�j||�dS(N(tsuperR.R(RRQRRR((s/usr/lib64/python2.7/weakref.pyR;s(R(RKRLRMt	__slots__RPR(((s/usr/lib64/python2.7/weakref.pyR.*s	cBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
e
Zd�Zdd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�ZeZd�Zd�Zd�Zd�Zd�Zdd�Zdd�ZRS(s� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    cCsYi|_t|�d�}||_g|_t�|_|dk	rU|j|�ndS(NcSsB|�}|dk	r>|jr1|jj|�q>|j|=ndS(N(RRRRR(R?RR((s/usr/lib64/python2.7/weakref.pyRLs
		(RRRRRRRRF(RRHR((s/usr/lib64/python2.7/weakref.pyRJs			cCsH|j}|j}x/|rCy||j�=Wqtk
r?qXqWdS(N(RRR!R%(RR"R#((s/usr/lib64/python2.7/weakref.pyR$Zs			
cCs|jt|�=dS(N(RR(RR((s/usr/lib64/python2.7/weakref.pyR(gscCs|jt|�S(N(RR(RR((s/usr/lib64/python2.7/weakref.pyR'jscCsdt|�S(Ns<WeakKeyDictionary at %s>(R,(R((s/usr/lib64/python2.7/weakref.pyR-mscCs||jt||j�<dS(N(RRR(RRR/((s/usr/lib64/python2.7/weakref.pyR0pscCsOt�}x?|jj�D].\}}|�}|dk	r|||<qqW|S(N(RRR2R(RR3RR/R&((s/usr/lib64/python2.7/weakref.pyR4ss		cCskddlm}|j�}xH|jj�D]7\}}|�}|dk	r,|||�||<q,q,W|S(Ni����(R5(R4R5R6RR2R(RR7R5R3RR/R&((s/usr/lib64/python2.7/weakref.pyR8}s	cCs|jjt|�|�S(N(RR:R(RRR9((s/usr/lib64/python2.7/weakref.pyR:�scCs2yt|�}Wntk
r$dSX||jkS(Ni(RRR(RRR((s/usr/lib64/python2.7/weakref.pyR+�s

cCs2yt|�}Wntk
r$dSX||jkS(Ni(RRR(RRR((s/usr/lib64/python2.7/weakref.pyR*�s

cCsUg}xH|jj�D]7\}}|�}|dk	r|j||f�qqW|S(N(RR2RR(RR;RR/R&((s/usr/lib64/python2.7/weakref.pyR2�s	ccsZt|��Hx@|jj�D]/\}}|�}|dk	r||fVqqWWdQXdS(N(R	RR=R(RRR/R((s/usr/lib64/python2.7/weakref.pyR=�s

	ccs6t|��$x|jj�D]}|VqWWdQXdS(s�Return an iterator that yields the weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        N(R	RR>(RR((s/usr/lib64/python2.7/weakref.pytiterkeyrefs�s

ccsNt|��<x4|jj�D]#}|�}|dk	r|VqqWWdQXdS(N(R	RR>R(RRRA((s/usr/lib64/python2.7/weakref.pyR>�s

	ccs6t|��$x|jj�D]}|VqWWdQXdS(N(R	RR<(RR/((s/usr/lib64/python2.7/weakref.pyR<�s
cCs
|jj�S(szReturn a list of weak references to the keys.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the keys around longer than needed.

        (Rtkeys(R((s/usr/lib64/python2.7/weakref.pytkeyrefs�s
cCsIg}x<|jj�D]+}|�}|dk	r|j|�qqW|S(N(RRVRR(RR;RR&((s/usr/lib64/python2.7/weakref.pyRV�s	cCs?x8|jj�\}}|�}|dk	r||fSqWdS(N(RRBR(RRR/R&((s/usr/lib64/python2.7/weakref.pyRB�s
	cGs|jjt|�|�S(N(RR!R(RRR((s/usr/lib64/python2.7/weakref.pyR!�scCs|jjt||j�|�S(N(RRCRR(RRR9((s/usr/lib64/python2.7/weakref.pyRC�scKs�|j}|dk	rot|d�s9ti�|�}nx3|j�D]"\}}||t||j�<qFWnt|�r�|j|�ndS(NR2(	RRRDRER2RRRRF(RRHRGR#RR/((s/usr/lib64/python2.7/weakref.pyRF�s	N(RKRLRMRRR$R(R'R-R0R4RNR8R:R+R*R2R=RUR>ROR<RWRVRBR!RCRF(((s/usr/lib64/python2.7/weakref.pyR?s2		
																		(RMRt_weakrefRRRRRRRRt_weakrefsetRR	t
exceptionsR
Rt__all__R
R.R(((s/usr/lib64/python2.7/weakref.pyt<module>s:
�

Hacked By AnonymousFox1.0, Coded By AnonymousFox