mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix deprecation warnings for imports from collections
DeprecationWarning: Using or importing the ABCs from `collections`
instead of from `collections.abc` is deprecated since Python 3.3, and in
3.9 it will stop working.
Therefore try to import the abstract base classes from `collections.abc`
before falling back to `collections`.
In commit 420bbe8c08
the import order was
missed for some files.
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
parent
1b0b40e30c
commit
2054faec86
3 changed files with 6 additions and 6 deletions
|
@ -59,9 +59,9 @@ from salt.ext.six.moves.urllib.parse import urlparse as _urlparse
|
|||
from salt.utils.files import HASHES, HASHES_REVMAP
|
||||
|
||||
try:
|
||||
from collections import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections.abc import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections import Iterable, Mapping
|
||||
|
||||
|
||||
# pylint: enable=import-error,no-name-in-module,redefined-builtin
|
||||
|
|
|
@ -124,9 +124,9 @@ from salt.utils.functools import namespaced_function as _namespaced_function
|
|||
|
||||
# pylint: disable=no-name-in-module
|
||||
try:
|
||||
from collections import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections.abc import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections import Iterable, Mapping
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
||||
|
|
|
@ -320,9 +320,9 @@ from salt.state import get_accumulator_dir as _get_accumulator_dir
|
|||
|
||||
# pylint: disable=no-name-in-module
|
||||
try:
|
||||
from collections import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections.abc import Iterable, Mapping
|
||||
except ImportError:
|
||||
from collections import Iterable, Mapping
|
||||
# pylint: enable=no-name-in-module
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue