summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2018-06-27 15:16:57 +0200
committerFlorian Bruhin <git@the-compiler.org>2018-06-27 15:19:08 +0200
commit86d4146f0debc004b4a8b6aa69df818ef4ad9080 (patch)
treea15ef488e1f1c73e4135666160d789e58325908b
parent3beeb23ca7b8d105b05559de3f9defd0f70168e0 (diff)
downloadmarkupsafe-86d4146f0debc004b4a8b6aa69df818ef4ad9080.tar.gz
Import Mapping from collections.abc
In Python 3.7, importing ABCs directly from the `collections` module shows a warning (and in Python 3.8 it will stop working) - see https://github.com/python/cpython/commit/c66f9f8d3909f588c251957d499599a1680e2320 This fixes the following `DeprecationWarning`: >>> import warnings >>> warnings.simplefilter('default') >>> import markupsafe .../markupsafe/__init__.py:12: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Mapping
-rw-r--r--markupsafe/__init__.py4
-rw-r--r--markupsafe/_compat.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/markupsafe/__init__.py b/markupsafe/__init__.py
index 0acf735..0bd6fd2 100644
--- a/markupsafe/__init__.py
+++ b/markupsafe/__init__.py
@@ -9,13 +9,11 @@ special characters with safe representations.
:copyright: © 2010 by the Pallets team.
:license: BSD, see LICENSE for more details.
"""
-from collections import Mapping
-
import re
import string
from markupsafe._compat import (
- PY2, int_types, iteritems, string_types, text_type, unichr
+ PY2, int_types, iteritems, string_types, text_type, unichr, Mapping
)
__version__ = '1.1'
diff --git a/markupsafe/_compat.py b/markupsafe/_compat.py
index 7435faf..4d2e2cd 100644
--- a/markupsafe/_compat.py
+++ b/markupsafe/_compat.py
@@ -16,9 +16,11 @@ if not PY2:
unichr = chr
int_types = (int,)
iteritems = lambda x: iter(x.items())
+ from collections.abc import Mapping
else:
text_type = unicode
string_types = (str, unicode)
unichr = unichr
int_types = (int, long)
iteritems = lambda x: x.iteritems()
+ from collections import Mapping