99__version__ = '1.00'
1010
1111import bisect
12- import collections
1312import 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
0 commit comments