Skip to content

Commit f835bc6

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

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-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: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
__version__ = '1.00'
1010

1111
import bisect
12-
import collections
1312
import types
13+
try:
14+
import collections.abc as collections_abc
15+
except ImportError:
16+
import collections as collections_abc
1417

1518
# Definition of the Ranges for IPv4 IPs
1619
# this should include www.iana.org/assignments/ipv4-address-space
@@ -1022,10 +1025,10 @@ def v46map(self):
10221025
raise ValueError("%s cannot be converted to an IPv4 address."
10231026
% repr(self))
10241027

1025-
class IPSet(collections.MutableSet):
1028+
class IPSet(collections_abc.MutableSet):
10261029
def __init__(self, iterable=[]):
10271030
# Make sure it's iterable, otherwise wrap
1028-
if not isinstance(iterable, collections.Iterable):
1031+
if not isinstance(iterable, collections_abc.Iterable):
10291032
raise TypeError("'%s' object is not iterable" % type(iterable).__name__)
10301033

10311034
# Make sure we only accept IP objects
@@ -1099,7 +1102,7 @@ def len(self):
10991102

11001103
def add(self, value):
11011104
# Make sure it's iterable, otherwise wrap
1102-
if not isinstance(value, collections.Iterable):
1105+
if not isinstance(value, collections_abc.Iterable):
11031106
value = [value]
11041107

11051108
# Check type
@@ -1113,7 +1116,7 @@ def add(self, value):
11131116

11141117
def discard(self, value):
11151118
# Make sure it's iterable, otherwise wrap
1116-
if not isinstance(value, collections.Iterable):
1119+
if not isinstance(value, collections_abc.Iterable):
11171120
value = [value]
11181121

11191122
# 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)