a �DOg#�@s>ddlmZddlmZdgZGdd�d�ZGdd�d�ZdS)���ref)� GenericAlias�WeakSetc@s$eZdZdd�Zdd�Zdd�ZdS)�_IterationGuardcCst|�|_dS�N)r� weakcontainer)�selfr�r �#/usr/lib64/python3.9/_weakrefset.py�__init__sz_IterationGuard.__init__cCs |��}|dur|j�|�|Sr)r� _iterating�add)r �wr r r � __enter__s z_IterationGuard.__enter__cCs0|��}|dur,|j}|�|�|s,|��dSr)rr �remove�_commit_removals)r �e�t�br�sr r r �__exit__s  z_IterationGuard.__exit__N)�__name__� __module__� __qualname__r rrr r r r r src@s&eZdZd@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%dd?�Z'e(e)�Z*dS)ArNcCsBt�|_t|�fdd�}||_g|_t�|_|dur>|�|�dS)NcSs2|�}|dur.|jr"|j�|�n |j�|�dSr)r �_pending_removals�append�data�discard)�item�selfrefr 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)r�poprr� IndexError)r r$rrr r r r5s  zWeakSet._commit_removalsccsLt|��0|jD]}|�}|dur|VqWd�n1s>0YdSr)rr�r �itemrefrr r r �__iter__?s   zWeakSet.__iter__cCst|j�t|j�Sr)�lenrr�r r r r �__len__HszWeakSet.__len__cCs,z t|�}Wnty YdS0||jvS)NF)r� TypeErrorr)r r�wrr r r � __contains__Ks   zWeakSet.__contains__cCs|jt|�ft|dd�fS)N�__dict__)� __class__�list�getattrr*r r r � __reduce__Rs  �zWeakSet.__reduce__cCs&|jr|��|j�t||j��dSr)rrrrrr!�r rr r r rVsz WeakSet.addcCs|jr|��|j��dSr)rrr�clearr*r r r r5[sz WeakSet.clearcCs |�|�Sr�r0r*r r r �copy`sz WeakSet.copycCsR|jr|��z|j��}Wnty8td�d�Yn0|�}|dur|SqdS)Nzpop from empty WeakSet)rrrr$�KeyErrorr&r r r r$cs z WeakSet.popcCs"|jr|��|j�t|��dSr)rrrrrr4r r r roszWeakSet.removecCs"|jr|��|j�t|��dSr)rrrrrr4r r r rtszWeakSet.discardcCs&|jr|��|D]}|�|�qdSr)rrr)r �other�elementr r r r#yszWeakSet.updatecCs|�|�|Sr)r#�r r9r r r �__ior__s zWeakSet.__ior__cCs|��}|�|�|Sr)r7�difference_update�r r9�newsetr r r � difference�s zWeakSet.differencecCs|�|�dSr)�__isub__r;r r r r=�szWeakSet.difference_updatecCs<|jr|��||ur"|j��n|j�dd�|D��|S)Ncss|]}t|�VqdSrr��.0rr r r � ��z#WeakSet.__isub__..)rrrr5r=r;r r r rA�s  zWeakSet.__isub__cs���fdd�|D��S)Nc3s|]}|�vr|VqdSrr rBr*r r rD�rEz'WeakSet.intersection..r6r;r r*r � intersection�szWeakSet.intersectioncCs|�|�dSr)�__iand__r;r r r �intersection_update�szWeakSet.intersection_updatecCs(|jr|��|j�dd�|D��|S)Ncss|]}t|�VqdSrrrBr r r rD�rEz#WeakSet.__iand__..)rrrrHr;r r r rG�szWeakSet.__iand__cCs|j�dd�|D��S)Ncss|]}t|�VqdSrrrBr r r rD�rEz#WeakSet.issubset..)r�issubsetr;r r r rI�szWeakSet.issubsetcCs|jttt|��kSr�rr"�maprr;r r r �__lt__�szWeakSet.__lt__cCs|j�dd�|D��S)Ncss|]}t|�VqdSrrrBr r r rD�rEz%WeakSet.issuperset..)r� issupersetr;r r r rM�szWeakSet.issupersetcCs|jttt|��kSrrJr;r r r �__gt__�szWeakSet.__gt__cCs$t||j�stS|jttt|��kSr)� isinstancer0�NotImplementedrr"rKrr;r r r �__eq__�s zWeakSet.__eq__cCs|��}|�|�|Sr)r7�symmetric_difference_updater>r r r �symmetric_difference�s zWeakSet.symmetric_differencecCs|�|�dSr)�__ixor__r;r r r rR�sz#WeakSet.symmetric_difference_updatecs@�jr����|ur"�j��n�j��fdd�|D���S)Nc3s|]}t|�j�VqdSr)rr!rBr*r r rD�rEz#WeakSet.__ixor__..)rrrr5rRr;r r*r rT�s  zWeakSet.__ixor__cCs|�dd�||fD��S)Ncss|]}|D] }|Vq qdSrr )rCrrr r r rD�rEz WeakSet.union..r6r;r r r �union�sz WeakSet.unioncCst|�|��dkS)Nr)r)rFr;r r r � isdisjoint�szWeakSet.isdisjointcCs t|j�Sr)�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)�_weakrefr�typesr�__all__rrr r r r �s