HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/dns/__pycache__/set.cpython-310.pyc
o

!we�#�@sddlZGdd�d�ZdS)�Nc@sJeZdZdZdgZdQdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dRdd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dS)S�Seta!A simple set class.

    This class was originally used to deal with sets being missing in
    ancient versions of python, but dnspython will continue to use it
    as these sets are based on lists and are thus indexable, and this
    ability is widely used in dnspython applications.
    �itemsNcCs,t�|_|dur|D]	}|�|�q
dSdS)zaInitialize the set.

        *items*, an iterable or ``None``, the initial set of items.
        N)�dictr�add)�selfr�item�r�@/home/arjun/projects/env/lib/python3.10/site-packages/dns/set.py�__init__!s�zSet.__init__cCsdtt|j����S)Nzdns.set.Set(%s))�repr�listr�keys�rrrr	�__repr__.szSet.__repr__cCs||jvrd|j|<dSdS)zAdd an item to the set.N�r�rrrrr	r1s
�zSet.addcCs"z|j|=WdStyt�w)zRemove an item from the set.N)r�KeyError�
ValueErrorrrrr	�remove7s
�z
Set.removecCs|j�|d�dS)z'Remove an item from the set if present.N)r�poprrrr	�discard?szSet.discardcCs|j��\}}|S)z&Remove an arbitrary item from the set.)r�popitem)r�k�_rrr	rDszSet.pop�returncCs<t|d�r	|j}n|j}|�|�}t�|_|j�|j�|S)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__rr�update)r�cls�objrrr	�_cloneIs


z
Set._clonecC�|��S�z!Make a (shallow) copy of the set.�r"rrrr	�__copy___�zSet.__copy__cCr#r$r%rrrr	�copydr'zSet.copycCs8t|t�s	td��||urdS|jD]}|�|�qdS)zaUpdate the set, adding any elements from other which are not
        already in the set.
        �other must be a Set instanceN)�
isinstancerrrr�r�otherrrrr	�union_updateis

�zSet.union_updatecCsDt|t�s	td��||urdSt|j�D]}||jvr|j|=qdS)z]Update the set, removing any elements from other which are not
        in both sets.
        r)N)r*rrrrr+rrr	�intersection_updateus

��zSet.intersection_updatecCsBt|t�s	td��||ur|j��dS|jD]}|�|�qdS)zWUpdate the set, removing any elements from other which are in
        the set.
        r)N)r*rrr�clearrr+rrr	�difference_update�s

�zSet.difference_updatecCsJt|t�s	td��||ur|j��dS|�|�}|�|�|�|�dS)z<Update the set, retaining only elements unique to both sets.r)N)r*rrrr/�intersectionr-r0)rr,�overlaprrr	�symmetric_difference_update�s


zSet.symmetric_difference_updatecC�|��}|�|�|S)zwReturn a new set which is the union of ``self`` and ``other``.

        Returns the same Set type as this set.
        )r"r-�rr,r!rrr	�union�s
z	Set.unioncCr4)z�Return a new set which is the intersection of ``self`` and
        ``other``.

        Returns the same Set type as this set.
        )r"r.r5rrr	r1��
zSet.intersectioncCr4)z�Return 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.
        )r"r0r5rrr	�
difference�r7zSet.differencecCr4)z�Return 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.
        )r"r3r5rrr	�symmetric_difference�s
zSet.symmetric_differencecC�
|�|�S�N�r6�rr,rrr	�__or__��
z
Set.__or__cCr:r;)r1r=rrr	�__and__�r?zSet.__and__cCr:r;r<r=rrr	�__add__�r?zSet.__add__cCr:r;)r8r=rrr	�__sub__�r?zSet.__sub__cCr:r;)r9r=rrr	�__xor__�r?zSet.__xor__cC�|�|�|Sr;�r-r=rrr	�__ior__��
zSet.__ior__cCrDr;)r.r=rrr	�__iand__�rGzSet.__iand__cCrDr;rEr=rrr	�__iadd__�rGzSet.__iadd__cCrDr;)r0r=rrr	�__isub__�rGzSet.__isub__cCrDr;)r3r=rrr	�__ixor__�rGzSet.__ixor__cCs|D]}|�|�qdS)z�Update 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)rr+rrr	r�s�z
Set.updatecCs|j��dS)zMake the set empty.N)rr/rrrr	r/�sz	Set.clearcCs|j|jkSr;rr=rrr	�__eq__��z
Set.__eq__cCs|�|�Sr;)rLr=rrr	�__ne__�rMz
Set.__ne__cC�
t|j�Sr;)�lenrrrrr	�__len__r?zSet.__len__cCrOr;)�iterrrrrr	�__iter__r?zSet.__iter__cCs>t|t�rtt�|j|j|j|j��St	t�|j||d��S)N�)
r*�slicer�	itertools�islicer�start�stop�step�next)r�irrr	�__getitem__s
zSet.__getitem__cCs8t|t�rt||�D]}|j|=qdS|j||=dSr;)r*rUrr)rr\�eltrrr	�__delitem__
s


�zSet.__delitem__cCs2t|t�s	td��|jD]
}||jvrdSqdS)zFIs this set a subset of *other*?

        Returns a ``bool``.
        r)FT�r*rrrr+rrr	�issubset�


�zSet.issubsetcCs2t|t�s	td��|jD]
}||jvrdSqdS)zHIs this set a superset of *other*?

        Returns a ``bool``.
        r)FTr`r+rrr	�
issuperset!rbzSet.issupersetcCs2t|t�s	td��|jD]
}||jvrdSqdS)Nr)FTr`r+rrr	�
isdisjoint.s


�zSet.isdisjointr;)rr)+�__name__�
__module__�__qualname__�__doc__�	__slots__r
rrrrrr"r&r(r-r.r0r3r6r1r8r9r>r@rArBrCrFrHrIrJrKrr/rLrNrQrSr]r_rarcrdrrrr	rsR






r)rVrrrrr	�<module>s