3 ุ ๗^Iใ@s2ddlmZdgZGdd„dƒZGdd„dƒZdS)้)ฺrefฺWeakSetc@s$eZdZdd„Zdd„Zdd„ZdS)ฺ_IterationGuardcCst|ƒ|_dS)N)rฺ weakcontainer)ฺselfrฉr๚#/usr/lib64/python3.6/_weakrefset.pyฺ__init__sz_IterationGuard.__init__cCs |jƒ}|dk r|jj|ƒ|S)N)rฺ _iteratingฺadd)rฺwrrrฺ __enter__s z_IterationGuard.__enter__cCs0|jƒ}|dk r,|j}|j|ƒ|s,|jƒdS)N)rr ฺremoveฺ_commit_removals)rฺeฺtฺbr ฺsrrrฺ__exit__s  z_IterationGuard.__exit__N)ฺ__name__ฺ __module__ฺ __qualname__r r rrrrrr src@seZdZd>dd„Zdd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„ZeZd d!„Zd"d#„Zd$d%„ZeZd&d'„Zd(d)„Zd*d+„ZeZd,d-„Zd.d/„ZeZd0d1„Zd2d3„Zd4d5„Z e Z!d6d7„Z"d8d9„Z#d:d;„Z$e$Z%d|j|ƒdS)NcSs2|ƒ}|dk r.|jr"|jj|ƒn |jj|ƒdS)N)r ฺ_pending_removalsฺappendฺdataฺdiscard)ฺitemฺselfrefrrrrฺ_remove&s z!WeakSet.__init__.._remove)ฺsetrrrrr ฺupdate)rrrrrrr $szWeakSet.__init__cCs(|j}|jj}x|r"||jƒƒqWdS)N)rrrฺpop)rฺlrrrrr4szWeakSet._commit_removalsc cs<t|ƒ*x"|jD]}|ƒ}|dk r|VqWWdQRXdS)N)rr)rฺitemrefrrrrฺ__iter__:s   zWeakSet.__iter__cCst|jƒt|jƒS)N)ฺlenrr)rrrrฺ__len__CszWeakSet.__len__c Cs,y t|ƒ}Wntk r dSX||jkS)NF)rฺ TypeErrorr)rrฺwrrrrฺ __contains__Fs  zWeakSet.__contains__cCs|jt|ƒft|ddƒfS)Nฺ__dict__)ฺ __class__ฺlistฺgetattr)rrrrฺ __reduce__Ms zWeakSet.__reduce__cCs&|jr|jƒ|jjt||jƒƒdS)N)rrrr rr)rrrrrr Qsz WeakSet.addcCs|jr|jƒ|jjƒdS)N)rrrฺclear)rrrrr/Vsz WeakSet.clearcCs |j|ƒS)N)r+)rrrrฺcopy[sz WeakSet.copyc CsV|jr|jƒxBy|jjƒ}Wntk r:tdƒ‚YnX|ƒ}|dk r|SqWdS)Nzpop from empty WeakSet)rrrr!ฺKeyError)rr#rrrrr!^sz WeakSet.popcCs"|jr|jƒ|jjt|ƒƒdS)N)rrrrr)rrrrrrjszWeakSet.removecCs"|jr|jƒ|jjt|ƒƒdS)N)rrrrr)rrrrrroszWeakSet.discardcCs*|jr|jƒx|D]}|j|ƒqWdS)N)rrr )rฺotherฺelementrrrr ts zWeakSet.updatecCs|j|ƒ|S)N)r )rr2rrrฺ__ior__zs zWeakSet.__ior__cCs|jƒ}|j|ƒ|S)N)r0ฺdifference_update)rr2ฺnewsetrrrฺ difference~s zWeakSet.differencecCs|j|ƒdS)N)ฺ__isub__)rr2rrrr5„szWeakSet.difference_updatecCs<|jr|jƒ||kr"|jjƒn|jjdd„|Dƒƒ|S)Ncss|]}t|ƒVqdS)N)r)ฺ.0rrrr๚ Œsz#WeakSet.__isub__..)rrrr/r5)rr2rrrr8†s  zWeakSet.__isub__csˆj‡fdd„|DƒƒS)Nc3s|]}|ˆkr|VqdS)Nr)r9r)rrrr:sz'WeakSet.intersection..)r+)rr2r)rrฺ intersectionszWeakSet.intersectioncCs|j|ƒdS)N)ฺ__iand__)rr2rrrฺintersection_update“szWeakSet.intersection_updatecCs(|jr|jƒ|jjdd„|Dƒƒ|S)Ncss|]}t|ƒVqdS)N)r)r9rrrrr:˜sz#WeakSet.__iand__..)rrrr=)rr2rrrr<•szWeakSet.__iand__cCs|jjdd„|DƒƒS)Ncss|]}t|ƒVqdS)N)r)r9rrrrr:œsz#WeakSet.issubset..)rฺissubset)rr2rrrr>›szWeakSet.issubsetcCs|jtdd„|DƒƒkS)Ncss|]}t|ƒVqdS)N)r)r9rrrrr: sz!WeakSet.__lt__..)rr)rr2rrrฺ__lt__ŸszWeakSet.__lt__cCs|jjdd„|DƒƒS)Ncss|]}t|ƒVqdS)N)r)r9rrrrr:ฃsz%WeakSet.issuperset..)rฺ issuperset)rr2rrrr@ขszWeakSet.issupersetcCs|jtdd„|DƒƒkS)Ncss|]}t|ƒVqdS)N)r)r9rrrrr:งsz!WeakSet.__gt__..)rr)rr2rrrฺ__gt__ฆszWeakSet.__gt__cCs(t||jƒstS|jtdd„|DƒƒkS)Ncss|]}t|ƒVqdS)N)r)r9rrrrr:ฌsz!WeakSet.__eq__..)ฺ isinstancer+ฺNotImplementedrr)rr2rrrฺ__eq__ฉs zWeakSet.__eq__cCs|jƒ}|j|ƒ|S)N)r0ฺsymmetric_difference_update)rr2r6rrrฺsymmetric_differenceฎs zWeakSet.symmetric_differencecCs|j|ƒdS)N)ฺ__ixor__)rr2rrrrEดsz#WeakSet.symmetric_difference_updatecs@ˆjrˆjƒˆ|kr"ˆjjƒnˆjj‡fdd„|DƒƒˆS)Nc3s|]}t|ˆjƒVqdS)N)rr)r9r)rrrr:ผsz#WeakSet.__ixor__..)rrrr/rE)rr2r)rrrGถs  zWeakSet.__ixor__cCs|jdd„||fDƒƒS)Ncss|]}|D] }|Vq qdS)Nr)r9rrrrrr:ภsz WeakSet.union..)r+)rr2rrrฺunionฟsz WeakSet.unioncCst|j|ƒƒdkS)Nr)r%r;)rr2rrrฺ isdisjointรszWeakSet.isdisjoint)N)'rrrr rr$r&r)r.r r/r0r!rrr r4r7ฺ__sub__r5r8r;ฺ__and__r=r<r>ฺ__le__r?r@ฺ__ge__rArDrFฺ__xor__rErGrHฺ__or__rIrrrrr#sH     N)ฺ_weakrefrฺ__all__rrrrrrฺs