Files
old-nlp/venv/lib/python3.7/__pycache__/weakref.cpython-37.pyc

163 lines
19 KiB
Plaintext
Raw Normal View History

2019-10-20 13:16:49 +02:00
B
<00>x-]T<00> @s<>dZddlmZmZmZmZmZmZmZm Z ddl
m Z m Z ddl Z ddlZddlZeefZddddd d
d d d ddddg ZGdd<10>de<04>ZGdd<0E>de j<13>ZGdd<15>de<04>ZGdd <09>d e j<13>ZGdd<11>d<11>ZdS)z{Weak reference support for Python.
This module is an implementation of PEP 205:
http://www.python.org/dev/peps/pep-0205/
<EFBFBD>)<08>getweakrefcount<6E> getweakrefs<66>ref<65>proxy<78>CallableProxyType<70> ProxyType<70> ReferenceType<70>_remove_dead_weakref)<02>WeakSet<65>_IterationGuardNrrrr<00>WeakKeyDictionaryrrr<00>
ProxyTypes<EFBFBD>WeakValueDictionaryr
<00>
WeakMethod<EFBFBD>finalizecsDeZdZdZdZd dd<05>Z<05>fdd<07>Zdd <09>Zd
d <0B>Ze j
Z
<EFBFBD>Z S) rz<>
A custom `weakref.ref` subclass which simulates a weak reference to
a bound method, working around the lifetime problem of bound methods.
)<04> _func_ref<65>
_meth_type<EFBFBD>_alive<76> __weakref__Ncs~y|j}|j}Wn(tk
r8td<01>t|<01><01><01>d<00>YnX<00><00>fdd<03>}t<06>|||<05>}t||<05>|_t|<01>|_ d|_
t|<06><01>|S)Nz)argument should be a bound method, not {}cs&<00><01>}|jr"d|_<00>dk r"<22>|<01>dS)NF)r)<02>arg<72>self)<02>callback<63>self_wr<77><00>?/home/hamo/projects/misc/adreader/venv/lib/python3.7/weakref.py<70>_cb3s
zWeakMethod.__new__.<locals>._cbT) <0B>__self__<5F>__func__<5F>AttributeError<6F> TypeError<6F>format<61>typer<00>__new__rrr)<07>clsZmethr<00>obj<62>funcrrr)rrrr",s
 
zWeakMethod.__new__cs2t<00><00><01>}|<00><02>}|dks"|dkr&dS|<00>||<01>S)N)<04>super<65>__call__rr)rr$r%)<01> __class__rrr'Bs

zWeakMethod.__call__cCs:t|t<01>r6|jr|js||kSt<03>||<01>o4|j|jkSdS)NF)<06>
isinstancerrr<00>__eq__r)r<00>otherrrrr*Is

 zWeakMethod.__eq__cCs:t|t<01>r6|jr|js||k St<03>||<01>p4|j|jkSdS)NT)r)rrr<00>__ne__r)rr+rrrr,Ps

 zWeakMethod.__ne__)N) <0C>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__<5F> __slots__r"r'r*r,r<00>__hash__<5F> __classcell__rr)r(rr$s
 c@s<>eZdZdZdd<03>Zdd<05>Zdd<07>Zdd <09>Zd
