commit 18d869276b6530da5e03a9f066a87fb0a93cdef2 Author: xuanyandong Date: Wed Oct 7 17:28:36 2020 +0800 Remove six of dir cinder/brick,cinder/common,cinder/interface,cinder/objects Replace the following items with Python 3 style code. - six.moves - six.add_metaclass - six.string_types Change-Id: Ia46f5967c8e31a17a1614d164e41f8bd81e76f49 Implements: blueprint six-removal diff --git a/cinder/brick/local_dev/lvm.py b/cinder/brick/local_dev/lvm.py index 8e29b8f..6c6655d 100644 --- a/cinder/brick/local_dev/lvm.py +++ b/cinder/brick/local_dev/lvm.py @@ -25,7 +25,6 @@ from os_brick import executor from oslo_concurrency import processutils as putils from oslo_log import log as logging from oslo_utils import excutils -from six import moves from cinder import exception import cinder.privsep.lvm @@ -311,7 +310,7 @@ class LVM(executor.Executor): lv_list = [] if out is not None: volumes = out.split() - iterator = moves.zip(*[iter(volumes)] * 3) # pylint: disable=E1101 + iterator = zip(*[iter(volumes)] * 3) # pylint: disable=E1101 for vg, name, size in iterator: lv_list.append({"vg": vg, "name": name, "size": size}) diff --git a/cinder/common/sqlalchemyutils.py b/cinder/common/sqlalchemyutils.py index ab3cd16..2a86683 100644 --- a/cinder/common/sqlalchemyutils.py +++ b/cinder/common/sqlalchemyutils.py @@ -20,7 +20,6 @@ import datetime from oslo_log import log as logging -from six.moves import range import sqlalchemy import sqlalchemy.sql as sa_sql from sqlalchemy.sql import type_api diff --git a/cinder/interface/base.py b/cinder/interface/base.py index 0804525..e755324 100644 --- a/cinder/interface/base.py +++ b/cinder/interface/base.py @@ -17,8 +17,6 @@ import abc import inspect -import six - if hasattr(inspect, 'getfullargspec'): getargspec = inspect.getfullargspec else: @@ -59,8 +57,7 @@ def _get_method_info(cls): return result -@six.add_metaclass(abc.ABCMeta) -class CinderInterface(object): +class CinderInterface(object, metaclass=abc.ABCMeta): """Interface base class for Cinder. Cinder interfaces should inherit from this class to support indirect diff --git a/cinder/objects/volume_type.py b/cinder/objects/volume_type.py index 849ba81..4fdf9fc 100644 --- a/cinder/objects/volume_type.py +++ b/cinder/objects/volume_type.py @@ -14,7 +14,6 @@ from oslo_utils import versionutils from oslo_versionedobjects import fields -import six from cinder import db from cinder import exception @@ -94,7 +93,7 @@ class VolumeType(base.CinderPersistentObject, base.CinderObject, # have to do a conversion here for VolumeTypeProjects ORM instance # lists. projects = db_type.get('projects', []) - if projects and not isinstance(projects[0], six.string_types): + if projects and not isinstance(projects[0], str): projects = [p.project_id for p in projects] type.projects = projects if 'qos_specs' in expected_attrs: