Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2c58910

Browse files
committed
Issue #14814: Clean out an obsolete property and method from ipaddress Network objects
1 parent aff73f9 commit 2c58910

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

Lib/ipaddress.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -709,12 +709,6 @@ def hostmask(self):
709709
self._cache['hostmask'] = x
710710
return x
711711

712-
@property
713-
def network(self):
714-
# XXX (ncoghlan): This is redundant now and will likely be removed
715-
return self.__class__('%s/%d' % (str(self.network_address),
716-
self.prefixlen))
717-
718712
@property
719713
def with_prefixlen(self):
720714
return '%s/%d' % (str(self.ip), self._prefixlen)
@@ -942,12 +936,6 @@ def subnets(self, prefixlen_diff=1, new_prefix=None):
942936

943937
yield current
944938

945-
def masked(self):
946-
"""Return the network object with the host bits masked out."""
947-
# XXX (ncoghlan): This is redundant now and will likely be removed
948-
return self.__class__('%s/%d' % (self.network_address,
949-
self._prefixlen))
950-
951939
def supernet(self, prefixlen_diff=1, new_prefix=None):
952940
"""The supernet containing the current network.
953941
@@ -1908,7 +1896,7 @@ def is_loopback(self):
19081896
19091897
"""
19101898
if isinstance(self, IPv6Network):
1911-
return int(self.network) == 1 and getattr(
1899+
return int(self) == 1 and getattr(
19121900
self, '_prefixlen', 128) == 128
19131901
elif isinstance(self, IPv6Interface):
19141902
return int(self.network.network_address) == 1 and getattr(

Lib/test/test_ipaddress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def testSubnetFailsForNegativeCidrDiff(self):
390390
self.assertRaises(ValueError, list,
391391
self.ipv4_interface.network.subnets(-1))
392392
self.assertRaises(ValueError, list,
393-
self.ipv4_network.network.subnets(-1))
393+
self.ipv4_network.subnets(-1))
394394
self.assertRaises(ValueError, list,
395395
self.ipv6_interface.network.subnets(-1))
396396
self.assertRaises(ValueError, list,

0 commit comments

Comments
 (0)