Hacked By AnonymousFox

Current Path : /lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dns/__pycache__/set.cpython-36.pyc

3

�b�W#�@sdZGdd�de�ZdS)zA simple Set class.c@seZdZdZdgZdDdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!d>d?�Z"d@dA�Z#dBdC�Z$dS)E�Seta'A simple set class.

    Sets are not in Python until 2.3, and rdata are not immutable so
    we cannot use sets.Set anyway.  This class implements subset of
    the 2.3 Set interface using a list as the container.

    @ivar items: A list of the items which are in the set
    @type items: list�itemsNcCs*g|_|dk	r&x|D]}|j|�qWdS)zvInitialize the set.

        @param items: the initial set of items
        @type items: any iterable or None
        N)r�add)�selfr�item�r�/usr/lib/python3.6/set.py�__init__ s
zSet.__init__cCsdt|j�S)Nzdns.simpleset.Set(%s))�reprr)rrrr�__repr__,szSet.__repr__cCs||jkr|jj|�dS)zAdd an item to the set.N)r�append)rrrrrr/s
zSet.addcCs|jj|�dS)zRemove an item from the set.N)r�remove)rrrrrr4sz
Set.removecCs*y|jj|�Wntk
r$YnXdS)z'Remove an item from the set if present.N)rr�
ValueError)rrrrr�discard8szSet.discardcCs |j}|j|�}t|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.
        )�	__class__�__new__�listr)r�cls�objrrr�_clone?s

z
Set._clonecCs|j�S)z!Make a (shallow) copy of the set.)r)rrrr�__copy__QszSet.__copy__cCs|j�S)z!Make a (shallow) copy of the set.)r)rrrr�copyUszSet.copycCs<t|t�std��||krdSx|jD]}|j|�q&WdS)z�Update the set, adding any elements from other which are not
        already in the set.
        @param other: the collection of items with which to update the set
        @type other: Set object
        zother must be a Set instanceN)�
isinstancerr
rr)r�otherrrrr�union_updateYs
zSet.union_updatecCsLt|t�std��||krdSx(t|j�D]}||jkr*|jj|�q*WdS)z�Update the set, removing any elements from other which are not
        in both sets.
        @param other: the collection of items with which to update the set
        @type other: Set object
        zother must be a Set instanceN)rrr
rrr)rrrrrr�intersection_updatefs

zSet.intersection_updatecCs@t|t�std��||kr"g|_nx|jD]}|j|�q*WdS)z�Update the set, removing any elements from other which are in
        the set.
        @param other: the collection of items with which to update the set
        @type other: Set object
        zother must be a Set instanceN)rrr
rr)rrrrrr�difference_updatevs
zSet.difference_updatecCs|j�}|j|�|S)z�Return a new set which is the union of I{self} and I{other}.

        @param other: the other set
        @type other: Set object
        @rtype: the same type as I{self}
        )rr)rrrrrr�union�s
z	Set.unioncCs|j�}|j|�|S)z�Return a new set which is the intersection of I{self} and I{other}.

        @param other: the other set
        @type other: Set object
        @rtype: the same type as I{self}
        )rr)rrrrrr�intersection�s
zSet.intersectioncCs|j�}|j|�|S)z�Return a new set which I{self} - I{other}, i.e. the items
        in I{self} which are not also in I{other}.

        @param other: the other set
        @type other: Set object
        @rtype: the same type as I{self}
        )rr)rrrrrr�
difference�s	
zSet.differencecCs
|j|�S)N)r)rrrrr�__or__�sz
Set.__or__cCs
|j|�S)N)r)rrrrr�__and__�szSet.__and__cCs
|j|�S)N)r)rrrrr�__add__�szSet.__add__cCs
|j|�S)N)r)rrrrr�__sub__�szSet.__sub__cCs|j|�|S)N)r)rrrrr�__ior__�s
zSet.__ior__cCs|j|�|S)N)r)rrrrr�__iand__�s
zSet.__iand__cCs|j|�|S)N)r)rrrrr�__iadd__�s
zSet.__iadd__cCs|j|�|S)N)r)rrrrr�__isub__�s
zSet.__isub__cCsx|D]}|j|�qWdS)z�Update the set, adding any elements from other which are not
        already in the set.
        @param other: the collection of items with which to update the set
        @type other: any iterable typeN)r)rrrrrr�update�s
z
Set.updatecCs
g|_dS)zMake the set empty.N)r)rrrr�clear�sz	Set.clearcCs@x|jD]}||jkrdSqWx|jD]}||jkr&dSq&WdS)NFT)r)rrrrrr�__eq__�s

z
Set.__eq__cCs|j|�S)N)r))rrrrr�__ne__�sz
Set.__ne__cCs
t|j�S)N)�lenr)rrrr�__len__�szSet.__len__cCs
t|j�S)N)�iterr)rrrr�__iter__�szSet.__iter__cCs
|j|S)N)r)r�irrr�__getitem__�szSet.__getitem__cCs|j|=dS)N)r)rr/rrr�__delitem__�szSet.__delitem__cCs4t|t�std��x|jD]}||jkrdSqWdS)z?Is I{self} a subset of I{other}?

        @rtype: bool
        zother must be a Set instanceFT)rrr
r)rrrrrr�issubset�s

zSet.issubsetcCs4t|t�std��x|jD]}||jkrdSqWdS)zAIs I{self} a superset of I{other}?

        @rtype: bool
        zother must be a Set instanceFT)rrr
r)rrrrrr�
issuperset�s

zSet.issuperset)N)%�__name__�
__module__�__qualname__�__doc__�	__slots__rr
rrrrrrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r,r.r0r1r2r3rrrrrsD	



rN)r7�objectrrrrr�<module>s

Hacked By AnonymousFox1.0, Coded By AnonymousFox