tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
M\¬Qc @sèdZddlZddlmZmZmZmZmZmZm    Z    ddl
m Z ddl m Z eefZdddd    d
d d 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(tgetweakrefcountt getweakrefstreftproxytCallableProxyTypet    ProxyTypet ReferenceType(tWeakSet(tReferenceErrorRRRRtWeakKeyDictionaryRRRRt
ProxyTypestWeakValueDictionaryRcBsÚeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z    e    Z
d„Z dd    „Z d
„Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zdd„Zdd„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
    cOs5t|ƒd„}||_tjj|||ŽdS(NcSs)|ƒ}|dk    r%|j|j=ndS(N(tNonetdatatkey(twrtselfreftself((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pytremove0s     (Rt_removetUserDictt__init__(RtargstkwR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR/s    cCs0|j|ƒ}|dkr(t|‚n|SdS(N(R R tKeyError(RRto((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt __getitem__7s  cCs3y|j|ƒ}Wntk
r(tSX|dk    S(N(R RtFalseR (RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt __contains__>s
 cCs3y|j|ƒ}Wntk
r(tSX|dk    S(N(R RRR (RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pythas_keyEs
 cCsdt|ƒS(Ns<WeakValueDictionary at %s>(tid(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt__repr__LscCs t||j|ƒ|j|<dS(N(tKeyedRefRR (RRtvalue((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt __setitem__OscCsOtƒ}x?|jjƒD].\}}|ƒ}|dk    r|||<qqW|S(N(R R titemsR (RtnewRRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pytcopyRs          cCskddlm}|jƒ}xH|jjƒD]7\}}|ƒ}|dk    r,|||||ƒ<q,q,W|S(Niÿÿÿÿ(tdeepcopy(R%R&t    __class__R R#R (RtmemoR&R$RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt __deepcopy__\s      cCsGy|j|}Wntk
r%|SX|ƒ}|dkr?|S|SdS(N(R RR (RRtdefaultRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pytgetes      cCsUg}xH|jjƒD]7\}}|ƒ}|dk    r|j||fƒqqW|S(N(R R#R tappend(RtLRRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR#rs      ccsDx=|jjƒD],}|ƒ}|dk    r|j|fVqqWdS(N(R t
itervaluesR R(RRR!((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt    iteritemszs     cCs |jjƒS(N(R titerkeys(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR0€scCs |jjƒS(N(R R0(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt__iter__ƒscCs |jjƒS(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.
 
        (R R.(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt itervaluerefs†s
ccs;x4|jjƒD]#}|ƒ}|dk    r|VqqWdS(N(R R.R (RRtobj((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR.’s     cCs>x7|jjƒ\}}|ƒ}|dk    r||fSqdS(N(R tpopitemR (RRRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR4˜s
     cGs^y|jj|ƒƒ}Wn"tk
r=|r7|dS‚nX|dkrVt|‚n|SdS(Ni(R tpopRR (RRRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR5Ÿs   cCsMy|j|}Wn.tk
rAt||j|ƒ|j|<|SX|ƒSdS(N(R RR R(RRR*R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt
setdefault«s  cKs’|j}|dk    rrt|dƒs9tiƒ|ƒ}nx6|jƒD]%\}}t||j|ƒ||<qFWnt|ƒrŽ|j|ƒndS(NR#(    R R thasattrttypeR#R Rtlentupdate(RtdicttkwargstdRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR:´s       cCs |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.
 
        (R tvalues(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt    valuerefs¾s
cCsIg}x<|jjƒD]+}|ƒ}|dk    r|j|ƒqqW|S(N(R R>R R,(RR-RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR>Ês      N(t__name__t
__module__t__doc__RRRRRR"R%t__copy__R)R R+R#R/R0R1R2R.R4R5R6R:R?R>(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR #s.                                                                        
    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(R8tobtcallbackRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRDßs    cCstt|ƒj||ƒdS(N(tsuperR R(RRERFR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRäs(skey(R@RARBt    __slots__RDR(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR Ós    cBsæeZdZdd„Zd„Zd„Zd„Zd„Zd„Z    e    Z
d„Z dd„Z d    „Z d
„Zd „Zd „Zd „Zd„Zd„Zd„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.
    cCsDi|_t|ƒd„}||_|dk    r@|j|ƒndS(NcSs&|ƒ}|dk    r"|j|=ndS(N(R R (tkRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRõs     (R RRR R:(RR;R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRós
         cCs|jt|ƒ=dS(N(R R(RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt __delitem__üscCs|jt|ƒS(N(R R(RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRÿscCsdt|ƒS(Ns<WeakKeyDictionary at %s>(R(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRscCs||jt||jƒ<dS(N(R RR(RRR!((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR"scCsOtƒ}x?|jjƒD].\}}|ƒ}|dk    r|||<qqW|S(N(R    R R#R (RR$RR!R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR%s          cCskddlm}|jƒ}xH|jjƒD]7\}}|ƒ}|dk    r,|||ƒ||<q,q,W|S(Niÿÿÿÿ(R&(R%R&R'R R#R (RR(R&R$RR!R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR)s      cCs|jjt|ƒ|ƒS(N(R R+R(RRR*((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR+scCs2yt|ƒ}Wntk
r$dSX||jkS(Ni(Rt    TypeErrorR (RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRs
 cCs2yt|ƒ}Wntk
r$dSX||jkS(Ni(RRKR (RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR%s
 cCsUg}xH|jjƒD]7\}}|ƒ}|dk    r|j||fƒqqW|S(N(R R#R R,(RR-RR!R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR#,s      ccsGx@|jjƒD]/\}}|ƒ}|dk    r||fVqqWdS(N(R R/R (RRR!R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR/4s     cCs |jjƒS(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.
 
        (R R0(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt iterkeyrefs:s
ccs;x4|jjƒD]#}|ƒ}|dk    r|VqqWdS(N(R R0R (RRR3((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR0Fs     cCs
|jƒS(N(R0(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR1LscCs |jjƒS(N(R R.(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR.OscCs |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.
 
        (R tkeys(R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pytkeyrefsRs
cCsIg}x<|jjƒD]+}|ƒ}|dk    r|j|ƒqqW|S(N(R RMR R,(RR-RR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyRM^s      cCs>x7|jjƒ\}}|ƒ}|dk    r||fSqdS(N(R R4R (RRR!R((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR4fs
     cGs|jjt|ƒ|ŒS(N(R R5R(RRR((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR5mscCs|jjt||jƒ|ƒS(N(R R6RR(RRR*((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR6pscKs|j}|dk    rot|dƒs9tiƒ|ƒ}nx3|jƒD]"\}}||t||jƒ<qFWnt|ƒr‹|j|ƒndS(NR#(    R R R7R8R#RRR9R:(RR;R<R=RR!((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR:ss      N(R@RARBR RRJRRR"R%RCR)R+RRR#R/RLR0R1R.RNRMR4R5R6R:(((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyR    ès0                                                                                      (RBRt_weakrefRRRRRRRt _weakrefsetRt
exceptionsRR
t__all__R R R    (((sO/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/weakref.pyt<module>s 4       °