summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ipaddr-py/ipaddr.py4
-rwxr-xr-xcontrib/ipaddr-py/ipaddr_test.py7
2 files changed, 5 insertions, 6 deletions
diff --git a/contrib/ipaddr-py/ipaddr.py b/contrib/ipaddr-py/ipaddr.py
index 07fc873fb15..6ebd22a33ce 100644
--- a/contrib/ipaddr-py/ipaddr.py
+++ b/contrib/ipaddr-py/ipaddr.py
@@ -1222,7 +1222,7 @@ class IPv4Network(_BaseV4, _BaseNet):
"""
# the valid octets for host and netmasks. only useful for IPv4.
- _valid_mask_octets = set((255, 254, 252, 248, 240, 224, 192, 128, 0))
+ _valid_mask_octets = {255, 254, 252, 248, 240, 224, 192, 128, 0}
def __init__(self, address, strict=False):
"""Instantiate a new IPv4 network object.
@@ -1465,7 +1465,7 @@ class _BaseV6(object):
try:
# Now, parse the hextets into a 128-bit integer.
- ip_int = 0L
+ ip_int = 0
for i in xrange(parts_hi):
ip_int <<= 16
ip_int |= self._parse_hextet(parts[i])
diff --git a/contrib/ipaddr-py/ipaddr_test.py b/contrib/ipaddr-py/ipaddr_test.py
index 642466fa2ce..c56ecb5c4b1 100755
--- a/contrib/ipaddr-py/ipaddr_test.py
+++ b/contrib/ipaddr-py/ipaddr_test.py
@@ -265,7 +265,7 @@ class IpaddrUnitTest(unittest.TestCase):
'2001:658:22a:cafe:200::1')
def testGetNetmask(self):
- self.assertEqual(int(self.ipv4.netmask), 4294967040L)
+ self.assertEqual(int(self.ipv4.netmask), 4294967040)
self.assertEqual(str(self.ipv4.netmask), '255.255.255.0')
self.assertEqual(str(self.ipv4_hostmask.netmask), '255.0.0.0')
self.assertEqual(int(self.ipv6.netmask),
@@ -282,7 +282,7 @@ class IpaddrUnitTest(unittest.TestCase):
self.assertTrue(ipv6_zero_netmask._is_valid_netmask(str(0)))
def testGetBroadcast(self):
- self.assertEqual(int(self.ipv4.broadcast), 16909311L)
+ self.assertEqual(int(self.ipv4.broadcast), 16909311)
self.assertEqual(str(self.ipv4.broadcast), '1.2.3.255')
self.assertEqual(int(self.ipv6.broadcast),
@@ -681,8 +681,7 @@ class IpaddrUnitTest(unittest.TestCase):
ip3 = ipaddr.IPNetwork('10.10.10.2/31')
ip4 = ipaddr.IPNetwork('10.10.10.2')
sorted = [ip1, ip2, ip3, ip4]
- unsorted = [ip2, ip4, ip1, ip3]
- unsorted.sort()
+ unsorted = sorted([ip2, ip4, ip1, ip3])
self.assertEqual(sorted, unsorted)
unsorted = [ip4, ip1, ip3, ip2]
unsorted.sort()