d <0B>Zd d <0A>Z dd<0F>Z
dd<11>Z dd<13>Z e Z dd<15>Zd+dd<18>Zdd<1A>Zdd<1C>ZeZdd<1E>Zdd <20>Zd!d"<22>Zd#d$<24>Zd,d%d&<26>Zd'd(<28>Zd)d*<2A>ZdS)-rz<>Mapping class that references values weakly.
Entries in the dictionary will be discarded when no strong
reference to the value exists anymore
cst|s td<01><01>|^}}t|<00>dkr0tdt|<00><00><01>t|<02>tf<02>fdd<05> }||_g|_t<06>|_i|_<08>|j ||<01>dS)NzGdescriptor '__init__' of 'WeakValueDictionary' object needs an argument<6E>z$expected at most 1 arguments, got %dcs4|<01>}|dk r0|jr$|j<01>|j<03>n |<02>|j<03>dS)N)<04>
_iterating<EFBFBD>_pending_removals<6C>append<6E>key)<04>wr<77>selfrefZ_atomic_removalr)<01>drr<00>removems
z,WeakValueDictionary.__init__.<locals>.remove)
r<00>lenrr <00>_remover6<00>setr5<00>data<74>update)<04>args<67>kwrr<r)r;r<00>__init__fs  
zWeakValueDictionary.__init__cCs,|j}|j}x|r&|<01><02>}t||<03>qWdS)N)r6r@<00>popr )r<00>lr;r8rrr<00>_commit_removals}s
z$WeakValueDictionary._commit_removalscCs4|jr|<00><01>|j|<00>}|dkr,t|<01><01>n|SdS)N)r6rGr@<00>KeyError)rr8<00>orrr<00> __getitem__<5F>s  
zWeakValueDictionary.__getitem__cCs|jr|<00><01>|j|=dS)N)r6rGr@)rr8rrr<00> __delitem__<5F>szWeakValueDictionary.__delitem__cCs|jr|<00><01>t|j<03>S)N)r6rGr=r@)rrrr<00>__len__<5F>szWeakValueDictionary.__len__cCs<|jr|<00><01>y|j|<00>}Wntk
r2dSX|dk S)NF)r6rGr@rH)rr8rIrrr<00> __contains__<5F>sz WeakValueDictionary.__contains__cCsd|jjt|<00>fS)Nz <%s at %#x>)r(r-<00>id)rrrr<00>__repr__<5F>szWeakValueDictionary.__repr__cCs&|jr|<00><01>t||j|<01>|j|<dS)N)r6rG<00>KeyedRefr>r@)rr8<00>valuerrr<00> __setitem__<5F>szWeakValueDictionary.__setitem__c CsZ|jr|<00><01>t<02>}t|<00><01>4x,|j<04><05>D]\}}|<03>}|dk r*|||<q*WWdQRX|S)N)r6rGrr r@<00>items)r<00>newr8r9rIrrr<00>copy<70>s
zWeakValueDictionary.copyc Csnddlm}|jr|<00><03>|<00><04>}t|<00><01>:x2|j<06><07>D]$\}}|<05>}|dk r8|||||<01><q8WWdQRX|S)Nr)<01>deepcopy)rUrVr6rGr(r r@rS)r<00>memorVrTr8r9rIrrr<00> __deepcopy__<5F>s 
z WeakValueDictionary.__deepcopy__NcCsL|jr|<00><01>y|j|}Wntk
r0|SX|<03>}|dkrD|S|SdS)N)r6rGr@rH)rr8<00>defaultr9rIrrr<00>get<65>szWeakValueDictionary.getc csV|jr|<00><01>t|<00><01>6x.|j<03><04>D] \}}|<02>}|dk r$||fVq$WWdQRXdS)N)r6rGr r@rS)r<00>kr9<00>vrrrrS<00>s
zWeakValueDictionary.itemsc csN|jr|<00><01>t|<00><01>.x&|j<03><04>D]\}}|<02>dk r$|Vq$WWdQRXdS)N)r6rGr r@rS)rr[r9rrr<00>keys<79>s 

zWeakValueDictionary.keysc cs6|jr|<00><01>t|<00><01>|j<03><04>EdHWdQRXdS)a<>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)r6rGr r@<00>values)rrrr<00> itervaluerefs<66>s

z!WeakValueDictionary.itervaluerefsc csN|jr|<00><01>t|<00><01>.x&|j<03><04>D]}|<01>}|dk r$|Vq$WWdQRXdS)N)r6rGr r@r^)rr9r$rrrr^<00>s
zWeakValueDictionary.valuescCs<|jr|<00><01>x(|j<02><03>\}}|<02>}|dk r||fSqWdS)N)r6rGr@<00>popitem)rr8r9rIrrrr`<00>szWeakValueDictionary.popitemcGs`|jr|<00><01>y|j<02>|<01><01>}Wntk
r8d}YnX|dkrX|rN|dSt|<01><01>n|SdS)Nr)r6rGr@rErH)rr8rBrIrrrrEs

