Kaydet (Commit) e3ded955 authored tarafından Nick Coghlan's avatar Nick Coghlan

Issue #14814: Remove redundant property from interface objects - prefixlen can…

Issue #14814: Remove redundant property from interface objects - prefixlen can be accessed via the associated network object
üst 7362c3ef
......@@ -1330,10 +1330,6 @@ class IPv4Interface(IPv4Address):
def __hash__(self):
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
......@@ -1946,10 +1942,6 @@ class IPv6Interface(IPv6Address):
def __hash__(self):
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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment