
    g#                          S SK r  " S S5      rg)    Nc                   
   \ rS rSrSrS/rS,S jrS rS rS r	S	 r
S
 rS-S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S  r!S! r"S" r#S# r$S$ r%S% r&S& r'S' r(S( r)S) r*S* r+S+r,g).Set   at  A simple set class.

This class was originally used to deal with python not having a set class, and
originally the class used lists in its implementation.  The ordered and indexable
nature of RRsets and Rdatasets is unfortunately widely used in dnspython
applications, so for backwards compatibility sets continue to be a custom class, now
based on an ordered dictionary.
itemsNc                 ^    [        5       U l        Ub  U H  nU R                  U5        M     gg)zQInitialize the set.

*items*, an iterable or ``None``, the initial set of items.
N)dictr   add)selfr   items      @/home/matz/Project1/venv/lib/python3.13/site-packages/dns/set.py__init__Set.__init__!   s/     V
       c                 b    S[        [        U R                  R                  5       5      5       S3$ )Nzdns.set.Set())reprlistr   keysr
   s    r   __repr__Set.__repr__.   s'    d4

(9#:;<A>>r   c                 B    XR                   ;  a  SU R                   U'   gg)zAdd an item to the set.Nr   r
   r   s     r   r	   Set.add1   s!     zz!#DJJt "r   c                 H     U R                   U	 g! [         a    [        ef = f)zRemove an item from the set.N)r   KeyError
ValueErrorr   s     r   remove
Set.remove7   s(    	

4  		s    !c                 <    U R                   R                  US5        g)z'Remove an item from the set if present.N)r   popr   s     r   discardSet.discard?   s     	

tT"r   c                 >    U R                   R                  5       u  pU$ )z&Remove an arbitrary item from the set.)r   popitem)r
   k_s      r   r"   Set.popD   s    ##%r   c                     [        U S5      (       a  U R                  nOU R                  nUR                  U5      n[	        5       Ul        UR
                  R                  U R
                  5        U$ )a  Make a (shallow) copy of the set.

There is a 'clone protocol' that subclasses of this class
should use.  To make a copy, first call your super's _clone()
method, and use the object returned as the new instance.  Then
make shallow copies of the attributes defined in the subclass.

This protocol allows us to write the set algorithms that
return new instances (e.g. union) once, and keep using them in
subclasses.
_clone_class)hasattrr+   	__class____new__r   r   update)r
   clsobjs      r   _clone
Set._cloneI   sW     4((##C..Ckk#F			$
r   c                 "    U R                  5       $ z!Make a (shallow) copy of the set.r2   r   s    r   __copy__Set.__copy___        {{}r   c                 "    U R                  5       $ r5   r6   r   s    r   copySet.copyd   r9   r   c                     [        U[        5      (       d  [        S5      eXL a  gUR                   H  nU R	                  U5        M     g)zQUpdate the set, adding any elements from other which are not
already in the set.
other must be a Set instanceN)
isinstancer   r   r   r	   r
   otherr   s      r   union_updateSet.union_updatei   s>    
 %%%;<<=KKDHHTN  r   c                     [        U[        5      (       d  [        S5      eXL a  g[        U R                  5       H!  nX!R                  ;  d  M  U R                  U	 M#     g)zMUpdate the set, removing any elements from other which are not
in both sets.
r>   N)r?   r   r   r   r   r@   s      r   intersection_updateSet.intersection_updateu   sP    
 %%%;<<= $D;;&JJt$ %r   c                     [        U[        5      (       d  [        S5      eXL a  U R                  R	                  5         gUR                   H  nU R                  U5        M     g)zGUpdate the set, removing any elements from other which are in
the set.
r>   N)r?   r   r   r   clearr#   r@   s      r   difference_updateSet.difference_update   sL    
 %%%;<<=JJT" $r   c                     [        U[        5      (       d  [        S5      eXL a  U R                  R	                  5         gU R                  U5      nU R                  U5        U R                  U5        g)z<Update the set, retaining only elements unique to both sets.r>   N)r?   r   r   r   rH   intersectionrB   rI   )r
   rA   overlaps      r   symmetric_difference_updateSet.symmetric_difference_update   s^     %%%;<<=JJ''.Ge$""7+r   c                 H    U R                  5       nUR                  U5        U$ )zgReturn a new set which is the union of ``self`` and ``other``.

Returns the same Set type as this set.
)r2   rB   r
   rA   r1   s      r   union	Set.union   s"     kkm
r   c                 H    U R                  5       nUR                  U5        U$ )znReturn a new set which is the intersection of ``self`` and
``other``.

Returns the same Set type as this set.
)r2   rE   rQ   s      r   rL   Set.intersection   s"     kkm&
r   c                 H    U R                  5       nUR                  U5        U$ )zReturn a new set which ``self`` - ``other``, i.e. the items
in ``self`` which are not also in ``other``.

Returns the same Set type as this set.
)r2   rI   rQ   s      r   
differenceSet.difference   s"     kkme$
r   c                 H    U R                  5       nUR                  U5        U$ )zReturn a new set which (``self`` - ``other``) | (``other``
- ``self), ie: the items in either ``self`` or ``other`` which
are not contained in their intersection.

Returns the same Set type as this set.
)r2   rN   rQ   s      r   symmetric_differenceSet.symmetric_difference   s"     kkm''.
r   c                 $    U R                  U5      $ NrR   r
   rA   s     r   __or__
Set.__or__       zz%  r   c                 $    U R                  U5      $ r]   )rL   r_   s     r   __and__Set.__and__   s      ''r   c                 $    U R                  U5      $ r]   r^   r_   s     r   __add__Set.__add__   rb   r   c                 $    U R                  U5      $ r]   )rW   r_   s     r   __sub__Set.__sub__   s    u%%r   c                 $    U R                  U5      $ r]   )rZ   r_   s     r   __xor__Set.__xor__   s    ((//r   c                 (    U R                  U5        U $ r]   rB   r_   s     r   __ior__Set.__ior__       % r   c                 (    U R                  U5        U $ r]   )rE   r_   s     r   __iand__Set.__iand__   s      'r   c                 (    U R                  U5        U $ r]   rp   r_   s     r   __iadd__Set.__iadd__   rs   r   c                 (    U R                  U5        U $ r]   )rI   r_   s     r   __isub__Set.__isub__   s    u%r   c                 (    U R                  U5        U $ r]   )rN   r_   s     r   __ixor__Set.__ixor__   s    ((/r   c                 8    U H  nU R                  U5        M     g)zUpdate the set, adding any elements from other which are not
already in the set.

*other*, the collection of items with which to update the set, which
may be any iterable type.
N)r	   r@   s      r   r/   
Set.update   s     DHHTN r   c                 8    U R                   R                  5         g)zMake the set empty.N)r   rH   r   s    r   rH   	Set.clear   s    

r   c                 4    U R                   UR                   :H  $ r]   r   r_   s     r   __eq__
Set.__eq__   s    zzU[[((r   c                 .    U R                  U5      (       + $ r]   )r   r_   s     r   __ne__
Set.__ne__   s    ;;u%%%r   c                 ,    [        U R                  5      $ r]   )lenr   r   s    r   __len__Set.__len__  s    4::r   c                 ,    [        U R                  5      $ r]   )iterr   r   s    r   __iter__Set.__iter__  s    DJJr   c                    [        U[        5      (       aJ  [        [        R                  " U R
                  UR                  UR                  UR                  5      5      $ [        [        R                  " U R
                  XS-   5      5      $ )N   )
r?   slicer   	itertoolsislicer   startstopstepnext)r
   is     r   __getitem__Set.__getitem__  s[    a	((QWWaffaffMNN	((QA>??r   c                     [        U[        5      (       a"  [        X   5       H  nU R                  U	 M     g U R                  X   	 g r]   )r?   r   r   r   )r
   r   elts      r   __delitem__Set.__delitem__  s:    aDG}JJsO % 

47#r   c                     [        U[        5      (       d  [        S5      eU R                   H  nX!R                  ;  d  M    g   g)z6Is this set a subset of *other*?

Returns a ``bool``.
r>   FTr?   r   r   r   r@   s      r   issubsetSet.issubset  s=     %%%;<<JJD;;&  r   c                     [        U[        5      (       d  [        S5      eUR                   H  nX R                  ;  d  M    g   g)z8Is this set a superset of *other*?

Returns a ``bool``.
r>   FTr   r@   s      r   
issupersetSet.issuperset!  s=     %%%;<<KKD::%   r   c                     [        U[        5      (       d  [        S5      eUR                   H  nX R                  ;   d  M    g   g)Nr>   FTr   r@   s      r   
isdisjointSet.isdisjoint.  s;    %%%;<<KKDzz!   r   r   r]   )returnr   )-__name__
__module____qualname____firstlineno____doc__	__slots__r   r   r	   r   r#   r"   r2   r7   r;   rB   rE   rI   rN   rR   rL   rW   rZ   r`   rd   rg   rj   rm   rq   ru   rx   r{   r~   r/   rH   r   r   r   r   r   r   r   r   r   __static_attributes__ r   r   r   r      s     	I?$#

,


%#
,		
!(!&0	)& @$r   r   )r   r   r   r   r   <module>r      s   $ _ _r   