Skip to content

Commit e60ce66

Browse files
autocracyJeff Ferland
authored andcommitted
Merge branch 'master' into patch-1
2 parents b2d6b23 + b02fb5d commit e60ce66

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ python:
1111
- "nightly"
1212
before_install: pip install flake8
1313
before_script: flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
14-
script: nosetests -e fuzz
14+
install: pip install pytest
15+
script: pytest -k "not fuzz"

IPy.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@
99
__version__ = '1.00'
1010

1111
import bisect
12-
import collections
12+
import sys
1313
import types
14+
try:
15+
import collections.abc as collections_abc
16+
except ImportError:
17+
import collections as collections_abc
1418

1519
# Definition of the Ranges for IPv4 IPs
1620
# this should include www.iana.org/assignments/ipv4-address-space
@@ -370,6 +374,9 @@ def strCompressed(self, wantprefixlen = None):
370374
'ffff:ffff:ffff:ffff:ffff:f:f:fffc/127'
371375
"""
372376

377+
378+
379+
373380
if self.WantPrefixLen == None and wantprefixlen == None:
374381
wantprefixlen = 1
375382

@@ -1022,10 +1029,10 @@ def v46map(self):
10221029
raise ValueError("%s cannot be converted to an IPv4 address."
10231030
% repr(self))
10241031

1025-
class IPSet(collections.MutableSet):
1032+
class IPSet(collections_abc.MutableSet):
10261033
def __init__(self, iterable=[]):
10271034
# Make sure it's iterable, otherwise wrap
1028-
if not isinstance(iterable, collections.Iterable):
1035+
if not isinstance(iterable, collections_abc.Iterable):
10291036
raise TypeError("'%s' object is not iterable" % type(iterable).__name__)
10301037

10311038
# Make sure we only accept IP objects
@@ -1099,7 +1106,7 @@ def len(self):
10991106

11001107
def add(self, value):
11011108
# Make sure it's iterable, otherwise wrap
1102-
if not isinstance(value, collections.Iterable):
1109+
if not isinstance(value, collections_abc.Iterable):
11031110
value = [value]
11041111

11051112
# Check type
@@ -1113,7 +1120,7 @@ def add(self, value):
11131120

11141121
def discard(self, value):
11151122
# Make sure it's iterable, otherwise wrap
1116-
if not isinstance(value, collections.Iterable):
1123+
if not isinstance(value, collections_abc.Iterable):
11171124
value = [value]
11181125

11191126
# This is much faster than iterating over the addresses

test/test_IPy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,11 @@ def run(self):
788788
it.setDaemon(True)
789789
it.start()
790790
it.join(timeout_duration)
791-
if it.isAlive():
791+
if hasattr(it, 'is_alive'):
792+
is_alive = it.is_alive()
793+
else:
794+
is_alive = it.isAlive()
795+
if is_alive:
792796
return default
793797
else:
794798
return it.result

0 commit comments

Comments
 (0)