summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-04-16 11:49:39 +0000
committerGerrit Code Review <review@openstack.org>2021-04-16 11:49:39 +0000
commit73108fe2951d5add0cb2e93f2d0153c50824a0bf (patch)
tree6dba16eafceb5ceed511b9291639894c053b16f2
parent02d1cd8b819c5ac10d5f851ca3259fe8fb2e4364 (diff)
parent53e13b52a05c0fdc54f184d31f553a45acf0d44c (diff)
downloadoslo-utils-73108fe2951d5add0cb2e93f2d0153c50824a0bf.tar.gz
Merge "Switch to collections.abc.*"
-rw-r--r--oslo_utils/strutils.py6
-rw-r--r--oslo_utils/tests/test_strutils.py6
2 files changed, 5 insertions, 7 deletions
diff --git a/oslo_utils/strutils.py b/oslo_utils/strutils.py
index 35b15d3..dad63da 100644
--- a/oslo_utils/strutils.py
+++ b/oslo_utils/strutils.py
@@ -17,7 +17,7 @@
System-level utilities and helper functions.
"""
-import collections
+import collections.abc
import math
import re
import unicodedata
@@ -399,12 +399,12 @@ def mask_dict_password(dictionary, secret="***"): # nosec
"""
- if not isinstance(dictionary, collections.Mapping):
+ if not isinstance(dictionary, collections.abc.Mapping):
raise TypeError("Expected a Mapping, got %s instead."
% type(dictionary))
out = {}
for k, v in dictionary.items():
- if isinstance(v, collections.Mapping):
+ if isinstance(v, collections.abc.Mapping):
out[k] = mask_dict_password(v, secret=secret)
continue
# NOTE(jlvillal): Check to see if anything in the dictionary 'key'
diff --git a/oslo_utils/tests/test_strutils.py b/oslo_utils/tests/test_strutils.py
index 0ee35b8..5964b61 100644
--- a/oslo_utils/tests/test_strutils.py
+++ b/oslo_utils/tests/test_strutils.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
@@ -15,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-import collections
+import collections.abc
import copy
import math
from unittest import mock
@@ -659,7 +657,7 @@ class MaskPasswordTestCase(test_base.BaseTestCase):
self.assertEqual(expected, strutils.mask_password(payload))
-class TestMapping(collections.Mapping):
+class TestMapping(collections.abc.Mapping):
"""Test class for non-dict mappings"""
def __init__(self):
super(TestMapping, self).__init__()