fix cmp in Python 3
This commit is contained in:
parent
f31a81665c
commit
b89931f9fc
1 changed files with 12 additions and 0 deletions
|
@ -297,6 +297,12 @@ class IPNetwork(object):
|
|||
def __cmp__(self, other):
|
||||
return cmp(self.addrs_str, other.addrs_str)
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.addrs_str == other.addrs_str
|
||||
|
||||
def __ne__(self, other):
|
||||
return self.addrs_str != other.addrs_str
|
||||
|
||||
class PortRange(object):
|
||||
def __init__(self, range_str):
|
||||
self.range_str = to_str(range_str)
|
||||
|
@ -328,6 +334,12 @@ class PortRange(object):
|
|||
def __cmp__(self, other):
|
||||
return cmp(self.range_str, other.range_str)
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.range_str == other.range_str
|
||||
|
||||
def __ne__(self, other):
|
||||
return self.range_str != other.range_str
|
||||
|
||||
def test_inet_conv():
|
||||
ipv4 = b'8.8.4.4'
|
||||
b = inet_pton(socket.AF_INET, ipv4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue