o
    wZh                     @  sx   d dl mZ d dlmZmZmZmZmZ d dl	m
Z
mZmZmZ edZedddZdgZG d	d dee ee Zd
S )    )annotations)IterableIterator
MutableSet
ReversibleSet)AnycastOptionalTypeVarTT_coT)	covariant
OrderedSetc                      s  e Zd ZdZdZd\d]ddZed^ddZd_ddZd`ddZ	daddZ
d`ddZdbddZdbdd Zdcd!d"Zeddd%d&Zded'd(Zdfd)d*Zdgd-d.Zdhd/d0Zdhd1d2Zdgd3d4Zdhd5d6Zdid7d8Zdid9d:Zdjd;d<Zdkd=d>Zdgd?d@Zdl fdBdCZdj fdDdEZdm fdFdGZdm fdHdIZ dl fdJdKZ!dl fdLdMZ"dl fdNdOZ#dndQdRZ$dodTdUZ%dpdWdXZ&dqdZd[Z'  Z(S )rr   z8
    Insertion ordered set, similar to OrderedDict.
    _dictNiterableOptional[Iterable[T]]c                 C  s$   |d urt |d | _d S i | _d S Ndictfromkeysr   )selfr    r   G/var/www/auris/lib/python3.10/site-packages/torch/utils/_ordered_set.py__init__   s   $zOrderedSet.__init__dict_inpdict[T, None]returnOrderedSet[T]c                 C  s   t  }| |_|S r   )r   r   )r   sr   r   r   
_from_dict   s   zOrderedSet._from_dictelemobjectboolc                 C  s
   || j v S r   r   r   r"   r   r   r   __contains__&      
zOrderedSet.__contains__Iterator[T]c                 C  
   t | jS r   )iterr   r   r   r   r   __iter__)   r'   zOrderedSet.__iter__intc                 C  r)   r   )lenr   r+   r   r   r   __len__,   r'   zOrderedSet.__len__c                 C  r)   r   )reversedr   r+   r   r   r   __reversed__/   r'   zOrderedSet.__reversed__r   Nonec                 C  s   d | j |< d S r   r   r%   r   r   r   add2      zOrderedSet.addc                 C  s   | j |d  d S r   )r   popr%   r   r   r   discard5      zOrderedSet.discardc                 C  s   | j   d S r   )r   clearr+   r   r   r   r8   8   s   zOrderedSet.clearotherr   c                 C  s    t |tst |tr| |S |S )z
        Wrap non-Set Iterables in OrderedSets

        Some of the magic methods are more strict on input types than
        the public apis, so we need to wrap inputs in sets.
        )
isinstanceAbstractSetr   )clsr9   r   r   r   _wrap_iter_in_set>   s   	zOrderedSet._wrap_iter_in_setc                 C  s   | st d| j d S )Nzpop from an empty setr   )KeyErrorr   popitemr+   r   r   r   r5   L   s   zOrderedSet.popc                 C  s   t | j S r   )r   r!   r   copyr+   r   r   r   r@   Q   s   zOrderedSet.copyothersIterable[T]c                 G  s   |   }|j|  |S r   )r@   difference_update)r   rA   resr   r   r   
differenceT   s   
zOrderedSet.differencec                 G  s   |D ]}| |8 } qd S r   r   r   rA   r9   r   r   r   rC   Y      
zOrderedSet.difference_updatec                 G  s   |D ]}| |O } qd S r   r   rF   r   r   r   update]   rG   zOrderedSet.updatec                 G  s&   |   }|D ]
}|| ur||M }q|S r   r@   r   rA   rD   r9   r   r   r   intersectiona   s   zOrderedSet.intersectionc                 G  s   |D ]}| |M } qd S r   r   rF   r   r   r   intersection_updateh   rG   zOrderedSet.intersection_updatec                 C  s   | |  |kS r   r=   r   r9   r   r   r   issubsetl   r4   zOrderedSet.issubsetc                 C  s   | |  |kS r   rM   rN   r   r   r   
issuperseto   r4   zOrderedSet.issupersetc                 C  s   | |A S r   r   rN   r   r   r   symmetric_differencer   s   zOrderedSet.symmetric_differencec                 C  s   | |N } d S r   r   rN   r   r   r   symmetric_difference_updateu   s   z&OrderedSet.symmetric_difference_updatec                 G  s(   |   }|D ]}|| u rq||O }q|S r   rI   rJ   r   r   r   unionx   s   
zOrderedSet.unionAbstractSet[T_co]c                   sH   t |trt| d t|kr|  }||8 }|S ttt t |S )N   )r:   r   r.   r@   r	   r   super__sub__)r   r9   out	__class__r   r   rW      s
   zOrderedSet.__sub__c                   s(   t |tr| j|j | S t |S r   )r:   r   r   rH   rV   __ior__rN   rY   r   r   r[      s   
zOrderedSet.__ior__c                   s"   t |tr| j|jkS t |S r   )r:   r   r   rV   __eq__rN   rY   r   r   r\         
zOrderedSet.__eq__c                   s"   t |tr| j|jkS t |S r   )r:   r   r   rV   __ne__rN   rY   r   r   r^      r]   zOrderedSet.__ne__c                      t tt t |S r   )r	   r   r   rV   __or__rN   rY   r   r   r`         zOrderedSet.__or__c                   s8   t |trt| t|k r|| @ S ttt t |S r   )r:   r   r.   r	   r   rV   __and__rN   rY   r   r   rb      s   zOrderedSet.__and__c                   r_   r   )r	   r   r   rV   __xor__rN   rY   r   r   rc      ra   zOrderedSet.__xor__strc                 C  s   | j j dt|  dS )N())rZ   __name__listr+   r   r   r   __repr__   s   zOrderedSet.__repr__list[T]c                 C  s   t | j S r   )rh   r   keysr+   r   r   r   __getstate__   r4   zOrderedSet.__getstate__statec                 C  s   t |d | _d S r   r   )r   rm   r   r   r   __setstate__   r7   zOrderedSet.__setstate__*tuple[type[OrderedSet[T]], tuple[list[T]]]c                 C  s   t t| ffS r   )r   rh   r+   r   r   r   
__reduce__   r4   zOrderedSet.__reduce__r   )r   r   )r   r   r   r   )r"   r#   r   r$   )r   r(   )r   r-   )r"   r   r   r2   )r   r2   )r9   r   r   r   )r   r   )r   r   )rA   rB   r   r   )rA   rB   r   r2   )r9   rB   r   r$   )r9   rB   r   r   )r9   rB   r   r2   )r9   rT   r   r   )r9   r#   r   r$   )r   rd   )r   rj   )rm   rj   r   r2   )r   ro   ))rg   
__module____qualname____doc__	__slots__r   staticmethodr!   r&   r,   r/   r1   r3   r6   r8   classmethodr=   r5   r@   rE   rC   rH   rK   rL   rO   rP   rQ   rR   rS   rW   r[   r\   r^   r`   rb   rc   ri   rl   rn   rp   __classcell__r   r   rY   r   r      sL    






















N)
__future__r   collections.abcr   r   r   r   r   r;   typingr   r	   r
   r   r   r   __all__r   r   r   r   r   <module>   s    