Python 3.10 support: collections.abc (#20441)
This commit is contained in:
8
lib/spack/external/jinja2/runtime.py
vendored
8
lib/spack/external/jinja2/runtime.py
vendored
@@ -315,10 +315,14 @@ def __repr__(self):
|
||||
|
||||
# register the context as mapping if possible
|
||||
try:
|
||||
from collections import Mapping
|
||||
from collections.abc import Mapping
|
||||
Mapping.register(Context)
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
from collections import Mapping
|
||||
Mapping.register(Context)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class BlockReference(object):
|
||||
|
12
lib/spack/external/jinja2/sandbox.py
vendored
12
lib/spack/external/jinja2/sandbox.py
vendored
@@ -14,7 +14,7 @@
|
||||
"""
|
||||
import types
|
||||
import operator
|
||||
from collections import Mapping
|
||||
import sys
|
||||
from jinja2.environment import Environment
|
||||
from jinja2.exceptions import SecurityError
|
||||
from jinja2._compat import string_types, PY2
|
||||
@@ -23,6 +23,11 @@
|
||||
from markupsafe import EscapeFormatter
|
||||
from string import Formatter
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
from collections.abc import Mapping
|
||||
else:
|
||||
from collections import Mapping
|
||||
|
||||
|
||||
#: maximum number of items a range may produce
|
||||
MAX_RANGE = 100000
|
||||
@@ -79,7 +84,10 @@
|
||||
pass
|
||||
|
||||
#: register Python 2.6 abstract base classes
|
||||
from collections import MutableSet, MutableMapping, MutableSequence
|
||||
if sys.version_info >= (3, 3):
|
||||
from collections.abc import MutableSet, MutableMapping, MutableSequence
|
||||
else:
|
||||
from collections import MutableSet, MutableMapping, MutableSequence
|
||||
_mutable_set_types += (MutableSet,)
|
||||
_mutable_mapping_types += (MutableMapping,)
|
||||
_mutable_sequence_types += (MutableSequence,)
|
||||
|
7
lib/spack/external/jinja2/tests.py
vendored
7
lib/spack/external/jinja2/tests.py
vendored
@@ -10,11 +10,16 @@
|
||||
"""
|
||||
import operator
|
||||
import re
|
||||
from collections import Mapping
|
||||
import sys
|
||||
from jinja2.runtime import Undefined
|
||||
from jinja2._compat import text_type, string_types, integer_types
|
||||
import decimal
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
from collections.abc import Mapping
|
||||
else:
|
||||
from collections import Mapping
|
||||
|
||||
number_re = re.compile(r'^-?\d+(\.\d+)?$')
|
||||
regex_type = type(number_re)
|
||||
|
||||
|
8
lib/spack/external/jinja2/utils.py
vendored
8
lib/spack/external/jinja2/utils.py
vendored
@@ -482,10 +482,14 @@ def __reversed__(self):
|
||||
|
||||
# register the LRU cache as mutable mapping if possible
|
||||
try:
|
||||
from collections import MutableMapping
|
||||
from collections.abc import MutableMapping
|
||||
MutableMapping.register(LRUCache)
|
||||
except ImportError:
|
||||
pass
|
||||
try:
|
||||
from collections import MutableMapping
|
||||
MutableMapping.register(LRUCache)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
def select_autoescape(enabled_extensions=('html', 'htm', 'xml'),
|
||||
|
Reference in New Issue
Block a user