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: Ie312cb884537ec541bf2111fe8a647e939b6519e
This commit is contained in:
Takashi Kajinami
2021-07-17 00:51:50 +09:00
committed by Rabi Mishra
parent 4753a47bbf
commit 796a8f5a96

View File

@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import collections from collections import abc
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six import six
from six.moves.urllib import error from six.moves.urllib import error
@@ -203,10 +203,10 @@ def deep_update(old, new):
old = {} old = {}
for k, v in new.items(): for k, v in new.items():
if isinstance(v, collections.Mapping): if isinstance(v, abc.Mapping):
r = deep_update(old.get(k, {}), v) r = deep_update(old.get(k, {}), v)
old[k] = r old[k] = r
elif v is None and isinstance(old.get(k), collections.Mapping): elif v is None and isinstance(old.get(k), abc.Mapping):
# Don't override empty data, to work around yaml syntax issue # Don't override empty data, to work around yaml syntax issue
pass pass
else: else: