netaddr.ip.IPRange

Package netaddr :: Package ip :: Class IPRange |
[hide private]
[frames] | no frames]

# Class IPRange

     object --+
              |
         BaseIP --+
                  |
     object --+   |
              |   |
    IPListMixin --+
                  |
                 IPRange

Known Subclasses:
  - glob.IPGlob

An arbitrary IPv4 or IPv6 address range.

Formed from a lower and upper bound IP address. The upper bound IP cannot be numerically smaller than the lower bound and the IP version of both must match.

Instance Methods | [hide private]
__init__(self, start, end, flags=0) Constructor. |
__getstate__(self) Returns: Pickled state of an `IPRange` object. |
__setstate__(self, state) |
key(self) Returns: A key tuple used to uniquely identify this IPRange. |
sort_key(self) Returns: A key tuple used to compare and sort this IPRange correctly. |
cidrs(self) The list of CIDR addresses found within the lower and upper bound addresses of this IPRange. |
__str__(self) Returns: this IPRange in a common representational format. |
__repr__(self) Returns: Python statement to create an equivalent object |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`
Inherited from BaseIP
__eq__(self, other) Returns: `True` if this IPAddress or IPNetwork object is equivalent to `other`, `False` otherwise. |
__ge__(self, other) Returns: `True` if this IPAddress or IPNetwork object is greater than or equal to `other`, `False` otherwise. |
__gt__(self, other) Returns: `True` if this IPAddress or IPNetwork object is greater than `other`, `False` otherwise. |
__hash__(self) Returns: A hash value uniquely indentifying this IP object. |
__le__(self, other) Returns: `True` if this IPAddress or IPNetwork object is less than or equal to `other`, `False` otherwise. |
__lt__(self, other) Returns: `True` if this IPAddress or IPNetwork object is less than `other`, `False` otherwise. |
__ne__(self, other) Returns: `True` if this IPAddress or IPNetwork object is not equivalent to `other`, `False` otherwise. |
_set_value(self, value) |
is_ipv4_compat(self) Returns: `True` if this IP is IPv4-mapped IPv6 address, `False` otherwise. |
is_ipv4_mapped(self) Returns: `True` if this IP is IPv4-compatible IPv6 address, `False` otherwise. |
is_link_local(self) Returns: `True` if this IP is link-local address `False` otherwise. |
is_loopback(self) Returns: `True` if this IP is loopback address (not for network transmission), `False` otherwise. |
is_multicast(self) Returns: `True` if this IP is multicast, `False` otherwise |
is_private(self) Returns: `True` if this IP is for internal/private use only (i.e. |
is_reserved(self) Returns: `True` if this IP is in IANA reserved range, `False` otherwise. |
is_unicast(self) Returns: `True` if this IP is unicast, `False` otherwise |
Inherited from IPListMixin
__bool__(self) Ranged IP objects always represent a sequence of at least one IP address and are therefore always True in the boolean context. |
__contains__(self, other) Returns: `True` if other falls within the boundary of this one, `False` otherwise. |
__getitem__(self, index) Returns: The IP address(es) in this IPNetwork object referenced by index or slice. |
__iter__(self) Returns: An iterator providing access to all IPAddress objects within range represented by this ranged IP object. |
__len__(self) Returns: the number of IP addresses in this ranged IP object. |
__nonzero__(self) Ranged IP objects always represent a sequence of at least one IP address and are therefore always True in the boolean context. |

Properties | [hide private]
| first The integer value of first IP address in this IPRange object.
| last The integer value of last IP address in this IPRange object.
| _end
| _start
Inherited from `object`: `__class__`
Inherited from BaseIP
| _module
| _value
| info A record dict containing IANA registration details for this IP address if available, None otherwise.
| value a positive integer representing the value of IP address/subnet.
| version the IP protocol version represented by this IP object.
Inherited from IPListMixin
| size The total number of IP addresses within this ranged IP object.

Method Details | [hide private]

### __init__(self, start, end, flags=0) (Constructor) |
Constructor. Parameters: `start` - an IPv4 or IPv6 address that forms the lower boundary of this IP range. `end` - an IPv4 or IPv6 address that forms the upper boundary of this IP range. `flags` - (optional) decides which rules are applied to the interpretation of the start and end values. Supported constants are INET_PTON and ZEROFILL. See the netaddr.core docs for further details. Overrides: object.__init__

### __getstate__(self) |
Returns: Pickled state of an `IPRange` object.

### __setstate__(self, state) |
Parameters: `state` - data used to unpickle a pickled `IPRange` object.

### key(self) |
Returns: A key tuple used to uniquely identify this IPRange. Overrides: BaseIP.key

### sort_key(self) |
Returns: A key tuple used to compare and sort this IPRange correctly. Overrides: BaseIP.sort_key

### __str__(self) (Informal representation operator) |
str(x) Returns: this IPRange in a common representational format. Overrides: object.__str__

### __repr__(self) (Representation operator) |
repr(x) Returns: Python statement to create an equivalent object Overrides: object.__repr__

Property Details | [hide private]

### first The integer value of first IP address in this IPRange object. Get Method: unreachable.first(self) - The integer value of first IP address in this IPRange object.

### last The integer value of last IP address in this IPRange object. Get Method: unreachable.last(self) - The integer value of last IP address in this IPRange object.