Package netaddr :: Module address :: Class IPRangeSet
[hide private]
[frames] | no frames]

Class IPRangeSet

source code

object --+    
         |    
       set --+
             |
            IPRangeSet

*EXPERIMENTAL* A customised Python set class that deals with collections of IPRange class and subclass instances.

Instance Methods [hide private]
 
__init__(self, addrs)
Constructor.
source code
 
__contains__(self, other)
Returns: True if other IP or IPRange class/subclass instance matches any of the members in this IPRangeSet, False otherwise.
source code
 
any_match(self, other)
Returns: The first IP or IPRange class/subclass instance object that matches other from any of the members in this IPRangeSet, None otherwise.
source code
 
all_matches(self, other)
Returns: All IP or IPRange class/subclass instances matching other from this IPRangeSet, an empty list otherwise.
source code
 
min_match(self, other)
Returns: The smallest IP or IPRange class/subclass instance matching other from this IPRangeSet, None otherwise.
source code
 
max_match(self, other)
Returns: The largest IP or IPRange class/subclass instance matching other from this IPRangeSet, None otherwise.
source code

Inherited from set: __and__, __cmp__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __iand__, __ior__, __isub__, __iter__, __ixor__, __le__, __len__, __lt__, __ne__, __new__, __or__, __rand__, __reduce__, __repr__, __ror__, __rsub__, __rxor__, __sub__, __xor__, add, clear, copy, difference, difference_update, discard, intersection, intersection_update, issubset, issuperset, pop, remove, symmetric_difference, symmetric_difference_update, union, update

Inherited from object: __delattr__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, addrs)
(Constructor)

source code 

Constructor.

Parameters:
  • addrs - A sequence of IPRange class/subclass instances used to pre-populate the set. Individual CIDR objects can be added and removed after instantiation with the usual set methods, add() and remove().
Overrides: object.__init__

__contains__(self, other)
(In operator)

source code 

y in x.

Returns:
True if other IP or IPRange class/subclass instance matches any of the members in this IPRangeSet, False otherwise.
Overrides: set.__contains__

any_match(self, other)

source code 
Parameters:
  • other - An IP or IPRange class/subclass instance.
Returns:
The first IP or IPRange class/subclass instance object that matches other from any of the members in this IPRangeSet, None otherwise.

all_matches(self, other)

source code 
Parameters:
  • other - An IP or IPRange class/subclass instance.
Returns:
All IP or IPRange class/subclass instances matching other from this IPRangeSet, an empty list otherwise.

min_match(self, other)

source code 
Parameters:
  • other - An IP or IPRange class/subclass instance.
Returns:
The smallest IP or IPRange class/subclass instance matching other from this IPRangeSet, None otherwise.

max_match(self, other)

source code 
Parameters:
  • other - An IP or IPRange class/subclass instance.
Returns:
The largest IP or IPRange class/subclass instance matching other from this IPRangeSet, None otherwise.