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:
Benjamin Drung 2020-04-29 14:31:51 +02:00 committed by Daniel Wozniak
parent 1b0b40e30c
commit 2054faec86
3 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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