dnspython  1.16.0
About: dnspython is a DNS toolkit (for Python 2.x) that supports almost all record types.
  Fossies Dox: dnspython-1.16.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

dns.set.Set Class Reference
Inheritance diagram for dns.set.Set:
[legend]
Collaboration diagram for dns.set.Set:
[legend]

Public Member Functions

def __init__ (self, items=None)
 
def __repr__ (self)
 
def add (self, item)
 
def remove (self, item)
 
def discard (self, item)
 
def __copy__ (self)
 
def copy (self)
 
def union_update (self, other)
 
def intersection_update (self, other)
 
def difference_update (self, other)
 
def union (self, other)
 
def intersection (self, other)
 
def difference (self, other)
 
def __or__ (self, other)
 
def __and__ (self, other)
 
def __add__ (self, other)
 
def __sub__ (self, other)
 
def __ior__ (self, other)
 
def __iand__ (self, other)
 
def __iadd__ (self, other)
 
def __isub__ (self, other)
 
def update (self, other)
 
def clear (self)
 
def __eq__ (self, other)
 
def __ne__ (self, other)
 
def __len__ (self)
 
def __iter__ (self)
 
def __getitem__ (self, i)
 
def __delitem__ (self, i)
 
def issubset (self, other)
 
def issuperset (self, other)
 

Public Attributes

 items
 

Private Member Functions

def _clone (self)
 

Static Private Attributes

list __slots__ = ['items']
 

Detailed Description

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.

Definition at line 18 of file set.py.

Constructor & Destructor Documentation

◆ __init__()

def dns.set.Set.__init__ (   self,
  items = None 
)
Initialize the set.

*items*, an iterable or ``None``, the initial set of items.

Definition at line 30 of file set.py.

Member Function Documentation

◆ __add__()

def dns.set.Set.__add__ (   self,
  other 
)

Definition at line 174 of file set.py.

References dns.set.Set.union().

◆ __and__()

def dns.set.Set.__and__ (   self,
  other 
)

Definition at line 171 of file set.py.

References dns.set.Set.intersection().

◆ __copy__()

def dns.set.Set.__copy__ (   self)
Make a (shallow) copy of the set.

Definition at line 84 of file set.py.

References dns.rrset.RRset._clone(), dns.set.Set._clone(), and dns.rdataset.Rdataset._clone().

◆ __delitem__()

def dns.set.Set.__delitem__ (   self,
  i 
)

Definition at line 234 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ __eq__()

def dns.set.Set.__eq__ (   self,
  other 
)

Reimplemented in dns.rdataset.Rdataset, and dns.rrset.RRset.

Definition at line 211 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.zone.Zone.__ne__(), and dns.set.Set.__ne__().

◆ __getitem__()

def dns.set.Set.__getitem__ (   self,
  i 
)

◆ __iadd__()

def dns.set.Set.__iadd__ (   self,
  other 
)

Definition at line 188 of file set.py.

References dns.set.Set.union_update(), and dns.rdataset.Rdataset.union_update().

◆ __iand__()

def dns.set.Set.__iand__ (   self,
  other 
)

◆ __ior__()

def dns.set.Set.__ior__ (   self,
  other 
)

Definition at line 180 of file set.py.

References dns.set.Set.union_update(), and dns.rdataset.Rdataset.union_update().

◆ __isub__()

def dns.set.Set.__isub__ (   self,
  other 
)

Definition at line 192 of file set.py.

References dns.set.Set.difference_update().

◆ __iter__()

def dns.set.Set.__iter__ (   self)

Definition at line 228 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ __len__()

def dns.set.Set.__len__ (   self)

Definition at line 225 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ __ne__()

◆ __or__()

def dns.set.Set.__or__ (   self,
  other 
)

Definition at line 168 of file set.py.

References dns.set.Set.union().

◆ __repr__()

def dns.set.Set.__repr__ (   self)

Reimplemented in dns.rdataset.Rdataset, and dns.rrset.RRset.

Definition at line 41 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ __sub__()

def dns.set.Set.__sub__ (   self,
  other 
)

Definition at line 177 of file set.py.

References dns.set.Set.difference().

◆ _clone()

def dns.set.Set._clone (   self)
private
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.

Reimplemented in dns.rdataset.Rdataset, and dns.rrset.RRset.

Definition at line 66 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.set.Set.__copy__(), dns.set.Set.copy(), dns.set.Set.difference(), dns.set.Set.intersection(), and dns.set.Set.union().

◆ add()

def dns.set.Set.add (   self,
  item 
)
Add an item to the set.

Definition at line 44 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.set.Set.union_update(), and dns.set.Set.update().

◆ clear()

def dns.set.Set.clear (   self)
Make the set empty.

Definition at line 207 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.rdataset.Rdataset.add().

◆ copy()

def dns.set.Set.copy (   self)
Make a (shallow) copy of the set.

Definition at line 90 of file set.py.

References dns.rrset.RRset._clone(), dns.set.Set._clone(), and dns.rdataset.Rdataset._clone().

◆ difference()

def dns.set.Set.difference (   self,
  other 
)
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.

Definition at line 157 of file set.py.

References dns.rrset.RRset._clone(), dns.set.Set._clone(), and dns.rdataset.Rdataset._clone().

Referenced by dns.set.Set.__sub__().

◆ difference_update()

def dns.set.Set.difference_update (   self,
  other 
)
Update the set, removing any elements from other which are in
the set.

Definition at line 123 of file set.py.

References dns.set.Set.discard(), dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.set.Set.__isub__().

◆ discard()

def dns.set.Set.discard (   self,
  item 
)
Remove an item from the set if present.

Definition at line 57 of file set.py.

References dns.set.Set.items, dns.rdtypes.IN.APL.APL.items, and dns.set.Set.remove().

Referenced by dns.set.Set.difference_update().

◆ intersection()

def dns.set.Set.intersection (   self,
  other 
)
Return a new set which is the intersection of ``self`` and
``other``.

Returns the same Set type as this set.

Definition at line 146 of file set.py.

References dns.rrset.RRset._clone(), dns.set.Set._clone(), and dns.rdataset.Rdataset._clone().

Referenced by dns.set.Set.__and__().

◆ intersection_update()

def dns.set.Set.intersection_update (   self,
  other 
)
Update the set, removing any elements from other which are not
in both sets.

Reimplemented in dns.rdataset.Rdataset.

Definition at line 108 of file set.py.

References dns.set.Set.items, dns.rdtypes.IN.APL.APL.items, and dns.set.Set.remove().

Referenced by dns.set.Set.__iand__().

◆ issubset()

def dns.set.Set.issubset (   self,
  other 
)
Is this set a subset of *other*?

Returns a ``bool``.

Definition at line 237 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ issuperset()

def dns.set.Set.issuperset (   self,
  other 
)
Is this set a superset of *other*?

Returns a ``bool``.

Definition at line 250 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

◆ remove()

def dns.set.Set.remove (   self,
  item 
)
Remove an item from the set.

Definition at line 51 of file set.py.

References dns.set.Set.items, and dns.rdtypes.IN.APL.APL.items.

Referenced by dns.set.Set.discard(), and dns.set.Set.intersection_update().

◆ union()

def dns.set.Set.union (   self,
  other 
)
Return a new set which is the union of ``self`` and ``other``.

Returns the same Set type as this set.

Definition at line 136 of file set.py.

References dns.rrset.RRset._clone(), dns.set.Set._clone(), and dns.rdataset.Rdataset._clone().

Referenced by dns.set.Set.__add__(), and dns.set.Set.__or__().

◆ union_update()

def dns.set.Set.union_update (   self,
  other 
)
Update the set, adding any elements from other which are not
already in the set.

Reimplemented in dns.rdataset.Rdataset.

Definition at line 96 of file set.py.

References dns.set.Set.add(), and dns.rdataset.Rdataset.add().

Referenced by dns.set.Set.__iadd__(), and dns.set.Set.__ior__().

◆ update()

def dns.set.Set.update (   self,
  other 
)
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.

Reimplemented in dns.rdataset.Rdataset.

Definition at line 196 of file set.py.

References dns.set.Set.add(), and dns.rdataset.Rdataset.add().

Member Data Documentation

◆ __slots__

list dns.set.Set.__slots__ = ['items']
staticprivate

Definition at line 28 of file set.py.

◆ items


The documentation for this class was generated from the following file: