summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2021-02-01 11:04:19 +0000
committerGerrit Code Review <review@openstack.org>2021-02-01 11:04:19 +0000
commitec513deafb9758f337855326a4f789b71df57044 (patch)
tree14237814fe4dcf92e0fb10f03b6d7392c2df0540
parent195ddc302352faa3f23cc15a691075a035ade841 (diff)
parent424ff50a4fa7f2134304e282155c1eaafa38e683 (diff)
downloadoslo-policy-ec513deafb9758f337855326a4f789b71df57044.tar.gz
Merge "Switch to collections.abc.MutableMapping"
-rw-r--r--oslo_policy/policy.py6
-rw-r--r--oslo_policy/shell.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/oslo_policy/policy.py b/oslo_policy/policy.py
index f21ebe9..6ba1bcd 100644
--- a/oslo_policy/policy.py
+++ b/oslo_policy/policy.py
@@ -221,7 +221,7 @@ by setting the ``policy_default_rule`` configuration setting to the
desired rule name.
"""
-import collections
+import collections.abc
import copy
import logging
import os
@@ -953,9 +953,9 @@ class Enforcer(object):
# a method on RequestContext objects that converts attributes of the
# context object to policy values. However, ``to_policy_values()``
# doesn't actually return a dictionary, it's a subclass of
- # collections.MutableMapping, which behaves like a dictionary but
+ # collections.abc.MutableMapping, which behaves like a dictionary but
# doesn't pass the type check.
- elif not isinstance(creds, collections.MutableMapping):
+ elif not isinstance(creds, collections.abc.MutableMapping):
msg = (
'Expected type oslo_context.context.RequestContext, dict, or '
'the output of '
diff --git a/oslo_policy/shell.py b/oslo_policy/shell.py
index 7ffb5ea..da1bf1e 100644
--- a/oslo_policy/shell.py
+++ b/oslo_policy/shell.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import collections
+import collections.abc
import sys
from oslo_serialization import jsonutils
@@ -59,7 +59,7 @@ def flatten(d, parent_key=''):
items = []
for k, v in d.items():
new_key = parent_key + '.' + k if parent_key else k
- if isinstance(v, collections.MutableMapping):
+ if isinstance(v, collections.abc.MutableMapping):
items.extend(flatten(v, new_key).items())
else:
items.append((new_key, v))