a DOg#@s>ddlmZddlmZdgZGdddZGdddZdS)ref) GenericAliasWeakSetc@s$eZdZddZddZddZdS)_IterationGuardcCst||_dSN)r weakcontainer)selfrr #/usr/lib64/python3.9/_weakrefset.py__init__sz_IterationGuard.__init__cCs |}|dur|j||Sr)r _iteratingadd)r wr r r __enter__s z_IterationGuard.__enter__cCs0|}|dur,|j}|||s,|dSr)rr remove_commit_removals)r etbrsr r r __exit__s  z_IterationGuard.__exit__N)__name__ __module__ __qualname__r rrr r r r r src@s&eZdZd@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%dd?Z'e(e)Z*dS)ArNcCsBt|_t|fdd}||_g|_t|_|dur>||dS)NcSs2|}|dur.|jr"|j|n |j|dSr)r _pending_removalsappenddatadiscard)itemselfrefr r r r _remove's z!WeakSet.__init__.._remove)setrrr!rr update)r rr!r r r r %szWeakSet.__init__cCs>|jj}|jj}z |}Wnty.YdS0||qdSr)rpoprr IndexError)r r$rrr r r r5s  zWeakSet._commit_removalsccsLt|0|jD]}|}|dur|VqWdn1s>0YdSr)rrr itemrefrr r r __iter__?s   zWeakSet.__iter__cCst|jt|jSr)lenrrr r r r __len__HszWeakSet.__len__cCs,z t|}Wnty YdS0||jvS)NF)r TypeErrorr)r rwrr r r __contains__Ks   zWeakSet.__contains__cCs|jt|ft|ddfS)N__dict__) __class__listgetattrr*r r r __reduce__Rs  zWeakSet.__reduce__cCs&|jr||jt||jdSr)rrrrrr!r rr r r rVsz WeakSet.addcCs|jr||jdSr)rrrclearr*r r r r5[sz WeakSet.clearcCs ||Srr0r*r r r copy`sz WeakSet.copycCsR|jr|z|j}Wnty8tddYn0|}|dur|SqdS)Nzpop from empty WeakSet)rrrr$KeyErrorr&r r r r$cs z WeakSet.popcCs"|jr||jt|dSr)rrrrrr4r r r roszWeakSet.removecCs"|jr||jt|dSr)rrrrrr4r r r rtszWeakSet.discardcCs&|jr||D]}||qdSr)rrr)r otherelementr r r r#yszWeakSet.updatecCs|||Sr)r#r r9r r r __ior__s zWeakSet.__ior__cCs|}|||Sr)r7difference_updater r9newsetr r r differences zWeakSet.differencecCs||dSr)__isub__r;r r r r=szWeakSet.difference_updatecCs<|jr|||ur"|jn|jdd|D|S)Ncss|]}t|VqdSrr.0rr r r z#WeakSet.__isub__..)rrrr5r=r;r r r rAs  zWeakSet.__isub__csfdd|DS)Nc3s|]}|vr|VqdSrr rBr*r r rDrEz'WeakSet.intersection..r6r;r r*r intersectionszWeakSet.intersectioncCs||dSr)__iand__r;r r r intersection_updateszWeakSet.intersection_updatecCs(|jr||jdd|D|S)Ncss|]}t|VqdSrrrBr r r rDrEz#WeakSet.__iand__..)rrrrHr;r r r rGszWeakSet.__iand__cCs|jdd|DS)Ncss|]}t|VqdSrrrBr r r rDrEz#WeakSet.issubset..)rissubsetr;r r r rIszWeakSet.issubsetcCs|jttt|kSrrr"maprr;r r r __lt__szWeakSet.__lt__cCs|jdd|DS)Ncss|]}t|VqdSrrrBr r r rDrEz%WeakSet.issuperset..)r issupersetr;r r r rMszWeakSet.issupersetcCs|jttt|kSrrJr;r r r __gt__szWeakSet.__gt__cCs$t||jstS|jttt|kSr) isinstancer0NotImplementedrr"rKrr;r r r __eq__s zWeakSet.__eq__cCs|}|||Sr)r7symmetric_difference_updater>r r r symmetric_differences zWeakSet.symmetric_differencecCs||dSr)__ixor__r;r r r rRsz#WeakSet.symmetric_difference_updatecs@jr|ur"jnjfdd|DS)Nc3s|]}t|jVqdSr)rr!rBr*r r rDrEz#WeakSet.__ixor__..)rrrr5rRr;r r*r rTs  zWeakSet.__ixor__cCs|dd||fDS)Ncss|]}|D] }|Vq qdSrr )rCrrr r r rDrEz WeakSet.union..r6r;r r r unionsz WeakSet.unioncCst||dkS)Nr)r)rFr;r r r isdisjointszWeakSet.isdisjointcCs t|jSr)reprrr*r r r __repr__szWeakSet.__repr__)N)+rrrr rr(r+r.r3rr5r7r$rrr#r<r@__sub__r=rArF__and__rHrGrI__le__rLrM__ge__rNrQrS__xor__rRrTrU__or__rVrX classmethodr__class_getitem__r r r r r$sL      N)_weakrefrtypesr__all__rrr r r r s