cpython: af4ae710daf3 (original) (raw)

--- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -214,8 +214,10 @@ def _count_righthand_zero_bits(number, b if number == 0: return bits for i in range(bits):

def summarize_address_range(first, last): @@ -263,20 +265,13 @@ def summarize_address_range(first, last) first_int = first._ip last_int = last._ip while first_int <= last_int:

@@ -304,26 +299,28 @@ def _collapse_addresses_recursive(addres passed. """

-

def collapse_addresses(addresses): @@ -452,13 +449,7 @@ class _IPAddressBase: An integer, the prefix length. """

-

def _ip_string_from_prefix(self, prefixlen=None): """Turn a prefix length into a dotted decimal string. @@ -597,18 +588,16 @@ class _BaseNetwork(_IPAddressBase): or broadcast addresses. """

def iter(self):

def getitem(self, n): network = int(self.network_address) @@ -998,7 +987,7 @@ class _BaseV4: _DECIMAL_DIGITS = frozenset('0123456789') # the valid octets for host and netmasks. only useful for IPv4.

def init(self, address): self._version = 4 @@ -1027,13 +1016,10 @@ class _BaseV4: if len(octets) != 4: raise AddressValueError("Expected 4 octets in %r" % ip_str)

def _parse_octet(self, octet_str): """Convert a decimal octet into an integer. @@ -1075,11 +1061,7 @@ class _BaseV4: The IP address as a string in dotted decimal notation. """

def _is_valid_netmask(self, netmask): """Verify that the netmask is valid. @@ -1095,17 +1077,16 @@ class _BaseV4: """ mask = netmask.split('.') if len(mask) == 4:

@@ -1125,7 +1106,7 @@ class _BaseV4: """ bits = ip_str.split('.') try:

@@ -1526,14 +1507,14 @@ class _BaseV6: # Disregarding the endpoints, find '::' with nothing in between. # This indicates that a run of zeroes has been skipped.

# parts_hi is the number of parts to copy from above/before the '::' # parts_lo is the number of parts to copy from below/after the '::' @@ -1680,9 +1661,7 @@ class _BaseV6: raise ValueError('IPv6 address is too large') hex_str = '%032x' % ip_int

hextets = self._compress_hextets(hextets) return ':'.join(hextets) @@ -1705,11 +1684,8 @@ class _BaseV6: ip_str = str(self) ip_int = self._ip_int_from_string(ip_str)

@@ -1756,9 +1732,9 @@ class _BaseV6: IPv6Network('FE00::/9')] if isinstance(self, _BaseAddress):

@property def is_link_local(self):