Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
autocracy authored and Jeff Ferland committed Jun 18, 2020
2 parents b2d6b23 + b02fb5d commit f835bc6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ python:
- "nightly"
before_install: pip install flake8
before_script: flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
script: nosetests -e fuzz
install: pip install pytest
script: pytest -k "not fuzz"
13 changes: 8 additions & 5 deletions IPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
__version__ = '1.00'

import bisect
import collections
import types
try:
import collections.abc as collections_abc
except ImportError:
import collections as collections_abc

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

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

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

def add(self, value):
# Make sure it's iterable, otherwise wrap
if not isinstance(value, collections.Iterable):
if not isinstance(value, collections_abc.Iterable):
value = [value]

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

def discard(self, value):
# Make sure it's iterable, otherwise wrap
if not isinstance(value, collections.Iterable):
if not isinstance(value, collections_abc.Iterable):
value = [value]

# This is much faster than iterating over the addresses
Expand Down
6 changes: 5 additions & 1 deletion test/test_IPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,11 @@ def run(self):
it.setDaemon(True)
it.start()
it.join(timeout_duration)
if it.isAlive():
if hasattr(it, 'is_alive'):
is_alive = it.is_alive()
else:
is_alive = it.isAlive()
if is_alive:
return default
else:
return it.result
Expand Down

0 comments on commit f835bc6

Please sign in to comment.