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