Merge "Handle collections.abc deprecations"
This commit is contained in:
commit
386cb95b13
|
@ -14,7 +14,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
# TODO(smcginnis) update this once six has support for collections.abc
|
||||
# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7.
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
import functools
|
||||
import inspect
|
||||
import math
|
||||
|
@ -1089,7 +1095,7 @@ class ControllerMetaclass(type):
|
|||
versioned_methods.append(getattr(base, VER_METHOD_ATTR))
|
||||
|
||||
for key, value in cls_dict.items():
|
||||
if not isinstance(value, collections.Callable):
|
||||
if not isinstance(value, Callable):
|
||||
continue
|
||||
if getattr(value, 'wsgi_action', None):
|
||||
actions[value.wsgi_action] = key
|
||||
|
|
|
@ -48,13 +48,15 @@
|
|||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
"""
|
||||
CLI interface for cinder management.
|
||||
"""
|
||||
"""CLI interface for cinder management."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import collections
|
||||
try:
|
||||
import collections.abc as collections
|
||||
except ImportError:
|
||||
import collections
|
||||
|
||||
import logging as python_logging
|
||||
import prettytable
|
||||
import sys
|
||||
|
|
|
@ -20,6 +20,12 @@
|
|||
|
||||
|
||||
import collections
|
||||
|
||||
try:
|
||||
from collections.abc import Iterable
|
||||
except ImportError:
|
||||
from collections import Iterable
|
||||
|
||||
import datetime as dt
|
||||
import functools
|
||||
import itertools
|
||||
|
@ -7184,7 +7190,7 @@ def condition_db_filter(model, field, value):
|
|||
"""
|
||||
orm_field = getattr(model, field)
|
||||
# For values that must match and are iterables we use IN
|
||||
if (isinstance(value, collections.Iterable) and
|
||||
if (isinstance(value, Iterable) and
|
||||
not isinstance(value, six.string_types)):
|
||||
# We cannot use in_ when one of the values is None
|
||||
if None not in value:
|
||||
|
@ -7210,7 +7216,7 @@ def condition_not_db_filter(model, field, value, auto_none=True):
|
|||
result = ~condition_db_filter(model, field, value)
|
||||
|
||||
if (auto_none
|
||||
and ((isinstance(value, collections.Iterable) and
|
||||
and ((isinstance(value, Iterable) and
|
||||
not isinstance(value, six.string_types)
|
||||
and None not in value)
|
||||
or (value is not None))):
|
||||
|
|
|
@ -14,7 +14,11 @@
|
|||
|
||||
"""Cinder common internal object model"""
|
||||
|
||||
import collections
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
import contextlib
|
||||
import datetime
|
||||
|
||||
|
@ -162,7 +166,7 @@ class CinderObjectRegistry(base.VersionedObjectRegistry):
|
|||
|
||||
# If registering class has a callable initialization method, call it.
|
||||
if isinstance(getattr(cls, 'cinder_ovo_cls_init', None),
|
||||
collections.Callable):
|
||||
Callable):
|
||||
cls.cinder_ovo_cls_init()
|
||||
|
||||
|
||||
|
@ -572,7 +576,7 @@ class CinderObjectSerializer(base.VersionedObjectSerializer):
|
|||
entity = self._process_iterable(context, self.serialize_entity,
|
||||
entity)
|
||||
elif (hasattr(entity, 'obj_to_primitive') and
|
||||
isinstance(entity.obj_to_primitive, collections.Callable)):
|
||||
isinstance(entity.obj_to_primitive, Callable)):
|
||||
# NOTE(dulek): Backport outgoing object to the capped version.
|
||||
backport_ver = self._get_capped_obj_version(entity)
|
||||
entity = entity.obj_to_primitive(backport_ver, self.manifest)
|
||||
|
|
|
@ -13,7 +13,11 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
try:
|
||||
import collections.abc as collections
|
||||
except ImportError:
|
||||
import collections
|
||||
|
||||
import inspect
|
||||
|
||||
import decorator
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Manage backends in the current zone.
|
||||
"""
|
||||
"""Manage backends in the current zone."""
|
||||
|
||||
import collections
|
||||
# TODO(smcginnis) update this once six has support for collections.abc
|
||||
# (https://github.com/benjaminp/six/pull/241) or clean up once we drop py2.7.
|
||||
try:
|
||||
from collections.abc import Mapping
|
||||
except ImportError:
|
||||
from collections import Mapping
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -68,7 +71,7 @@ CONF.import_opt('max_over_subscription_ratio', 'cinder.volume.driver')
|
|||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ReadOnlyDict(collections.Mapping):
|
||||
class ReadOnlyDict(Mapping):
|
||||
"""A read-only dict."""
|
||||
def __init__(self, source=None):
|
||||
if source is not None:
|
||||
|
|
|
@ -11,11 +11,12 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""
|
||||
Mock unit tests for the NetApp block storage driver interfaces
|
||||
"""
|
||||
"""Mock unit tests for the NetApp block storage driver interfaces"""
|
||||
|
||||
import collections
|
||||
try:
|
||||
from collections.abc import Callable
|
||||
except ImportError:
|
||||
from collections import Callable
|
||||
|
||||
from cinder import test
|
||||
from cinder.volume.drivers.netapp.dataontap import block_cmode
|
||||
|
@ -55,4 +56,4 @@ class NetAppBlockStorageDriverInterfaceTestCase(test.TestCase):
|
|||
def _get_local_functions(self, obj):
|
||||
"""Get function names of an object without superclass functions."""
|
||||
return set([key for key, value in type(obj).__dict__.items()
|
||||
if isinstance(value, collections.Callable)])
|
||||
if isinstance(value, Callable)])
|
||||
|
|
Loading…
Reference in New Issue