
    pi                        d dl mZ d dlmZmZmZmZmZmZ	 d dl
mZmZmZmZ  ede      Z eded      Zd	gZ G d
 d	ee   ee         Zy)    )annotations)HashableIterableIterator
MutableSet
ReversibleSet)AnycastOptionalTypeVarT)boundT_coT)r   	covariant
OrderedSetc                  V    e Zd ZdZdZd$d%dZed&d       Zd'dZd(dZ	d)dZ
d(dZd*d	Zd*d
Zd+dZed,d       Zd-dZd.dZd/dZd0dZd0dZd/dZd0dZd1dZd1dZd2dZd3dZd/dZd4 fdZd2 fdZd5 fdZd5 fdZ d4 fdZ!d4 fdZ"d4 fdZ#d6d Z$d7d!Z%d8d"Z&d9d#Z' xZ(S ):r   z8
    Insertion ordered set, similar to OrderedDict.
    _dictc                N    |t         j                  |d       | _        y i | _        y Ndictfromkeysr   )selfiterables     Z/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/torch/utils/_ordered_set.py__init__zOrderedSet.__init__   s     6>6JT]]8T2
PR
    c                (    t               }| |_        |S r   )r   r   )dict_inpss     r   
_from_dictzOrderedSet._from_dict   s    %<r   c                    || j                   v S r   r   r   elems     r   __contains__zOrderedSet.__contains__'   s    tzz!!r   c                ,    t        | j                        S r   )iterr   r   s    r   __iter__zOrderedSet.__iter__*   s    DJJr   c                ,    t        | j                        S r   )lenr   r*   s    r   __len__zOrderedSet.__len__-   s    4::r   c                ,    t        | j                        S r   )reversedr   r*   s    r   __reversed__zOrderedSet.__reversed__0   s    

##r   c                "    d | j                   |<   y r   r   r%   s     r   addzOrderedSet.add3   s    

4r   c                <    | j                   j                  |d        y r   )r   popr%   s     r   discardzOrderedSet.discard6   s    

tT"r   c                8    | j                   j                          y r   )r   clearr*   s    r   r8   zOrderedSet.clear9   s    

r   c                V    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   )clsothers     r   _wrap_iter_in_setzOrderedSet._wrap_iter_in_set?   s&     %-*UH2Mu:Lr   c                V    | st        d      | j                  j                         d   S )Nzpop from an empty setr   )KeyErrorr   popitemr*   s    r   r5   zOrderedSet.popM   s)    233zz!!#A&&r   c                \    t         j                  | j                  j                               S r   )r   r#   r   copyr*   s    r   rC   zOrderedSet.copyR   s    $$TZZ__%677r   c                D    | j                         } |j                  |  |S r   )rC   difference_update)r   othersress      r   
differencezOrderedSet.differenceU   s"    iikv&
r   c                    |D ]  }| |z  } 	 y r    r   rF   r=   s      r   rE   zOrderedSet.difference_updateZ        	EEMD	r   c                    |D ]  }| |z  } 	 y r   rJ   rK   s      r   updatezOrderedSet.update^   rL   r   c                H    | j                         }|D ]  }|| us||z  } |S r   rC   r   rF   rG   r=   s       r   intersectionzOrderedSet.intersectionb   s4    iik 	ED u	 
r   c                    |D ]  }| |z  } 	 y r   rJ   rK   s      r   intersection_updatezOrderedSet.intersection_updatei   rL   r   c                *    | | j                  |      k  S r   r>   r   r=   s     r   issubsetzOrderedSet.issubsetm       t--e444r   c                *    | | j                  |      k\  S r   rV   rW   s     r   
issupersetzOrderedSet.issupersetp   rY   r   c                    | |z  S r   rJ   rW   s     r   symmetric_differencezOrderedSet.symmetric_differences   s    e|r   c                    | |z  } y r   rJ   rW   s     r   symmetric_difference_updatez&OrderedSet.symmetric_difference_updatev   s    r   c                H    | j                         }|D ]  }|| u r||z  } |S r   rP   rQ   s       r   unionzOrderedSet.uniony   s6    iik 	E}5LC	 
r   c                    t        |t              r1t        |       dz  t        |      kD  r| j                         }||z  }|S t	        t        t
           t        |   |            S )N   )r:   r   r-   rC   r   r   super__sub__)r   r=   out	__class__s      r   re   zOrderedSet.__sub__   sS    eZ(c$i!ms5z-I))+C5LCJJqM57?5#9::r   c                    t        |t              r'| j                  j                  |j                         | S t        |   |      S r   )r:   r   r   rN   rd   __ior__r   r=   rg   s     r   ri   zOrderedSet.__ior__   s7    eZ(JJekk*Kwu%%r   c                t    t        |t              r| j                  |j                  k(  S t        |   |      S r   )r:   r   r   rd   __eq__rj   s     r   rl   zOrderedSet.__eq__   /    eZ(::,,w~e$$r   c                t    t        |t              r| j                  |j                  k7  S t        |   |      S r   )r:   r   r   rd   __ne__rj   s     r   ro   zOrderedSet.__ne__   rm   r   c                L    t        t        t           t        |   |            S r   )r   r   r   rd   __or__rj   s     r   rq   zOrderedSet.__or__   s    JqM57>%#899r   c                    t        |t              rt        |       t        |      k  r|| z  S t        t        t           t
        |   |            S r   )r:   r   r-   r   r   rd   __and__rj   s     r   rs   zOrderedSet.__and__   s@    eZ(SYU-C4<JqM57?5#9::r   c                L    t        t        t           t        |   |            S r   )r   r   r   rd   __xor__rj   s     r   ru   zOrderedSet.__xor__   s    JqM57?5#9::r   c                L    | j                   j                   dt        |        dS )N())rg   __name__listr*   s    r   __repr__zOrderedSet.__repr__   s$    ..))*!DJ<q99r   c                H    t        | j                  j                               S r   )rz   r   keysr*   s    r   __getstate__zOrderedSet.__getstate__   s    DJJOO%&&r   c                :    t         j                  |d       | _        y r   r   )r   states     r   __setstate__zOrderedSet.__setstate__   s    ]]5$/
r   c                &    t         t        |       ffS r   )r   rz   r*   s    r   
__reduce__zOrderedSet.__reduce__   s    T$ZM**r   r   )r   zOptional[Iterable[T]])r!   zdict[T, None]returnOrderedSet[T])r&   objectr   bool)r   zIterator[T])r   int)r&   r   r   None)r   r   )r=   r
   r   r
   )r   r   )r   r   )rF   Iterable[T]r   r   )rF   r   r   r   )r=   r   r   r   )r=   r   r   r   )r=   r   r   r   )r=   zAbstractSet[T_co]r   r   )r=   r   r   r   )r   str)r   list[T])r   r   r   r   )r   z*tuple[type[OrderedSet[T]], tuple[list[T]]]))ry   
__module____qualname____doc__	__slots__r   staticmethodr#   r'   r+   r.   r1   r3   r6   r8   classmethodr>   r5   rC   rH   rE   rN   rR   rT   rX   r[   r]   r_   ra   re   ri   rl   ro   rq   rs   ru   r{   r~   r   r   __classcell__)rg   s   @r   r   r      s     IS  " $ #  '
8
55;&%
%
:;;:'0+r   N)
__future__r   collections.abcr   r   r   r   r   r	   r;   typingr
   r   r   r   r   r   __all__r   rJ   r   r   <module>r      sU    "  0 / Cx vX6.]+A
1 ]+r   