diff options
author | Zuul <zuul@review.opendev.org> | 2021-08-02 12:07:55 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-08-02 12:07:55 +0000 |
commit | 1ff618a519c8233292225b72c3a3c5026dd61815 (patch) | |
tree | c80e253185a9c6a4d964a0662ef26479a2355e20 | |
parent | 5590ecdce036f7a2b11ff440dfd4eb637180abcc (diff) | |
parent | 0b0c35999b6678b650861fd409239a42b3718f6a (diff) | |
download | trove-1ff618a519c8233292225b72c3a3c5026dd61815.tar.gz |
Merge "Replace deprecated import of ABCs from collections"
-rw-r--r-- | trove/common/utils.py | 4 | ||||
-rw-r--r-- | trove/guestagent/common/guestagent_utils.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/trove/common/utils.py b/trove/common/utils.py index 49823db5..bbddef87 100644 --- a/trove/common/utils.py +++ b/trove/common/utils.py @@ -14,7 +14,7 @@ # under the License. """I totally stole most of this from melange, thx guys!!!""" -import collections +from collections import abc import inspect import os import shutil @@ -331,7 +331,7 @@ def unpack_singleton(container): def is_collection(item): """Return True is a given item is an iterable collection, but not a string. """ - return (isinstance(item, collections.Iterable) and + return (isinstance(item, abc.Iterable) and not isinstance(item, (bytes, str))) diff --git a/trove/guestagent/common/guestagent_utils.py b/trove/guestagent/common/guestagent_utils.py index 23d009bb..ee452d68 100644 --- a/trove/guestagent/common/guestagent_utils.py +++ b/trove/guestagent/common/guestagent_utils.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import collections +from collections import abc import os import re @@ -46,7 +46,7 @@ def update_dict(updates, target): if updates is not None: for k, v in updates.items(): - if isinstance(v, collections.Mapping): + if isinstance(v, abc.Mapping): target[k] = update_dict(v, target.get(k, {})) else: target[k] = updates[k] @@ -84,7 +84,7 @@ def flatten_dict(target, namespace_sep='.'): """ def flatten(target, keys, namespace_sep): flattened = {} - if isinstance(target, collections.Mapping): + if isinstance(target, abc.Mapping): for k, v in target.items(): flattened.update( flatten(v, keys + [k], namespace_sep)) |