Files
952-11/env/python/dll/Python312/Lib/__pycache__/weakref.cpython-312.pyc
T

147 lines
31 KiB
Plaintext
Raw Normal View History

2024-08-19 17:05:14 +08:00
Ë
*åf«Vãó2—dZddlmZmZmZmZmZmZmZm Z ddl
m Z m Z ddl
Z
ddlZddlZeefZgd¢Ze
j$j'e «Gd„de«ZGd„d e
j*«ZGd
„d e«ZGd „d
e
j*«ZGd„d«Zy)ztWeak reference support for Python.
This module is an implementation of PEP 205:
https://peps.python.org/pep-0205/
é)ÚgetweakrefcountÚ getweakrefsÚrefÚproxyÚCallableProxyTypeÚ ProxyTypeÚ
ReferenceTypeÚ_remove_dead_weakref)ÚWeakSetÚ_IterationGuardN)
rrrrÚWeakKeyDictionaryr rrÚ
ProxyTypesÚWeakValueDictionaryr Ú
WeakMethodÚfinalizecóR‡—eZdZdZdZdd„Zˆfd„Zd„Zd„Ze jZ
ˆxZ S)rz—
A custom `weakref.ref` subclass which simulates a weak reference to
a bound method, working around the lifetime problem of bound methods.
)Ú _func_refÚ
_meth_typeÚ_aliveÚ __weakref__có>‡‡— |j}|j}ˆˆfd„}t
j|||«}t
||«|_t |«|_ d|_
t
|«Š|S#t$r%tdj t |«««d‚wxYw)Nz)argument should be a bound method, not {}cóR•—‰«}|jrd|_‰� ‰|«yyy©NF)r)ÚargÚselfÚcallbackÚself_wrs €€úCC:\Users\RCi\AppData\Local\Programs\Python\Python312\Lib\weakref.pyÚ_cbzWeakMethod.__new__.<locals>._cb5s1ø€ñ“9ˆDØ�{Š{Ø#�” ØÐ'Ù˜T•Nð(ðóT) Ú__self__Ú__func__ÚAttributeErrorÚ TypeErrorÚformatÚtyperÚ__new__rrr)ÚclsÚmethrÚobjÚfuncrrrs ` @rr'zWeakMethod.__new__.s’ù€ð ;Ø—-‘-ˆCØ—=‘=ˆDõ #ô�{‰{˜3  SÓ)ˆÜ˜T 3›ˆŒÜ˜t›*ˆŒØˆŒ Ü�d“)ˆØˆ øô!ò ;ÜÐGß#™V¤D¨£JÓ/ó1Ø6:ð
;ð ;ús „A.Á..Bcón•—t‰|�«}|j«}|�|€y|j||«S©N)ÚsuperÚ__call__rr)rr*r+Ú __class__s €rr/zWeakMethod.__call__Ds9ø€Ü‰gÑÓ ˆØ�~‰~ÓˆØ ˆ;˜$˜,ØØ�‰˜t SÓ)Ð)r cóÈ—t|t«rM|jr |js||uStj||«xr|j
|j
k(St Sr-)Ú
isinstancerrrÚ__eq__rÚNotImplemented©rÚothers rr3zWeakMethod.__eq__KsL€Ü �eœZÔ (Ø—;’; e§l¢lؘu�}Ð$Ü—:‘:˜d EÓ*ÒP¨t¯~©~ÀÇÁÑ/PÐ PÜÐr cóÈ—t|t«rM|jr |js||uStj||«xs|j
|j
k7St Sr-)r2rrrÚ__ne__rr4r5s rr8zWeakMethod.__ne__RsM€Ü �eœZÔ (Ø—;’; e§l¢lØ 5Ð(Ð(Ü—:‘:˜d EÓ*ÒO¨d¯n©nÀÇÁÑ.OÐ OÜÐr r-) Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú __slots__r'r/r3r8rÚ__hash__Ú
__classcell__©r0s@rrr&s/ø„ñð
C€Ióô,*òòð�|‰|„Hr rcó®—eZdZdZdd„Zefd„Zd„Zd„Zd„Z d„Z
d„Z d „Z d
„Z
e
Zd „Zdd
„Zd„Zd„ZeZd„Zd„Zd„Zd„Zdd„Zdd„Zd„Zd„Zd„Zd„Zy )rz›Mapping class that references values weakly.
Entries in the dictionary will be discarded when no strong
reference to the value exists anymore
c ó˜—t|«tfd„}||_g|_t «|_i|_|j|fi|¤Žy)Ncó¶—|«}|�P|jr&|jj|j«y||j|j«yyr-)Ú
_iteratingÚ_pending_removalsÚappendÚkeyÚdata)ÚwrÚselfrefÚ_atomic_removalrs rÚremovez,WeakValueDictionary.__init__.<locals>.removeisG€Ù“9ˆDØÐØ—?’?Ø×*Ñ*×1Ñ1°"·&±&Õ9ñ$ D§I¡I¨r¯v©vÕ6ð
 r )rr
Ú_removerEÚsetrDrHÚupdate)rr6ÚkwrLs rÚ__init__zWeakValueDictionary.__init__hsE€Ü" 4›yÔ:Nó 7ðˆŒ à!#ˆÔÜ›%ˆŒØˆŒ ؈� ‰ �EÑ ˜RÓ r cóŠ—|jj}|j} |«}|||«Œ#t$rYywxYwr-)rEÚpoprHÚ
IndexError)rrKrSÚdrGs rÚ_commit_removalsz$WeakValueDictionary._commit_removalsysR€Ø×$Ñ$×(Ñ(ˆØ �I‰Iˆðð
Ù“e�ñ
˜A˜sÔ #ð øôò
Ùð
ús¥6¶ AÁAcó€—|jr|j«|j|«}|€ t|«‚|Sr-©rErVrHÚKeyError©rrGÚos rÚ __getitem__zWeakValueDictionary.__getitem__…s=€Ø × !Ò !Ø × !Ñ !Ô #Ø ˆD�I‰I�c‰NÓ ˆØ ˆ9ܘ3“-Ð àˆHr cóV—|jr|j«|j|=yr-)rErVrH©rrGs rÚ __delitem__zWeakValueDictionary.__delitem__Žs"€Ø × !Ò !Ø × !Ñ !Ô #Ø �I‰I�c‰Nr cód—|jr|j«t|j«Sr-)rErVÚlenrH©rs rÚ__len__zWeakValueDictionary.__len__“s%€Ø × !Ò !Ø × !Ñ !Ô #Ü�4—9‘9‹~Ðr cóŠ—|jr|j« |j|«}|duS#t$rYywxYwrrXrZs rÚ __contains__z WeakValueDictionary.__contains__˜sN€Ø × !Ò !Ø × !Ñ !Ô #ð Ø�— ‘ ˜#‘Ó ˆAð˜ˆ}Ðøôò Ùð úsž6¶ AÁAcóJ—d|jjt|«fzS©Nz <%s at %#x>©r0r9Úidrbs rÚ__repr__zWeakValueDictionary.__repr__¡ó €Ø §¡× 7Ñ 7¼¸D»ÐBÑBÐBr có„—|jr|j«t||j|«|j|<yr-)rErVÚKeyedRefrMrH©rrGÚvalues rÚ __setitem__zWeakValueDictionary.__setitem__¤s1€Ø × !Ò !Ø × !Ñ !Ô #Ü! %¨¯©°sÓ;ˆ� ‰ �#Šr cóø—|jr|j«t«}t|«5|jj «D]\}}|«}|€Œ|||<Œ ddd«|S#1swY|SxYwr-)rErVrr rHÚitems)rÚnewrGrIr[s rÚcopyzWeakValueDictionary.copy©sx€Ø × !Ò !Ø × !Ñ !Ô #Ü!Ó#ˆÜ
˜TÓ
"ñ !ØŸ9™9Ÿ?™?Ó,ò
!‘��RÙ“D�Ø‘=Ø �C˜’Hñ
!÷ !ð
ˆ
÷  !ð
ˆ
ús²*A/ÁA/Á/A9có—ddlm}|jr|j«|j «}t |«5|j j«D]\}}|«}|€Œ|||||«<Œ ddd«|S#1swY|SxYw©Nr)Údeepcopy)rtrwrErVr0r rHrr)rÚmemorwrsrGrIr[s rÚ __deepcopy__z WeakValueDictionary.__deepcopy__¶s‡€Ý!Ø × !Ò !Ø × !Ñ !Ô #Ø�n‰nÓˆÜ
˜TÓ
"ñ 1ØŸ9™9Ÿ?™?Ó,ò
1‘��RÙ“D�Ø‘=Ø/0�C™  dÓ+Ò,ñ
1÷ 1ð
ˆ
÷  1ð
ˆ
ús¾*BÁ)BÂB Ncó–—|jr|j« |j|}|«}|€|S|S#t$r|cYSwxYwr-rX)rrGÚdefaultrIr[s rÚgetzWeakValueDictionary.getÂsW€Ø × !Ò !Ø × !Ñ !Ô #ð
Ø—‘˜3‘ˆBñ“ˆA؈yà�à�øôò ØŠNð úsž:º AÁAc#óêK—|jr|j«t|«5|jj «D]\}}|«}|€Œ||f–—Œ ddd«y#1swYyxYw­wr-©rErVr rHrr)rÚkrIÚvs rrrzWeakValueDictionary.itemsÑsjèø€Ø × !Ò !Ø × !Ñ !Ô #Ü
˜TÓ
"ñ ØŸ™Ÿ™Ó*ò
‘��2Ù“D�Ø‘=ؘQ˜$“Jñ
÷ ÷ ñ üs"‚(A3ª*A'ÁA'Á A3Á'A0Á,A3c#óâK—|jr|j«t|«5|jj «D]\}}|«€Œ|–—Œ ddd«y#1swYyxYw­wr-r~)rrrIs rÚkeyszWeakValueDictionary.keysÚsbèø€Ø × !Ò !Ø × !Ñ !Ô #Ü
˜TÓ
"ñ ØŸ™Ÿ™Ó*ò
‘��2Ù“4Ñ#Ø“Gñ
÷ ÷ ñ üs"‚(A/ª(A#ÁA#Á A/Á#A,Á(A/c#óÌK—|jr|j«t|«5|jj «Ed{–—†ddd«y7Œ
#1swYyxYw­w)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©rErVr rHÚvaluesrbs rÚ
itervaluerefsz!WeakValueDictionary.itervaluerefsäsXèø€ð × !Ò !Ø × !Ñ !Ô #Ü
˜TÓ
"ñ *Ø—y‘y×'Ñ'Ó)× )Ð )÷ *ð *Ø )ø÷ *ð *üs.‚(A$ªAÁAÁ AÁ
A$ÁAÁA!ÁA$c#óàK—|jr|j«t|«5|jj «D]}|«}|€Œ
|–—Œ ddd«y#1swYyxYw­wr-r„©rrIr*s rr…zWeakValueDictionary.valuesósdèø€Ø × !Ò !Ø × !Ñ !Ô #Ü
˜TÓ
"ñ Ø—i‘i×&Ñ&Ó(ò
�Ù“d�Ø‘?Ø“Iñ
÷ ÷ ñ üs"‚(A.ª'A"ÁA"Á A.Á"A+Á'A.có’—|jr|j« |jj«\}}|«}|�||fSŒ+r-)rErVrHÚpopitem)rrGrIr[s rrŠzWeakValueDictionary.popitemüsJ€Ø × !Ò !Ø × !Ñ !Ô #ØØ—i‘i×'Ñ'Ó)‰GˆC�Ù“ˆA؈}ؘA�v�
ð r cóÊ—|jr|j« |jj|««}|€|r|dSt |«‚|S#t$rd}YŒ#wxYw)Nr)rErVrHrSrY)rrGÚargsr[s rrSzWeakValueDictionary.popsk€Ø × !Ò !Ø × !Ñ !Ô #ð Ø"�— ‘ —
‘
˜cÓ"Ó$ˆAð
ˆ9ÙØ˜A‘w�ä˜s“mÐ#àˆHøôò ØŠAð úsž AÁ A"Á!A"cóÚ— |j|«}|€B|jr|j«t ||j
|«|j|<|S|S#t$rd}YŒSwxYwr-)rHrYrErVrmrM)rrGr{r[s rÚ
setdefaultzWeakValueDictionary.setdefaultso€ð Ø�— ‘ ˜#‘Ó ˆAð
ˆ9Ø×%Ò%Ø×%Ñ%Ô'Ü% g¨t¯|©|¸SÓAˆD�I‰I�c‰N؈NàˆHøôò ØŠAð ús‚AÁ A*Á)A*c óN—|jr|j«|j}|�It|d«s t |«}|j «D]\}}t
||j|«||<Œ!|j «D]\}}t
||j|«||<Œ!y©Nrr)rErVrHÚhasattrÚdictrrrmrM)rr6ÚkwargsrUrGr[s rrOzWeakValueDictionary.update!s—€Ø × !Ò !Ø × !Ñ !Ô #Ø �I‰IˆØ Рܘ5 'Ô*ܘU› �ØŸ+™+›-ò
8‘��QÜ! ! T§\¡\°3Ó7��#’ð
8à—l‘l“nò 4‰FˆC�ܘa §¡¨sÓ3ˆAˆcŠFñ 4r có€—|jr|j«t|jj ««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.
)rErVÚlistrHr…rbs rÚ valuerefszWeakValueDictionary.valuerefs-s1€ð × !Ò !Ø × !Ñ !Ô #Ü�D—I‘I×$Ñ$Ó&Ó'Ð'r có(—|j|«|Sr-©rOr5s rÚ__ior__zWeakValueDictionary.__ior__;ó€Ø � ‰ �EÔØˆ r cóˆ—t|tj«r#|j«}|j |«|St
Sr-©r2Ú_collections_abcÚMappingrtrOr4©rr6Úcs rÚ__or__zWeakValueDictionary.__or__?ó4€Ü �eÔ-×5Ñ5Ô 6Ø— ‘ “ ˆAØ
�H‰H�UŒO؈HÜÐr cóª—t|tj«r4|j«}|j |«|j |«|St
Sr-©r2r�ržr0rOr4rŸs rÚ__ror__zWeakValueDictionary.__ror__Fó@€Ü �eÔ-×5Ñ5Ô 6Ø—‘Ó ˆAØ
�H‰H�UŒOØ
�H‰H�TŒN؈HÜÐr )©r-)r9r:r;r<rQr
rVr\r_rcrerjrprtÚ__copy__ryr|rrr‚Ú__iter__r†r…rŠrSrŽrOr–r™r¡r¥r§r rrr\s�„ñó!ð"0Dó
$òòò
ò
òCò<ò
ð€Hò
ó
òòð€Hò
*òòò
ó ó
4ò (òòór rcó,‡—eZdZdZdZd„Zˆfd„ZˆxZS)rma[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.
©rGcóB—tj|||«}||_|Sr-)rr'rG)r&ÚobrrGrs rr'zKeyedRef.__new__[s €Ü�{‰{˜4  XÓ.ˆØˆŒØˆ r có&•—t‰|�||«yr-)r.rQ)rr­rrGr0s €rrQzKeyedRef.__init__`sø€Ü
‰Ñ˜˜XÕ&r )r9r:r;r<r=r'rQr?r@s@rrmrmOsø„ñð€Iò÷
'ð'r rmcóª—eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z d „Z
d
„Z d „Z e Z
d „Zdd
„Zd„Zd„Zd„ZeZd„Zd„Zd„Zd„Zdd„Zdd„Zd„Zd„Zd„Zy)r
a‰ Mapping class that references keys weakly.
Entries in the dictionary will be discarded when there is no