zWeakValueDictionary.popcCs`y|j|<00>}Wntk
r(d}YnX|dkrX|jr@|<00><03>t||j|<01>|j|<|S|SdS)N)r@rHr6rGrPr>)rr8rYrIrrr<00>
setdefaults
zWeakValueDictionary.setdefaultcOs<>|s td<01><01>|^}}t|<00>dkr0tdt|<00><00><01>|r<|dnd}|jrN|<02><03>|j}|dk r<>t|d<05>srti<00>|<03>}x&|<03><07>D]\}}t||j |<05>||<q|Wt|<01>r<>|<02>
|<01>dS)NzEdescriptor 'update' of 'WeakValueDictionary' object needs an argumentr4z$expected at most 1 arguments, got %drrS) rr=r6rGr@<00>hasattrr!rSrPr>rA)rB<00>kwargsr<00>dictr;r8rIrrrrA"s  
 zWeakValueDictionary.updatecCs|jr|<00><01>t|j<03><04><00>S)a~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.
)r6rG<00>listr@r^)rrrr<00> valuerefs5s
zWeakValueDictionary.valuerefs)N)N)r-r.r/r0rDrGrJrKrLrMrOrRrU<00>__copy__rXrZrSr]<00>__iter__r_r^r`rErarArfrrrrrZs.    
   
