3 \I@s2ddlmZdgZGdddZGdddZdS))refWeakSetc@s$eZdZddZddZddZdS)_IterationGuardcCst||_dS)N)r weakcontainer)selfrr#/usr/lib64/python3.6/_weakrefset.py__init__sz_IterationGuard.__init__cCs |j}|dk r|jj||S)N)r _iteratingadd)rwrrr __enter__s z_IterationGuard.__enter__cCs0|j}|dk r,|j}|j||s,|jdS)N)rr remove_commit_removals)retbr srrr__exit__s  z_IterationGuard.__exit__N)__name__ __module__ __qualname__r r rrrrrr src@seZdZd>ddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZeZd d!Zd"d#Zd$d%ZeZd&d'Zd(d)Zd*d+ZeZd,d-Zd.d/ZeZd0d1Zd2d3Zd4d5Z e Z!d6d7Z"d8d9Z#d:d;Z$e$Z%d|j|dS)NcSs2|}|dk r.|jr"|jj|n |jj|dS)N)r _pending_removalsappenddatadiscard)itemselfrefrrrr_remove&s z!WeakSet.__init__.._remove)setrrrrr update)rrrrrrr $szWeakSet.__init__cCs(|j}|jj}x|r"||jqWdS)N)rrrpop)rlrrrrr4szWeakSet._commit_removalsc cs<t|*x"|jD]}|}|dk r|VqWWdQRXdS)N)rr)ritemrefrrrr__iter__:s   zWeakSet.__iter__cCst|jt|jS)N)lenrr)rrrr__len__CszWeakSet.__len__c Cs,y t|}Wntk r dSX||jkS)NF)r TypeErrorr)rrwrrrr __contains__Fs  zWeakSet.__contains__cCs|jt|ft|ddfS)N__dict__) __class__listgetattr)rrrr __reduce__Ms zWeakSet.__reduce__cCs&|jr|j|jjt||jdS)N)rrrr rr)rrrrrr Qsz WeakSet.addcCs|jr|j|jjdS)N)rrrclear)rrrrr/Vsz WeakSet.clearcCs |j|S)N)r+)rrrrcopy[sz WeakSet.copyc CsV|jr|jxBy|jj}Wntk r:tdYnX|}|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|jx|D]}|j|qWdS)N)rrr )rotherelementrrrr ts zWeakSet.updatecCs|j||S)N)r )rr2rrr__ior__zs zWeakSet.__ior__cCs|j}|j||S)N)r0difference_update)rr2newsetrrr difference~s zWeakSet.differencecCs|j|dS)N)__isub__)rr2rrrr5szWeakSet.difference_updatecCs<|jr|j||kr"|jjn|jjdd|D|S)Ncss|]}t|VqdS)N)r).0rrrr sz#WeakSet.__isub__..)rrrr/r5)rr2rrrr8s  zWeakSet.__isub__csjfdd|DS)Nc3s|]}|kr|VqdS)Nr)r9r)rrrr:sz'WeakSet.intersection..)r+)rr2r)rr intersectionszWeakSet.intersectioncCs|j|dS)N)__iand__)rr2rrrintersection_updateszWeakSet.intersection_updatecCs(|jr|j|jjdd|D|S)Ncss|]}t|VqdS)N)r)r9rrrrr:sz#WeakSet.__iand__..)rrrr=)rr2rrrr<szWeakSet.__iand__cCs|jjdd|DS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz#WeakSet.issubset..)rissubset)rr2rrrr>szWeakSet.issubsetcCs|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__lt__..)rr)rr2rrr__lt__szWeakSet.__lt__cCs|jjdd|DS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz%WeakSet.issuperset..)r issuperset)rr2rrrr@szWeakSet.issupersetcCs|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__gt__..)rr)rr2rrr__gt__szWeakSet.__gt__cCs(t||jstS|jtdd|DkS)Ncss|]}t|VqdS)N)r)r9rrrrr:sz!WeakSet.__eq__..) isinstancer+NotImplementedrr)rr2rrr__eq__s zWeakSet.__eq__cCs|j}|j||S)N)r0symmetric_difference_update)rr2r6rrrsymmetric_differences zWeakSet.symmetric_differencecCs|j|dS)N)__ixor__)rr2rrrrEsz#WeakSet.symmetric_difference_updatecs@jrj|kr"jjnjjfdd|DS)Nc3s|]}t|jVqdS)N)rr)r9r)rrrr:sz#WeakSet.__ixor__..)rrrr/rE)rr2r)rrrGs  zWeakSet.__ixor__cCs|jdd||fDS)Ncss|]}|D] }|Vq qdS)Nr)r9rrrrrr:sz WeakSet.union..)r+)rr2rrrunionsz WeakSet.unioncCst|j|dkS)Nr)r%r;)rr2rrr isdisjointszWeakSet.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__rrrrrrs