U e5dg@s2ddlmZdgZGdddZGdddZdS)refWeakSetc@s$eZdZddZddZddZdS)_IterationGuardcCst||_dSN)r weakcontainer)selfrr #/usr/lib64/python3.8/_weakrefset.py__init__sz_IterationGuard.__init__cCs |}|dk r|j||Sr)r _iteratingadd)rwr r r __enter__s z_IterationGuard.__enter__cCs0|}|dk r,|j}|||s,|dSr)rr remove_commit_removals)retbrsr r r __exit__s  z_IterationGuard.__exit__N)__name__ __module__ __qualname__r rrr r r r 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%dd?Z'dS)ArNcCsBt|_t|fdd}||_g|_t|_|dk r>||dS)NcSs2|}|dk r.|jr"|j|n |j|dSr)r _pending_removalsappenddatadiscard)itemZselfrefrr r r _remove&s z!WeakSet.__init__.._remove)setrrrrr update)rrrr r r r $szWeakSet.__init__cCs$|j}|jj}|r ||qdSr)rrrpop)rlrr r r r4szWeakSet._commit_removalsc cs8t|&|jD]}|}|dk r|VqW5QRXdSr)rrrZitemrefrr r r __iter__:s   zWeakSet.__iter__cCst|jt|jSr)lenrrrr r r __len__CszWeakSet.__len__cCs.z t|}Wntk r"YdSX||jkS)NF)r TypeErrorr)rrZwrr r r __contains__Fs  zWeakSet.__contains__cCs|jt|ft|ddfS)N__dict__) __class__listgetattrr'r r r __reduce__Ms  zWeakSet.__reduce__cCs&|jr||jt||jdSr)rrrr rrrrr r r r Qsz WeakSet.addcCs|jr||jdSr)rrrclearr'r r r r1Vsz WeakSet.clearcCs ||Srr,r'r r r copy[sz WeakSet.copycCsT|jr|z|j}Wntk r:tddYnX|}|dk r|SqdS)Nzpop from empty WeakSet)rrrr"KeyErrorr$r r r r"^sz WeakSet.popcCs"|jr||jt|dSr)rrrrrr0r r r rjszWeakSet.removecCs"|jr||jt|dSr)rrrrrr0r r r roszWeakSet.discardcCs&|jr||D]}||qdSr)rrr )rotherZelementr r r r!tszWeakSet.updatecCs|||Sr)r!rr5r r r __ior__zs zWeakSet.__ior__cCs|}|||Sr)r3difference_updaterr5Znewsetr r r difference~s zWeakSet.differencecCs||dSr)__isub__r6r r r r8szWeakSet.difference_updatecCs<|jr|||kr"|jn|jdd|D|S)Ncss|]}t|VqdSrr.0rr r r sz#WeakSet.__isub__..)rrrr1r8r6r r r r;s  zWeakSet.__isub__csfdd|DS)Nc3s|]}|kr|VqdSrr r<r'r r r>sz'WeakSet.intersection..r2r6r r'r intersectionszWeakSet.intersectioncCs||dSr)__iand__r6r r r intersection_updateszWeakSet.intersection_updatecCs(|jr||jdd|D|S)Ncss|]}t|VqdSrrr<r r r r>sz#WeakSet.__iand__..)rrrrAr6r r r r@szWeakSet.__iand__cCs|jdd|DS)Ncss|]}t|VqdSrrr<r r r r>sz#WeakSet.issubset..)rissubsetr6r r r rBszWeakSet.issubsetcCs|jttt|kSrrr maprr6r r r __lt__szWeakSet.__lt__cCs|jdd|DS)Ncss|]}t|VqdSrrr<r r r r>sz%WeakSet.issuperset..)r issupersetr6r r r rFszWeakSet.issupersetcCs|jttt|kSrrCr6r r r __gt__szWeakSet.__gt__cCs$t||jstS|jttt|kSr) isinstancer,NotImplementedrr rDrr6r r r __eq__s zWeakSet.__eq__cCs|}|||Sr)r3symmetric_difference_updater9r r r symmetric_differences zWeakSet.symmetric_differencecCs||dSr)__ixor__r6r r r rKsz#WeakSet.symmetric_difference_updatecs@jr|kr"jnjfdd|DS)Nc3s|]}t|jVqdSr)rrr<r'r r r>sz#WeakSet.__ixor__..)rrrr1rKr6r r'r rMs  zWeakSet.__ixor__cCs|dd||fDS)Ncss|]}|D] }|Vq qdSrr )r=rrr r r r>sz WeakSet.union..r2r6r r r unionsz WeakSet.unioncCst||dkS)Nr)r&r?r6r r r isdisjointszWeakSet.isdisjointcCs t|jSr)reprrr'r r r __repr__szWeakSet.__repr__)N)(rrrr rr%r(r*r/r r1r3r"rrr!r7r:__sub__r8r;r?__and__rAr@rB__le__rErF__ge__rGrJrL__xor__rKrMrN__or__rOrQr r r r r#sJ     N)_weakrefr__all__rrr r r r s