diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2012-08-05 12:45:22 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-08-05 12:45:22 (GMT) |
commit | e3ded955f3b145e38be47be61c53ba1ff130f47b (patch) | |
tree | e6e00295546d9b6d363789733e20ee2d754c9031 | |
parent | 7362c3efeb49f6656819a0842f9e5fe358d390da (diff) | |
download | cpython-e3ded955f3b145e38be47be61c53ba1ff130f47b.zip cpython-e3ded955f3b145e38be47be61c53ba1ff130f47b.tar.gz cpython-e3ded955f3b145e38be47be61c53ba1ff130f47b.tar.bz2 |
Issue #14814: Remove redundant property from interface objects - prefixlen can be accessed via the associated network object
-rw-r--r-- | Lib/ipaddress.py | 10 | ||||
-rw-r--r-- | Lib/test/test_ipaddress.py | 4 |
2 files changed, 3 insertions, 11 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index dfb5944..c9338c5 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1331,10 +1331,6 @@ class IPv4Interface(IPv4Address): return self._ip ^ self._prefixlen ^ int(self.network.network_address) @property - def prefixlen(self): - return self._prefixlen - - @property def ip(self): return IPv4Address(self._ip) @@ -1708,7 +1704,7 @@ class _BaseV6: hex_str = '%032x' % ip_int parts = [hex_str[x:x+4] for x in range(0, 32, 4)] if isinstance(self, (_BaseNetwork, IPv6Interface)): - return '%s/%d' % (':'.join(parts), self.prefixlen) + return '%s/%d' % (':'.join(parts), self._prefixlen) return ':'.join(parts) @property @@ -1947,10 +1943,6 @@ class IPv6Interface(IPv6Address): return self._ip ^ self._prefixlen ^ int(self.network.network_address) @property - def prefixlen(self): - return self._prefixlen - - @property def ip(self): return IPv6Address(self._ip) diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 061c866..09b4a5e 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -731,8 +731,8 @@ class IpaddrUnitTest(unittest.TestCase): '2001:658:22a:cafe:ffff:ffff:ffff:ffff') def testGetPrefixlen(self): - self.assertEqual(self.ipv4_interface.prefixlen, 24) - self.assertEqual(self.ipv6_interface.prefixlen, 64) + self.assertEqual(self.ipv4_interface.network.prefixlen, 24) + self.assertEqual(self.ipv6_interface.network.prefixlen, 64) def testGetSupernet(self): self.assertEqual(self.ipv4_network.supernet().prefixlen, 23) |