%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/weakref.pyc

ó
Mêáac@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/local/lib/python2.7/weakref.pytremove8s
		(
t	TypeErrortlenRRt_removeRtsetRtUserDictt__init__(targstkwRR((s#/usr/local/lib/python2.7/weakref.pyR0s

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

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

cCsdt|ƒS(Ns<WeakValueDictionary at %s>(tid(R((s#/usr/local/lib/python2.7/weakref.pyt__repr__pscCs6|jr|jƒnt||j|ƒ|j|<dS(N(RR$tKeyedRefRR(RRtvalue((s#/usr/local/lib/python2.7/weakref.pyt__setitem__ss	
cCs'|jr|jƒn|jjƒdS(N(RR$Rtclear(R((s#/usr/local/lib/python2.7/weakref.pyR1xs	
cCse|jr|jƒntƒ}x?|jjƒD].\}}|ƒ}|dk	r/|||<q/q/W|S(N(RR$R
RtitemsR(RtnewRRR&((s#/usr/local/lib/python2.7/weakref.pytcopy}s	
		cCsddlm}|jr&|jƒn|jƒ}xH|jjƒD]7\}}|ƒ}|dk	rB|||||ƒ<qBqBW|S(Niÿÿÿÿ(tdeepcopy(R4R5RR$t	__class__RR2R(RtmemoR5R3RRR&((s#/usr/local/lib/python2.7/weakref.pyt__deepcopy__‰s	
	cCs]|jr|jƒny|j|}Wntk
r;|SX|ƒ}|dkrU|S|SdS(N(RR$RR%R(RRtdefaultRR&((s#/usr/local/lib/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/local/lib/python2.7/weakref.pyR2£s	
	ccsm|jr|jƒnt|ƒEx=|jjƒD],}|ƒ}|dk	r3|j|fVq3q3WWdQXdS(N(RR$R	Rt
itervaluesRR(RRR/((s#/usr/local/lib/python2.7/weakref.pyt	iteritems­s	

	ccsL|jr|jƒnt|ƒ$x|jjƒD]}|Vq3WWdQXdS(N(RR$R	Rtiterkeys(Rtk((s#/usr/local/lib/python2.7/weakref.pyR>¶s
	

ccsL|jr|jƒnt|ƒ$x|jjƒD]}|Vq3WWdQXdS(sReturn 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/local/lib/python2.7/weakref.pyt
itervaluerefs¿s

	

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

	cCsU|jr|jƒnx8|jjƒ\}}|ƒ}|dk	r||fSqWdS(N(RR$RtpopitemR(RRRR&((s#/usr/local/lib/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/local/lib/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/local/lib/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/local/lib/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/local/lib/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/local/lib/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/local/lib/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/local/lib/python2.7/weakref.pyRP6s	cCstt|ƒj||ƒdS(N(tsuperR.R(RRQRRR((s#/usr/local/lib/python2.7/weakref.pyR;s(R(RKRLRMt	__slots__RPR(((s#/usr/local/lib/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/local/lib/python2.7/weakref.pyRLs
		(RRRRRRRRF(RRHR((s#/usr/local/lib/python2.7/weakref.pyRJs			cCsH|j}|j}x/|rCy||jƒ=Wqtk
r?qXqWdS(N(RRR!R%(RR"R#((s#/usr/local/lib/python2.7/weakref.pyR$Zs			
cCs|jt|ƒ=dS(N(RR(RR((s#/usr/local/lib/python2.7/weakref.pyR(gscCs|jt|ƒS(N(RR(RR((s#/usr/local/lib/python2.7/weakref.pyR'jscCsdt|ƒS(Ns<WeakKeyDictionary at %s>(R,(R((s#/usr/local/lib/python2.7/weakref.pyR-mscCs||jt||jƒ<dS(N(RRR(RRR/((s#/usr/local/lib/python2.7/weakref.pyR0pscCsOtƒ}x?|jjƒD].\}}|ƒ}|dk	r|||<qqW|S(N(RRR2R(RR3RR/R&((s#/usr/local/lib/python2.7/weakref.pyR4ss		cCskddlm}|jƒ}xH|jjƒD]7\}}|ƒ}|dk	r,|||ƒ||<q,q,W|S(Niÿÿÿÿ(R5(R4R5R6RR2R(RR7R5R3RR/R&((s#/usr/local/lib/python2.7/weakref.pyR8}s	cCs|jjt|ƒ|ƒS(N(RR:R(RRR9((s#/usr/local/lib/python2.7/weakref.pyR:†scCs2yt|ƒ}Wntk
r$dSX||jkS(Ni(RRR(RRR((s#/usr/local/lib/python2.7/weakref.pyR+‰s

cCs2yt|ƒ}Wntk
r$dSX||jkS(Ni(RRR(RRR((s#/usr/local/lib/python2.7/weakref.pyR*s

cCsUg}xH|jjƒD]7\}}|ƒ}|dk	r|j||fƒqqW|S(N(RR2RR(RR;RR/R&((s#/usr/local/lib/python2.7/weakref.pyR2—s	ccsZt|ƒHx@|jjƒD]/\}}|ƒ}|dk	r||fVqqWWdQXdS(N(R	RR=R(RRR/R((s#/usr/local/lib/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/local/lib/python2.7/weakref.pytiterkeyrefs¦s

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

	ccs6t|ƒ$x|jjƒD]}|VqWWdQXdS(N(R	RR<(RR/((s#/usr/local/lib/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/local/lib/python2.7/weakref.pytkeyrefsÂs
cCsIg}x<|jjƒD]+}|ƒ}|dk	r|j|ƒqqW|S(N(RRVRR(RR;RR&((s#/usr/local/lib/python2.7/weakref.pyRVÎs	cCs?x8|jjƒ\}}|ƒ}|dk	r||fSqWdS(N(RRBR(RRR/R&((s#/usr/local/lib/python2.7/weakref.pyRBÖs
	cGs|jjt|ƒ|ŒS(N(RR!R(RRR((s#/usr/local/lib/python2.7/weakref.pyR!ÝscCs|jjt||jƒ|ƒS(N(RRCRR(RRR9((s#/usr/local/lib/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/local/lib/python2.7/weakref.pyRFãs	N(RKRLRMRRR$R(R'R-R0R4RNR8R:R+R*R2R=RUR>ROR<RWRVRBR!RCRF(((s#/usr/local/lib/python2.7/weakref.pyR?s2		
																		(RMRt_weakrefRRRRRRRRt_weakrefsetRR	t
exceptionsR
Rt__all__R
R.R(((s#/usr/local/lib/python2.7/weakref.pyt<module>s:
ÿ

Zerion Mini Shell 1.0