aboutsummaryrefslogtreecommitdiff
path: root/uritemplate
diff options
context:
space:
mode:
Diffstat (limited to 'uritemplate')
-rw-r--r--uritemplate/orderedset.py8
-rw-r--r--uritemplate/variable.py8
2 files changed, 12 insertions, 4 deletions
diff --git a/uritemplate/orderedset.py b/uritemplate/orderedset.py
index 7a9d33e..f21c9cb 100644
--- a/uritemplate/orderedset.py
+++ b/uritemplate/orderedset.py
@@ -1,14 +1,18 @@
# From: https://github.com/ActiveState/code/blob/master/recipes/Python/576696_OrderedSet_with_Weakrefs/ # noqa
-import collections
from weakref import proxy
+try:
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc
+
class Link(object):
__slots__ = 'prev', 'next', 'key', '__weakref__'
-class OrderedSet(collections.MutableSet):
+class OrderedSet(collections_abc.MutableSet):
'Set the remembers the order elements were added'
# Big-O running times for all methods are the same as for regular sets.
# The internal self.__map dictionary maps keys to links in a doubly linked
diff --git a/uritemplate/variable.py b/uritemplate/variable.py
index 0d2e695..a3bd4ce 100644
--- a/uritemplate/variable.py
+++ b/uritemplate/variable.py
@@ -15,9 +15,13 @@ What do you do?
"""
-import collections
import sys
+try:
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc
+
if sys.version_info.major == 2:
import urllib
elif sys.version_info.major == 3:
@@ -360,7 +364,7 @@ def list_test(value):
def dict_test(value):
- return isinstance(value, (dict, collections.MutableMapping))
+ return isinstance(value, (dict, collections_abc.MutableMapping))
try: