Your IP : 3.21.98.234


Current Path : /lib64/python2.7/site-packages/dns/
Upload File :
Current File : //lib64/python2.7/site-packages/dns/set.pyc

�
!`Nc@s dZdefd��YZdS(sA simple Set class.tSetcBsLeZdZdgZd$d�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&RS(%s'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: listtitemscCs:g|_|dk	r6x|D]}|j|�qWndS(svInitialize the set.

        @param items: the initial set of items
        @type items: any iterable or None
        N(RtNonetadd(tselfRtitem((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__init__s	
cCsdt|j�S(Nsdns.simpleset.Set(%s)(treprR(R((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__repr__*scCs&||jkr"|jj|�ndS(sAdd an item to the set.N(Rtappend(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyR-scCs|jj|�dS(sRemove an item from the set.N(Rtremove(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyR
2scCs,y|jj|�Wntk
r'nXdS(s'Remove an item from the set if present.N(RR
t
ValueError(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pytdiscard6s
cCs.|j}|j|�}t|j�|_|S(s�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.
        (t	__class__t__new__tlistR(Rtclstobj((s-/usr/lib64/python2.7/site-packages/dns/set.pyt_clone=s
	cCs
|j�S(s!Make a (shallow) copy of the set.(R(R((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__copy__OscCs
|j�S(s!Make a (shallow) copy of the set.(R(R((s-/usr/lib64/python2.7/site-packages/dns/set.pytcopySscCsSt|t�std��n||kr.dSx|jD]}|j|�q8WdS(s�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
        sother must be a Set instanceN(t
isinstanceRRRR(RtotherR((s-/usr/lib64/python2.7/site-packages/dns/set.pytunion_updateWscCsnt|t�std��n||kr.dSx9t|j�D](}||jkr>|jj|�q>q>WdS(s�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
        sother must be a Set instanceN(RRRRRR
(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytintersection_updatedscCs[t|t�std��n||kr6g|_n!x|jD]}|j|�q@WdS(s�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
        sother must be a Set instanceN(RRRRR(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytdifference_updatetscCs|j�}|j|�|S(s�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(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytunion�s
cCs|j�}|j|�|S(s�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(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytintersection�s
cCs|j�}|j|�|S(s�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(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt
difference�s	
cCs
|j|�S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__or__�scCs
|j|�S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__and__�scCs
|j|�S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__add__�scCs
|j|�S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__sub__�scCs|j|�|S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__ior__�s
cCs|j|�|S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__iand__�s
cCs|j|�|S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__iadd__�s
cCs|j|�|S(N(R(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__isub__�s
cCs"x|D]}|j|�qWdS(s�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(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytupdate�s
cCs
g|_dS(sMake the set empty.N(R(R((s-/usr/lib64/python2.7/site-packages/dns/set.pytclear�scCsRx$|jD]}||jkr
tSq
Wx$|jD]}||jkr1tSq1WtS(N(RtFalsetTrue(RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__eq__�scCs|j|�S(N(R)(RR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__ne__�scCs
t|j�S(N(tlenR(R((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__len__�scCs
t|j�S(N(titerR(R((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__iter__�scCs|j|S(N(R(Rti((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__getitem__�scCs|j|=dS(N(R(RR/((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__delitem__�scCs|j||!S(N(R(RR/tj((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__getslice__�scCs|j||5dS(N(R(RR/R2((s-/usr/lib64/python2.7/site-packages/dns/set.pyt__delslice__�scCsIt|t�std��nx$|jD]}||jkr(tSq(WtS(s?Is I{self} a subset of I{other}?

        @rtype: bool
        sother must be a Set instance(RRRRR'R((RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pytissubset�scCsIt|t�std��nx$|jD]}||jkr(tSq(WtS(sAIs I{self} a superset of I{other}?

        @rtype: bool
        sother must be a Set instance(RRRRR'R((RRR((s-/usr/lib64/python2.7/site-packages/dns/set.pyt
issuperset�sN('t__name__t
__module__t__doc__t	__slots__RRRRR
RRRRRRRRRRRRRR R!R"R#R$R%R&R)R*R,R.R0R1R3R4R5R6(((s-/usr/lib64/python2.7/site-packages/dns/set.pyRsH									
					
																			
N(R9tobjectR(((s-/usr/lib64/python2.7/site-packages/dns/set.pyt<module>s