From f806dda6755546d15fcb620a0e4f9e446e6b6c47 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 18 Dec 2019 18:07:17 +0000 Subject: [PATCH] Import ABCs from collections.abc From the deprecation warning message: "Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working" Change-Id: I53b11ebe81977d13a460cdf167ba37c5d3e1bdcd Closes-Bug: #1856882 --- oslo_versionedobjects/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oslo_versionedobjects/base.py b/oslo_versionedobjects/base.py index 1cfc8d06..cc0abb90 100644 --- a/oslo_versionedobjects/base.py +++ b/oslo_versionedobjects/base.py @@ -30,6 +30,11 @@ from oslo_versionedobjects._i18n import _ from oslo_versionedobjects import exception from oslo_versionedobjects import fields as obj_fields +if six.PY3: + from collections import abc as collections_abc +else: + import collections as collections_abc + LOG = logging.getLogger('object') @@ -790,7 +795,7 @@ class VersionedObjectDictCompat(object): setattr(self, key, value) -class ObjectListBase(collections.Sequence): +class ObjectListBase(collections_abc.Sequence): """Mixin class for lists of objects. This mixin class can be added as a base class for an object that