o cc8T@s ddlmZmZmZmZmZmZmZmZddl m Z m Z ddl Z ddl Z ddlZeefZgdZe je e je GdddeZGddde jZGd d d eZGd d d e jZGd ddZdS))getweakrefcount getweakrefsrefproxyCallableProxyType ProxyType ReferenceType_remove_dead_weakref)WeakSet_IterationGuardN) rrrrWeakKeyDictionaryrrr ProxyTypesWeakValueDictionaryr WeakMethodfinalizecsBeZdZ dZd ddZfddZddZd d Zej Z Z S) r) _func_ref _meth_type_alive __weakref__Ncsxz|j}|j}Wntytdt|dwfdd}t|||}t|||_t||_ d|_ t||S)Nz)argument should be a bound method, not {}cs.}|jrd|_dur|dSdSdSNF)r)argselfcallbackZself_wrh/home/lily/lilypond-2.24.1/release/binaries/dependencies/install/Python-3.10.8/lib/python3.10/weakref.py_cb6s zWeakMethod.__new__.._cbT) __self____func__AttributeError TypeErrorformattyper__new__rrr)clsZmethrobjfuncrrrrrr#/s"     zWeakMethod.__new__cs2t}|}|dus|durdS|||SN)super__call__rr)rr%r& __class__rrr)Es  zWeakMethod.__call__cCs:t|tr|jr |js||uSt||o|j|jkStSr') isinstancerrr__eq__rNotImplementedrotherrrrr-L  zWeakMethod.__eq__cCs:t|tr|jr |js||uSt||p|j|jkStSr')r,rrr__ne__rr.r/rrrr2Sr1zWeakMethod.__ne__r') __name__ __module__ __qualname__ __slots__r#r)r-r2r__hash__ __classcell__rrr*rr's  rc@seZdZ d1ddZefddZddZdd Zd d Zd d Z ddZ ddZ ddZ e Z ddZd2ddZddZddZeZddZdd Zd!d"Zd#d$Zd2d%d&Zd2d'd(Zd)d*Zd+d,Zd-d.Zd/d0ZdS)3rrcKsBt|tfdd}||_g|_t|_i|_|j|fi|dS)NcSs<|}|dur|jr|j|jdS||j|jdSdSr') _iterating_pending_removalsappendkeydata)wrselfref_atomic_removalrrrrremovejs z,WeakValueDictionary.__init__..remove)rr _remover:setr9r=update)rr0kwrArrr__init__is  zWeakValueDictionary.__init__cCs<|jj}|j} z|}Wn tyYdSw|||qr')r:popr= IndexError)rr@rGdr<rrr_commit_removalszs   z$WeakValueDictionary._commit_removalscCs.|jr||j|}|durt||Sr'r:rJr=KeyErrorrr<orrr __getitem__s  zWeakValueDictionary.__getitem__cCs|jr||j|=dSr')r:rJr=rr<rrr __delitem__s zWeakValueDictionary.__delitem__cCs|jr|t|jSr')r:rJlenr=rrrr__len__s zWeakValueDictionary.__len__cCs:|jr|z |j|}W|duStyYdSwrrKrMrrr __contains__s z WeakValueDictionary.__contains__cCd|jjt|fSNz <%s at %#x>r+r3idrSrrr__repr__zWeakValueDictionary.__repr__cCs&|jr|t||j||j|<dSr')r:rJKeyedRefrBr=rr<valuerrr __setitem__szWeakValueDictionary.__setitem__cCsl|jr|t}t||jD]\}}|}|dur#|||<qWd|S1s/wY|Sr')r:rJrr r=items)rnewr<r>rNrrrcopys  zWeakValueDictionary.copycCsddlm}|jr ||}t|!|jD]\}}|}|dur-|||||<qWd|S1s9wY|SNr)deepcopy)rbrdr:rJr+r r=r`)rmemordrar<r>rNrrr __deepcopy__s   z WeakValueDictionary.__deepcopy__NcCsJ|jr|z|j|}Wn ty|YSw|}|dur#|S|Sr'rK)rr<defaultr>rNrrrgets zWeakValueDictionary.getccsj|jr|t||jD]\}}|}|dur"||fVqWddS1s.wYdSr'r:rJr r=r`)rkr>vrrrr`s  "zWeakValueDictionary.itemsccsb|jr|t||jD] \}}|dur|VqWddS1s*wYdSr'ri)rrjr>rrrkeyss  "zWeakValueDictionary.keysccsP |jr |t||jEdHWddS1s!wYdSr'r:rJr r=valuesrSrrr itervaluerefss  "z!WeakValueDictionary.itervaluerefsccsb|jr|t||jD] }|}|dur|VqWddS1s*wYdSr'rmrr>r%rrrrns "zWeakValueDictionary.valuescCs6|jr| |j\}}|}|dur||fSqr')r:rJr=popitem)rr<r>rNrrrrqszWeakValueDictionary.popitemcGsX|jr|z |j|}Wn tyd}Ynw|dur*|r&|dSt||S)Nr)r:rJr=rGrL)rr<argsrNrrrrGs zWeakValueDictionary.popcCsZz|j|}Wn tyd}Ynw|dur+|jr|t||j||j|<|S|Sr')r=rLr:rJr\rB)rr<rgrNrrr setdefaults zWeakValueDictionary.setdefaultcKsz|jr||j}|dur)t|dst|}|D] \}}t||j|||<q|D] \}}t||j|||<q-dSNr`)r:rJr=hasattrdictr`r\rB)rr0kwargsrIr<rNrrrrD"s zWeakValueDictionary.updatecCs |jr|t|jSr')r:rJlistr=rnrSrrr valuerefs.s zWeakValueDictionary.valuerefscC|||Sr'rDr/rrr__ior__< zWeakValueDictionary.__ior__cC&t|tjr|}|||StSr'r,_collections_abcMappingrbrDr.rr0crrr__or__@  zWeakValueDictionary.__or__cC0t|tjr|}|||||StSr'r,rrr+rDr.rrrr__ror__G   zWeakValueDictionary.__ror__)rr')r3r4r5rFr rJrOrQrTrUrZr_rb__copy__rfrhr`rl__iter__rornrqrGrsrDryr|rrrrrrr]s6            rcs*eZdZ dZddZfddZZS)r\r<cCst|||}||_|Sr')rr#r<)r"obrr<rrrrr#\szKeyedRef.__new__cst||dSr')r(rF)rrrr<r*rrrFazKeyedRef.__init__)r3r4r5r6r#rFr8rrr*rr\Ps  r\c@seZdZ d0ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ e Z ddZ d0ddZddZddZddZeZddZd d!Zd"d#Zd$d%Zd0d&d'Zd0d(d)Zd*d+Zd,d-Zd.d/ZdS)1r NcCsJi|_t|fdd}||_g|_t|_d|_|dur#||dSdS)NcSsL|}|dur$|jr|j|dSz|j|=WdSty#YdSwdSr')r9r:r;r=rL)rjr?rrrrrArs z*WeakKeyDictionary.__init__..removeF)r=rrBr:rCr9 _dirty_lenrD)rrvrArrrrFps zWeakKeyDictionary.__init__cCsP|jj}|j} z|}Wn tyYdSwz||=Wn ty&Ynwqr')r:rGr=rHrL)rrGrIr<rrrrJs    z"WeakKeyDictionary._commit_removalscs&|jfdd|jD|_d|_dS)Ncsg|]}|vr|qSrr).0rjrIrr sz5WeakKeyDictionary._scrub_removals..F)r=r:rrSrrr_scrub_removalss z!WeakKeyDictionary._scrub_removalscCsd|_|jt|=dSNT)rr=rrPrrrrQszWeakKeyDictionary.__delitem__cCs|jt|Sr')r=rrPrrrrOszWeakKeyDictionary.__getitem__cCs(|jr |jr |t|jt|jSr')rr:rrRr=rSrrrrTs zWeakKeyDictionary.__len__cCrVrWrXrSrrrrZr[zWeakKeyDictionary.__repr__cCs||jt||j<dSr')r=rrBr]rrrr_zWeakKeyDictionary.__setitem__cCs^t}t||jD]\}}|}|dur|||<q Wd|S1s(wY|Sr')r r r=r`)rrar<r^rNrrrrbs  zWeakKeyDictionary.copycCsrddlm}|}t|!|jD]\}}|}|dur&|||||<qWd|S1s2wY|Src)rbrdr+r r=r`)rrerdrar<r^rNrrrrfs   zWeakKeyDictionary.__deepcopy__cCs|jt||Sr')r=rhrrr<rgrrrrhrzWeakKeyDictionary.getcCs,zt|}Wn tyYdSw||jvSr)rr r=)rr<r>rrrrUs    zWeakKeyDictionary.__contains__ccs\t||jD]\}}|}|dur||fVq WddS1s'wYdSr'r r=r`)rr>r^r<rrrr`s  "zWeakKeyDictionary.itemsccsPt||jD] }|}|dur|Vq WddS1s!wYdSr')r r=rprrrrls  "zWeakKeyDictionary.keysccsTt||jD] \}}|dur|Vq WddS1s#wYdSr'r)rr>r^rrrrns  "zWeakKeyDictionary.valuescCs t|jSr')rxr=rSrrrkeyrefss zWeakKeyDictionary.keyrefscCs.d|_ |j\}}|}|dur||fSqr)rr=rq)rr<r^rNrrrrqszWeakKeyDictionary.popitemcGsd|_|jjt|g|RSr)rr=rGr)rr<rrrrrrGszWeakKeyDictionary.popcCs|jt||j|Sr')r=rsrrBrrrrrsrzWeakKeyDictionary.setdefaultcKs`|j}|dur#t|dsti|}|D] \}}||t||j<qt|r.||dSdSrt)r=rur"r`rrBrRrD)rrvrwrIr<r^rrrrDs  zWeakKeyDictionary.updatecCrzr'r{r/rrrr| r}zWeakKeyDictionary.__ior__cCr~r'rrrrrr rzWeakKeyDictionary.__or__cCrr'rrrrrrrzWeakKeyDictionary.__ror__r')r3r4r5rFrJrrQrOrTrZr_rbrrfrhrUr`rlrrnrrqrGrsrDr|rrrrrrr es6        r c@seZdZ dZiZdZeZdZ dZ GdddZ ddZ ddd Z d d Zd d ZeddZeddZejddZddZeddZeddZdS)rrFc@seZdZdZdS)zfinalize._Info)weakrefr&rrrwatexitindexN)r3r4r5r6rrrr_Info6srcOsp|jsddl}||jdt_|}t|||_||_||_ |p#d|_ d|_t |j |_ ||j|<dt_dS)NrT)_registered_with_atexitrregister _exitfuncrrrrr&rrrwnext _index_iterr _registry_dirty)rr%r&rrrwrinforrrrF9s      zfinalize.__init__NcCs: |j|d}|r|js|j|ji|jpiSdSdSr')rrG _shutdownr&rrrw)r_rrrrr)Js  zfinalize.__call__cCsN |j|}|o |}|dur#|j|dr%||j|j|jp!ifSdSdSr')rrhrrGr&rrrwrrr%rrrdetachQs   zfinalize.detachcCs< |j|}|o |}|dur||j|j|jpifSdSr')rrhrr&rrrwrrrrpeekYs   z finalize.peekcCs ||jvSr')rrSrrraliveas zfinalize.alivecCs |j|}t|o |jSr'rrhboolr)rrrrrrfs zfinalize.atexitcCs"|j|}|rt||_dSdSr'r)rr^rrrrrls cCsZ|j|}|o |}|durdt|jt|fSdt|jt|t|jt|fS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)rrhrr"r3rYrrrrrZrs  zfinalize.__repr__cCs2dd|jD}|jddddd|DS)NcSsg|] \}}|jr||fqSr)rrfirrrr~sz-finalize._select_for_exit..cSs |djS)N)r)itemrrrs z+finalize._select_for_exit..rcSsg|]\}}|qSrrrrrrrs)rr`sort)r$Lrrr_select_for_exit{szfinalize._select_for_exitcCsd}zN|jrCddl}|rd}|d} |dustjr%|}dt_|s(n|}z|WntyAt j t YnwqWdt_ |rO| dSdSdt_ |r[| ww)NFrT)rgcZ isenableddisablerrrrG Exceptionsys excepthookexc_inforZenable)r$Z reenable_gcrpendingrrrrrs<    zfinalize._exitfuncr')r3r4r5r6rr itertoolscountrrrrrFr)rrpropertyrrsetterrZ classmethodrrrrrrrs0     r)_weakrefrrrrrrrr Z _weakrefsetr r rrrr __all__Setr MutableSetrMutableMappingrr\r rrrrrs"(    6t9