B /g^/c@s2ddlmZdgZGdddZGdddZdS)refWeakSetc@s$eZdZddZddZddZdS)_IterationGuardcCst||_dSN)r weakcontainer)selfrr#/usr/lib64/python3.7/_weakrefset.py__init__sz_IterationGuard.__init__cCs |}|dk r|j||Sr)r _iteratingadd)rwrrr __enter__s z_IterationGuard.__enter__cCs0|}|dk r,|j}|||s,|dSr)rr remove_commit_removals)reZtZbr srrr __exit__s  z_IterationGuard.__exit__N)__name__ __module__ __qualname__r rrrrrr r 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||dS)NcSs2|}|dk r.|jr"|j|n |j|dSr)r _pending_removalsZappenddatadiscard)itemZselfrefrrrr _remove&s z!WeakSet.__init__.._remove)setrrrrr update)rrrrrr r $szWeakSet.__init__cCs(|j}|jj}x|r"||qWdSr)rrrpop)rZlrrrr r4szWeakSet._commit_removalsc cs<t|*x"|jD]}|}|dk r|VqWWdQRXdSr)rrrZitemrefrrrr __iter__:s   zWeakSet.__iter__cCst|jt|jSr)lenrrrrrr __len__CzWeakSet.__len__cCs,y t|}Wntk r dSX||jkS)NF)rZ TypeErrorr)rrZwrrrr __contains__Fs  zWeakSet.__contains__cCs|jt|ft|ddfS)NZ__dict__) __class__ZlistZgetattrr"rrr __reduce__Ms zWeakSet.__reduce__cCs&|jr||jt||jdSr)rrrr rrrrrrr r Qz WeakSet.addcCs|jr||jdSr)rrrclearr"rrr r*Vr)z WeakSet.clearcCs ||Srr&r"rrr copy[r$z WeakSet.copycCsX|jr|xDy|j}Wntk r<tddYnX|}|dk r|SqWdS)Nzpop from empty WeakSet)rrrrZKeyErrorrrrr r^sz WeakSet.popcC"|jr||jt|dSr)rrrrrr(rrr rjr)zWeakSet.removecCr-r)rrrrrr(rrr ror)zWeakSet.discardcCs*|jr|x|D]}||qWdSr)rrr )rotherZelementrrr rts zWeakSet.updatecCs|||Sr)rrr.rrr __ior__zs zWeakSet.__ior__cC|}|||Sr)r,difference_updaterr.Znewsetrrr difference~ zWeakSet.differencecC||dSr)__isub__r/rrr r2r$zWeakSet.difference_updatecCs<|jr|||kr"|jn|jdd|D|S)Ncs|]}t|VqdSrr.0rrrr z#WeakSet.__isub__..)rrrr*r2r/rrr r7s  zWeakSet.__isub__csfdd|DS)Nc3s|]}|kr|VqdSrrr9r"rr r;r<z'WeakSet.intersection..r+r/rr"r intersectionr$zWeakSet.intersectioncCr6r)__iand__r/rrr intersection_updater$zWeakSet.intersection_updatecCs(|jr||jdd|D|S)Ncsr8rrr9rrr r;r<z#WeakSet.__iand__..)rrrr?r/rrr r>szWeakSet.__iand__cC|jdd|DS)Ncsr8rrr9rrr r;r<z#WeakSet.issubset..)rissubsetr/rrr rAr$zWeakSet.issubsetcCs|jttt|kSrrrmaprr/rrr __lt__r$zWeakSet.__lt__cCr@)Ncsr8rrr9rrr r;r<z%WeakSet.issuperset..)r issupersetr/rrr rEr$zWeakSet.issupersetcCs|jttt|kSrrBr/rrr __gt__r$zWeakSet.__gt__cCs$t||jstS|jttt|kSr)Z isinstancer&ZNotImplementedrrrCrr/rrr __eq__s zWeakSet.__eq__cCr1r)r,symmetric_difference_updater3rrr symmetric_differencer5zWeakSet.symmetric_differencecCr6r)__ixor__r/rrr rHr$z#WeakSet.symmetric_difference_updatecs@jr|kr"jnjfdd|DS)Nc3s|]}t|jVqdSr)rrr9r"rr r;r<z#WeakSet.__ixor__..)rrrr*rHr/rr"r rJs  zWeakSet.__ixor__cCs|dd||fDS)Ncss|]}|D] }|Vq qdSrr)r:rrrrr r;r<z WeakSet.union..r+r/rrr unionr$z WeakSet.unioncCst||dkS)Nr)r!r=r/rrr isdisjointr$zWeakSet.isdisjointr)'rrrr rr r#r%r'r r*r,rrrrr0r4Z__sub__r2r7r=Z__and__r?r>rAZ__le__rDrEZ__ge__rFrGrIZ__xor__rHrJrKZ__or__rLrrrr r#sH     N)Z_weakrefrZ__all__rrrrrr Zs