Skip to content

Commit 8616395

Browse files
committed
Fix collections.abc deprecation warnings
1 parent b7e6fff commit 8616395

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

humanfriendly/case.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
# Standard library modules.
2121
import collections
2222

23+
try:
24+
# Python >= 3.3.
25+
from collections.abc import Iterable, Mapping
26+
except ImportError:
27+
# Python 2.7.
28+
from collections import Iterable, Mapping
29+
2330
# Modules included in our package.
2431
from humanfriendly.compat import basestring, unicode
2532

@@ -77,11 +84,11 @@ def setdefault(self, key, default=None):
7784

7885
def update(self, other=None, **kw):
7986
"""Update a case insensitive dictionary with new items."""
80-
if isinstance(other, collections.Mapping):
87+
if isinstance(other, Mapping):
8188
# Copy the items from the given mapping.
8289
for key, value in other.items():
8390
self[key] = value
84-
elif isinstance(other, collections.Iterable):
91+
elif isinstance(other, Iterable):
8592
# Copy the items from the given iterable.
8693
for key, value in other:
8794
self[key] = value

0 commit comments

Comments
 (0)