mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Swapping out the version check for a try...except on the import from collections.abc with a fallback to importing from collections.
This commit is contained in:
parent
d118a9fe53
commit
b27e86bd7d
10 changed files with 25 additions and 30 deletions
|
@ -7,11 +7,12 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
# Import Python Libs
|
||||
import sys
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import Iterable, Sequence, Mapping
|
||||
from collections import namedtuple
|
||||
else:
|
||||
from collections import namedtuple, Iterable, Sequence, Mapping
|
||||
except ImportError:
|
||||
from collections import Iterable, Sequence, Mapping
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
import logging
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ import salt.utils.versions
|
|||
from salt.utils.args import get_function_argspec as _argspec
|
||||
from salt.utils.decorators import ensure_unicode_args
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import Sequence
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import Sequence
|
||||
|
||||
# Import 3rd-party libs
|
||||
|
|
|
@ -49,9 +49,9 @@ else:
|
|||
import imp
|
||||
USE_IMPORTLIB = False
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import MutableMapping
|
||||
|
||||
try:
|
||||
|
|
|
@ -14,10 +14,9 @@ from __future__ import absolute_import, print_function, unicode_literals
|
|||
# Import python libs
|
||||
import copy
|
||||
import threading
|
||||
import sys
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import MutableMapping
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
|
|
@ -11,12 +11,11 @@ import copy
|
|||
import fnmatch
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
from collections.abc import MutableMapping, Mapping
|
||||
else:
|
||||
from collections import MutableMapping, Mapping
|
||||
try:
|
||||
from collections.abc import Mapping
|
||||
except ImportError:
|
||||
from collections import Mapping
|
||||
|
||||
# Import Salt libs
|
||||
import salt.utils.dictupdate
|
||||
|
|
|
@ -6,11 +6,10 @@ http://stackoverflow.com/a/3233356
|
|||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
import sys
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import Mapping
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import Mapping
|
||||
|
||||
# Import 3rd-party libs
|
||||
|
|
|
@ -61,9 +61,9 @@ import logging
|
|||
import datetime
|
||||
import sys
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import MutableMapping
|
||||
|
||||
from multiprocessing.util import Finalize
|
||||
|
|
|
@ -11,10 +11,9 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
# Import python libs
|
||||
import sys
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import Mapping, Sequence, Set
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import Mapping, Sequence, Set
|
||||
|
||||
|
||||
|
|
|
@ -6,12 +6,11 @@ Lazily-evaluated data structures, primarily used by Salt's loader
|
|||
# Import Python Libs
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
import logging
|
||||
import sys
|
||||
import salt.exceptions
|
||||
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import MutableMapping
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import MutableMapping
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
# Import python libs
|
||||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
|
||||
import sys
|
||||
if sys.version_info > (3, 7):
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
else:
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
# Import 3rd-party libs
|
||||
|
|
Loading…
Add table
Reference in a new issue