diff options
author | Florian Bruhin <git@the-compiler.org> | 2018-06-27 15:30:54 +0200 |
---|---|---|
committer | Juan Barreneche <snipperme@gmail.com> | 2019-06-18 10:45:22 -0300 |
commit | 593ee1e481d9534edd65928ac6bae5cfbd2eec14 (patch) | |
tree | 05b29455d00ffcee77fb71df4ded7f8e5a86b186 /docs | |
parent | 4ce2449a4c17e6f2715b6bf04e4dfad1a5926984 (diff) | |
download | jinja-593ee1e481d9534edd65928ac6bae5cfbd2eec14.tar.gz |
Import abstract base classes 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 various DeprecationWarnings such as those:
```
.../jinja2/utils.py:485: 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 MutableMapping
.../jinja2/runtime.py:318: 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
```
Diffstat (limited to 'docs')
-rw-r--r-- | docs/jinjaext.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/jinjaext.py b/docs/jinjaext.py index bb508089..fd38ee8f 100644 --- a/docs/jinjaext.py +++ b/docs/jinjaext.py @@ -8,7 +8,6 @@ :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """ -import collections import os import re import inspect @@ -26,6 +25,7 @@ from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic from jinja2 import Environment, FileSystemLoader +from jinja2._compat import abc def parse_rst(state, content_offset, doc): @@ -160,7 +160,7 @@ def jinja_nodes(dirname, arguments, options, content, lineno, members = [] for key, name in node.__dict__.items(): if not key.startswith('_') and \ - not hasattr(node.__base__, key) and isinstance(name, collections.Callable): + not hasattr(node.__base__, key) and isinstance(name, abc.Callable): members.append(key) if members: members.sort() |