Remove six.add_metaclass
Replace six.add_metaclass with Python 3 style code. Change-Id: Ifc3f2bcb8fcdd2b555864bd4e22a973a7858c272 Implements: blueprint six-removal Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
parent
28ed0c5c9a
commit
5191b4f2f0
nova
@ -737,8 +737,7 @@ class ControllerMetaclass(type):
|
||||
cls_dict)
|
||||
|
||||
|
||||
@six.add_metaclass(ControllerMetaclass)
|
||||
class Controller(object):
|
||||
class Controller(metaclass=ControllerMetaclass):
|
||||
"""Default controller."""
|
||||
|
||||
_view_builder_class = None
|
||||
|
@ -12,13 +12,10 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from nova.objects import fields
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class MonitorBase(object):
|
||||
class MonitorBase(metaclass=abc.ABCMeta):
|
||||
"""Base class for all resource monitor plugins.
|
||||
|
||||
A monitor is responsible for adding a set of related metrics to
|
||||
|
@ -15,8 +15,6 @@ import copy
|
||||
import heapq
|
||||
|
||||
import eventlet
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
@ -114,8 +112,7 @@ def query_wrapper(ctx, fn, *args, **kwargs):
|
||||
return
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class CrossCellLister(object):
|
||||
class CrossCellLister(metaclass=abc.ABCMeta):
|
||||
"""An implementation of a cross-cell efficient lister.
|
||||
|
||||
This primarily provides a listing implementation for fetching
|
||||
|
@ -14,7 +14,6 @@ import abc
|
||||
import functools
|
||||
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
|
||||
def rollback_wrapper(original):
|
||||
@ -28,8 +27,7 @@ def rollback_wrapper(original):
|
||||
return wrap
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class TaskBase(object):
|
||||
class TaskBase(metaclass=abc.ABCMeta):
|
||||
|
||||
def __init__(self, context, instance):
|
||||
self.context = context
|
||||
|
@ -15,8 +15,6 @@
|
||||
import abc
|
||||
import enum
|
||||
|
||||
import six
|
||||
|
||||
VERSION_LENGTH = 12
|
||||
SUBTYPE_LENGTH = 4
|
||||
|
||||
@ -40,8 +38,7 @@ class AuthType(enum.IntEnum):
|
||||
MSLOGON = 0xfffffffa # Used by UltraVNC
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class RFBAuthScheme(object):
|
||||
class RFBAuthScheme(metaclass=abc.ABCMeta):
|
||||
|
||||
@abc.abstractmethod
|
||||
def security_type(self):
|
||||
|
@ -15,11 +15,8 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SecurityProxy(object):
|
||||
class SecurityProxy(metaclass=abc.ABCMeta):
|
||||
"""A console security Proxy Helper
|
||||
|
||||
Console security proxy helpers should subclass
|
||||
|
@ -52,7 +52,6 @@ This module provides Manager, a base class for managers.
|
||||
"""
|
||||
|
||||
from oslo_service import periodic_task
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.db import base
|
||||
@ -87,8 +86,7 @@ class ManagerMeta(profiler.get_traced_meta(), type(PeriodicTasks)):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(ManagerMeta)
|
||||
class Manager(base.Base, PeriodicTasks):
|
||||
class Manager(base.Base, PeriodicTasks, metaclass=ManagerMeta):
|
||||
__trace_args__ = {"name": "rpc"}
|
||||
|
||||
def __init__(self, host=None, service_name='undefined'):
|
||||
|
@ -31,8 +31,7 @@ ANY = '*'
|
||||
REGEX_ANY = '.*'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PciAddressSpec(object):
|
||||
class PciAddressSpec(metaclass=abc.ABCMeta):
|
||||
"""Abstract class for all PCI address spec styles
|
||||
|
||||
This class checks the address fields of the pci.passthrough_whitelist
|
||||
|
@ -21,15 +21,12 @@ Scheduler base class that all Schedulers should inherit from
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from nova import objects
|
||||
from nova.scheduler import host_manager
|
||||
from nova import servicegroup
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Scheduler(object):
|
||||
class Scheduler(metaclass=abc.ABCMeta):
|
||||
"""The base class that all Scheduler classes should inherit from."""
|
||||
|
||||
# TODO(mriedem): We should remove this flag now so that all scheduler
|
||||
|
@ -645,8 +645,7 @@ class APICoverage(object):
|
||||
testtools.matchers.ContainsAll(api_methods))
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SubclassSignatureTestCase(testtools.TestCase):
|
||||
class SubclassSignatureTestCase(testtools.TestCase, metaclass=abc.ABCMeta):
|
||||
"""Ensure all overridden methods of all subclasses of the class
|
||||
under test exactly match the signature of the base class.
|
||||
|
||||
|
@ -79,8 +79,7 @@ def _update_utime_ignore_eacces(path):
|
||||
ctxt.reraise = False
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Image(object):
|
||||
class Image(metaclass=abc.ABCMeta):
|
||||
|
||||
SUPPORTS_CLONE = False
|
||||
|
||||
|
@ -15,16 +15,13 @@
|
||||
import abc
|
||||
import os
|
||||
|
||||
import six
|
||||
|
||||
from nova import utils
|
||||
from nova.virt.libvirt.volume import mount
|
||||
from nova.virt.libvirt.volume import volume as libvirt_volume
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LibvirtBaseFileSystemVolumeDriver(
|
||||
libvirt_volume.LibvirtBaseVolumeDriver):
|
||||
libvirt_volume.LibvirtBaseVolumeDriver, metaclass=abc.ABCMeta):
|
||||
"""The base class for file system type volume drivers"""
|
||||
|
||||
def __init__(self, host):
|
||||
@ -96,8 +93,8 @@ class LibvirtBaseFileSystemVolumeDriver(
|
||||
return os.path.join(mount_path, connection_info['data']['name'])
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class LibvirtMountedFileSystemVolumeDriver(LibvirtBaseFileSystemVolumeDriver):
|
||||
class LibvirtMountedFileSystemVolumeDriver(LibvirtBaseFileSystemVolumeDriver,
|
||||
metaclass=abc.ABCMeta):
|
||||
# NOTE(mdbooth): Hopefully we'll get to the point where everything which
|
||||
# previously subclassed LibvirtBaseFileSystemVolumeDriver now subclasses
|
||||
# LibvirtMountedFileSystemVolumeDriver. If we get there, we should fold
|
||||
|
@ -107,8 +107,7 @@ class RemoteFilesystem(object):
|
||||
compression=compression)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class RemoteFilesystemDriver(object):
|
||||
class RemoteFilesystemDriver(metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def create_file(self, host, dst_path, on_execute, on_completion):
|
||||
"""Create file on the remote system.
|
||||
|
@ -22,7 +22,6 @@ import pypowervm.const as pvm_const
|
||||
import pypowervm.tasks.scsi_mapper as tsk_map
|
||||
import pypowervm.util as pvm_u
|
||||
import pypowervm.wrappers.virtual_io_server as pvm_vios
|
||||
import six
|
||||
|
||||
from nova import exception
|
||||
from nova.virt.powervm import mgmt
|
||||
@ -61,8 +60,7 @@ class IterableToFileAdapter(object):
|
||||
return return_value
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DiskAdapter(object):
|
||||
class DiskAdapter(metaclass=abc.ABCMeta):
|
||||
|
||||
capabilities = {
|
||||
'shared_storage': False,
|
||||
|
@ -148,8 +148,7 @@ def unplug(adapter, instance, vif, cna_w_list=None):
|
||||
_push_vif_event(adapter, 'unplug', vnet_w, instance, vif['type'])
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PvmVifDriver(object):
|
||||
class PvmVifDriver(metaclass=abc.ABCMeta):
|
||||
"""Represents an abstract class for a PowerVM Vif Driver.
|
||||
|
||||
A VIF Driver understands a given virtual interface type (network). It
|
||||
|
@ -19,8 +19,6 @@ Pluggable Weighing support
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
from nova import loadables
|
||||
|
||||
|
||||
@ -63,8 +61,7 @@ class WeighedObject(object):
|
||||
return "<WeighedObject '%s': %s>" % (self.obj, self.weight)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BaseWeigher(object):
|
||||
class BaseWeigher(metaclass=abc.ABCMeta):
|
||||
"""Base class for pluggable weighers.
|
||||
|
||||
The attributes maxval and minval can be specified to set up the maximum
|
||||
|
Loading…
x
Reference in New Issue
Block a user