From ea1bc9bda66bbe4046ef5d2219286f9cb919d567 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 22 Jul 2021 19:33:46 +0900 Subject: [PATCH] Replace deprecated import of ABCs from collections ABCs in collections should be imported from collections.abc and direct import from collections is deprecated since Python 3.3. Closes-Bug: #1936667 Change-Id: Iafc013cb9b454bc5251d126643f68f3112dafa54 --- tacker/policy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tacker/policy.py b/tacker/policy.py index b712a8100..556df5713 100644 --- a/tacker/policy.py +++ b/tacker/policy.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import collections +from collections import abc import re import sys @@ -129,7 +129,7 @@ def _is_attribute_explicitly_set(attribute_name, resource, target, action): def _should_validate_sub_attributes(attribute, sub_attr): """Verify that sub-attributes are iterable and should be validated.""" validate = attribute.get('validate') - return (validate and isinstance(sub_attr, collections.Iterable) and + return (validate and isinstance(sub_attr, abc.Iterable) and any([k.startswith('type:dict') and v for (k, v) in validate.items()]))