cs,eZdZdZdZdd<04>Z<05>fdd<06>Z<06>ZS)rPa[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.
)r8cCst<00>|||<02>}||_|S)N)rr"r8)r!<00>obrr8rrrrr"PszKeyedRef.__new__cst<00><00>||<02>dS)N)r&rD)rrirr8)r(rrrDUszKeyedRef.__init__)r-r.r/r0r1r"rDr3rr)r(rrPDsrPc@s<>eZdZdZd+dd<04>Zdd<06>Zdd<08>Zd d
<EFBFBD>Zd d <0C>Zd d<0E>Z dd<10>Z
dd<12>Z dd<14>Z e Z dd<16>Zd,dd<18>Zdd<1A>Zdd<1C>Zdd<1E>ZeZdd <20>Zd!d"<22>Zd#d$<24>Zd%d&<26>Zd-d'd(<28>Zd.d)d*<2A>ZdS)/r a<> 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.
NcCsFi|_t|<00>fdd<02>}||_g|_t<04>|_d|_|dk rB|<00>|<01>dS)NcSs.|<01>}|dk r*|jr"|j<01>|<00>n|j|=dS)N)r5r6r7r@)r[r:rrrrr<fs
z*WeakKeyDictionary.__init__.<locals>.removeF)r@rr>r6r?r5<00>
_dirty_lenrA)rrdr<rrrrDdszWeakKeyDictionary.__init__cCs>|j}|j}x,|r8y||<01><02>=Wqtk
r4YqXqWdS)N)r6r@rErH)rrFr;rrrrGusz"WeakKeyDictionary._commit_removalscs&|j<00><00>fdd<02>|jD<00>|_d|_dS)Ncsg|]}|<01>kr|<01>qSrr)<02>.0r[)r;rr<00>
<listcomp><3E>sz5WeakKeyDictionary._scrub_removals.<locals>.<listcomp>F)r@r6rj)rr)r;r<00>_scrub_removals<6C>sz!WeakKeyDictionary._scrub_removalscCsd|_|jt|<01>=dS)NT)rjr@r)rr8rrrrK<00>szWeakKeyDictionary.__delitem__cCs|jt|<01>S)N)r@r)rr8rrrrJ<00>szWeakKeyDictionary.__getitem__cCs(|jr|jr|<00><02>t|j<04>t|j<01>S)N)rjr6rmr=r@)rrrrrL<00>s zWeakKeyDictionary.__len__cCsd|jjt|<00>fS)Nz <%s at %#x>)r(r-rN)rrrrrO<00>szWeakKeyDictionary.__repr__cCs||jt||j<02><dS)N)r@rr>)rr8rQrrrrR<00>szWeakKeyDictionary.__setitem__c CsLt<00>}t|<00><01>4x,|j<02><03>D]\}}|<02>}|dk r|||<qWWdQRX|S)N)r r r@rS)rrTr8rQrIrrrrU<00>s
zWeakKeyDictionary.copyc Cs`ddlm}|<00><02>}t|<00><01>:x2|j<04><05>D]$\}}|<04>}|dk r*|||<01>||<q*WWdQRX|S)Nr)rV)rUrVr(r r@rS)rrWrVrTr8rQrIrrrrX<00>s 
zWeakKeyDictionary.__deepcopy__cCs|j<00>t|<01>|<02>S)N)r@rZr)rr8rYrrrrZ<00>szWeakKeyDictionary.getcCs,y t|<01>}Wntk
r dSX||jkS)NF)rrr@)rr8r9rrrrM<00>s
 zWeakKeyDictionary.__contains__c csHt|<00><01>6x.|j<01><02>D] \}}|<01>}|dk r||fVqWWdQRXdS)N)r r@rS)rr9rQr8rrrrS<00>s

zWeakKeyDictionary.itemsc cs<t|<00><01>*x"|jD]}|<01>}|dk r|VqWWdQRXdS)N)r r@)rr9r$rrrr]<00>s

 zWeakKeyDictionary.keysc cs@t|<00><01>.x&|j<01><02>D]\}}|<01>dk r|VqWWdQRXdS)N)r r@rS)rr9rQrrrr^<00>s

zWeakKeyDictionary.valuescCs
t|j<01>S)azReturn 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.
)rer@)rrrr<00>keyrefs<66>s
zWeakKeyDictionary.keyrefscCs4d|_x(|j<01><02>\}}|<01>}|dk r||fSqWdS)NT)rjr@r`)rr8rQrIrrrr`<00>s zWeakKeyDictionary.popitemcGsd|_|jjt|<01>f|<02><02>S)NT)rjr@rEr)rr8rBrrrrE<00>szWeakKeyDictionary.popcCs|j<00>t||j<03>|<02>S)N)r@rarr>)rr8rYrrrra<00>szWeakKeyDictionary.setdefaultcKs`|j}|dk rJt|d<01>s$ti<00>|<01>}x$|<01><03>D]\}}||t||j<05><q.Wt|<02>r\|<00>|<02>dS)NrS)r@rbr!rSrr>r=rA)rrdrcr;r8rQrrrrA<00>s
 zWeakKeyDictionary.update)N)N)N)N)r-r.r/r0rDrGrmrKrJrLrOrRrUrgrXrZrMrSr]rhr^rnr`rErarArrrrr Ys. 
  
 
c@s<>eZdZdZdZiZdZe<07><08>Z dZ
dZ Gdd<05>d<05>Z dd<07>Z dd d
<EFBFBD>Zd d <0C>Zd d<0E>Zedd<10><00>Zedd<12><00>Zejdd<12><00>Zdd<15>Zedd<17><00>Zedd<19><00>ZdS)raClass for finalization of weakrefable objects
finalize(obj, func, *args, **kwargs) returns a callable finalizer
object which will be called when obj is garbage collected. The
first time the finalizer is called it evaluates func(*arg, **kwargs)
and returns the result. After this the finalizer is dead, and
calling it just returns None.
When the program exits any remaining finalizers for which the
atexit attribute is true will be run in reverse order of creation.
By default atexit is true.
rFc@seZdZdZdS)zfinalize._Info)<06>weakrefr%rBrc<00>atexit<69>indexN)r-r.r/r1rrrr<00>_InfosrrcOs t|<00>dkr|^}}}}nz|s(td<02><01>nld|krDtdt|<00>d<00><01>|<01>d<03>}t|<00>dkrf|^}}}n.d|kr<>tdt|<00>d<00><01>|<01>d<07>}|^}}t|<00>}|js<>ddl}|<05>|j<07>d t_|<02> <09>}t
||<02>|_ ||_ ||_ |p<>d|_d |_t|j<10>|_||j|<d t_dS)
N<EFBFBD>z<descriptor '__init__' of 'finalize' object needs an argumentr%z9finalize expected at least 2 positional arguments, got %dr4<00>r$rT)r=rrE<00>tuple<6C>_registered_with_atexitrp<00>register<65> _exitfuncrrrrror%rBrc<00>next<78> _index_iterrq<00> _registry<72>_dirty)rBrcrr$r%rp<00>inforrrrDs: 

  
  
 
zfinalize.__init__NcCs0|j<00>|d<01>}|r,|js,|j|j|jp(i<00>SdS)zZIf alive then mark as dead and return func(*args, **kwargs);
otherwise return NoneN)r{rE<00> _shutdownr%rBrc)r<00>_r}rrrr'7s
zfinalize.__call__cCsH|j<00>|<00>}|o|<01><02>}|dk rD|j<00>|d<01>rD||j|j|jp@ifSdS)z^If alive then mark as dead and return (obj, func, args, kwargs);
otherwise return NoneN)r{rZrorEr%rBrc)rr}r$rrr<00>detach>s  zfinalize.detachcCs:|j<00>|<00>}|o|<01><02>}|dk r6||j|j|jp2ifSdS)zMIf alive then return (obj, func, args, kwargs);
otherwise return NoneN)r{rZror%rBrc)rr}r$rrr<00>peekFs  z finalize.peekcCs
||jkS)zWhether finalizer is alive)r{)rrrr<00>aliveNszfinalize.alivecCs|j<00>|<00>}t|<01>o|jS)z*Whether finalizer should be called at exit)r{rZ<00>boolrp)rr}rrrrpSs zfinalize.atexitcCs|j<00>|<00>}|rt|<01>|_dS)N)r{rZr<>rp)rrQr}rrrrpYs cCs^|j<00>|<00>}|o|<01><02>}|dkr6dt|<00>jt|<00>fSdt|<00>jt|<00>t|<02>jt|<02>fSdS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r{rZror!r-rN)rr}r$rrrrO_s   zfinalize.__repr__cCs2dd<02>|j<00><01>D<00>}|jdd<04>d<05>dd<02>|D<00>S)NcSsg|]\}}|jr||f<02>qSr)rp)rk<00>f<>irrrrlksz-finalize._select_for_exit.<locals>.<listcomp>cSs
|djS)Nr4)rq)<01>itemrrr<00><lambda>l<00>z+finalize._select_for_exit.<locals>.<lambda>)r8cSsg|] \}}|<01>qSrr)rkr<>r<>rrrrlms)r{rS<00>sort)r#<00>Lrrr<00>_select_for_exithszfinalize._select_for_exitcCs<>d}z<>|jr<>ddl}|<02><02>r(d}|<02><03>d}xj|dks<tjrJ|<00><06>}dt_|sPP|<03><07>}y
|<04>Wn"tk
r<EFBFBD>t j
t <09> <0B><00>YnX||jks.t <0C>q.WWddt_ |r<>|<02><0E>XdS)NFrT)r{<00>gcZ isenabledZdisablerr|r<>rE<00> Exception<6F>sys<79>
excepthook<EFBFBD>exc_info<66>AssertionErrorr~Zenable)r#Z reenable_gcr<63>Zpendingr<67>rrrrxos.
zfinalize._exitfunc)N)r-r.r/r0r1r{r~<00> itertools<6C>countrzr|rvrrrDr'r<>r<><00>propertyr<79>rp<00>setterrO<00> classmethodr<64>rxrrrrr<00>s$ %
   )r0<00>_weakrefrrrrrrrr Z _weakrefsetr
r <00>_collections_abcr<63>r<>r <00>__all__r<00>MutableMappingrrPr rrrrr<00><module>s"(

6k