Browse Source

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
changes/74/756474/1
xuanyandong 12 months ago
parent
commit
18d869276b
  1. 3
      cinder/brick/local_dev/lvm.py
  2. 1
      cinder/common/sqlalchemyutils.py
  3. 5
      cinder/interface/base.py
  4. 3
      cinder/objects/volume_type.py

3
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})

1
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

5
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

3
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:

Loading…
Cancel
Save