Use six.add_metaclass instead of __metaclass__
According to http://docs.openstack.org/developer/hacking/ it should be preferred to use six.add_metaclass instead of __metaclass__. Change-Id: I33a0d1b0a0a31beacc8c768eb18fac3cb9ed5936
This commit is contained in:
@@ -3,15 +3,16 @@ import abc
|
||||
import argparse
|
||||
import inspect
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Command(object):
|
||||
"""Base class for command plugins.
|
||||
|
||||
:param app: Application instance invoking the command.
|
||||
:paramtype app: cliff.app.App
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, app, app_args):
|
||||
self.app = app
|
||||
self.app_args = app_args
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import abc
|
||||
import logging
|
||||
|
||||
import six
|
||||
import stevedore
|
||||
|
||||
from .command import Command
|
||||
@@ -11,10 +12,10 @@ from .command import Command
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class DisplayCommandBase(Command):
|
||||
"""Command base class for displaying data about a single object.
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, app, app_args):
|
||||
super(DisplayCommandBase, self).__init__(app, app_args)
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
|
||||
import abc
|
||||
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Formatter(object):
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def add_argument_group(self, parser):
|
||||
@@ -15,10 +17,10 @@ class Formatter(object):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ListFormatter(Formatter):
|
||||
"""Base class for formatters that know how to deal with multiple objects.
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def emit_list(self, column_names, data, stdout, parsed_args):
|
||||
@@ -32,10 +34,10 @@ class ListFormatter(Formatter):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class SingleFormatter(Formatter):
|
||||
"""Base class for formatters that work with single objects.
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def emit_one(self, column_names, data, stdout, parsed_args):
|
||||
|
||||
@@ -13,16 +13,18 @@ except ImportError:
|
||||
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from .display import DisplayCommandBase
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Lister(DisplayCommandBase):
|
||||
"""Command base class for providing a list of data as output.
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@property
|
||||
def formatter_namespace(self):
|
||||
|
||||
@@ -4,16 +4,18 @@ import abc
|
||||
import itertools
|
||||
import logging
|
||||
|
||||
import six
|
||||
|
||||
from .display import DisplayCommandBase
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ShowOne(DisplayCommandBase):
|
||||
"""Command base class for displaying data about a single object.
|
||||
"""
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@property
|
||||
def formatter_namespace(self):
|
||||
|
||||
Reference in New Issue
Block a user