Apply six for metaclass
__metaclass__ cannot be used in python3. six be used in general for python 3 compatibility. Change-Id: I1d9909d70bb614c9d1c336d0c492027f5b6b5088 Closes-Bug: #1236648
This commit is contained in:
parent
7f0db9568d
commit
5a657dd947
@ -18,6 +18,7 @@
|
||||
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
@ -33,11 +34,10 @@ OK = 'ok'
|
||||
ALARM = 'alarm'
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Evaluator(object):
|
||||
"""Base class for alarm rule evaluator plugins."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, notifier):
|
||||
self.notifier = notifier
|
||||
self.api_client = None
|
||||
|
@ -17,13 +17,13 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AlarmNotifier(object):
|
||||
"""Base class for alarm notifier plugins."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def notify(self, action, alarm_id, previous, current, reason):
|
||||
"""Notify that an alarm has been triggered.
|
||||
|
@ -19,6 +19,7 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from oslo.config import cfg
|
||||
from stevedore import extension
|
||||
@ -58,10 +59,9 @@ cfg.CONF.import_opt('partition_rpc_topic', 'ceilometer.alarm.rpc',
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AlarmService(object):
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
EXTENSIONS_NAMESPACE = "ceilometer.alarm.evaluator"
|
||||
|
||||
def _load_evaluators(self):
|
||||
|
@ -17,12 +17,12 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Base(object):
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, conf):
|
||||
self.conf = conf
|
||||
|
||||
|
@ -19,16 +19,16 @@
|
||||
"""
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from ceilometer import plugin
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class ComputePollster(plugin.PollsterBase):
|
||||
"""Base class for plugins that support the polling API on the compute node.
|
||||
"""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_samples(self, manager, cache, instance):
|
||||
"""Return a sequence of Counter instances from polling the resources.
|
||||
|
@ -22,6 +22,7 @@ import abc
|
||||
import collections
|
||||
import fnmatch
|
||||
from oslo.config import cfg
|
||||
import six
|
||||
|
||||
# Import this option so every Notification plugin can use it freely.
|
||||
cfg.CONF.import_opt('notification_topics',
|
||||
@ -37,11 +38,10 @@ class PluginBase(object):
|
||||
"""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class NotificationBase(PluginBase):
|
||||
"""Base class for plugins that support the notification API."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractproperty
|
||||
def event_types(self):
|
||||
"""Return a sequence of strings defining the event types to be
|
||||
@ -85,11 +85,10 @@ class NotificationBase(PluginBase):
|
||||
return []
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PollsterBase(PluginBase):
|
||||
"""Base class for plugins that support the polling API."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_samples(self, manager, cache):
|
||||
"""Return a sequence of Counter instances from polling the resources.
|
||||
|
@ -21,6 +21,7 @@
|
||||
import abc
|
||||
from stevedore import driver
|
||||
from ceilometer.openstack.common import network_utils
|
||||
import six
|
||||
|
||||
|
||||
def get_publisher(url, namespace='ceilometer.publisher'):
|
||||
@ -34,11 +35,10 @@ def get_publisher(url, namespace='ceilometer.publisher'):
|
||||
return loaded_driver.driver(parse_result)
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class PublisherBase(object):
|
||||
"""Base class for plugins that publish the sampler."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, parsed_url):
|
||||
pass
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
import abc
|
||||
import datetime
|
||||
import math
|
||||
import six
|
||||
|
||||
from ceilometer.openstack.common import timeutils
|
||||
|
||||
@ -102,21 +103,19 @@ class Pagination(object):
|
||||
self.sort_dirs = sort_dirs
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class StorageEngine(object):
|
||||
"""Base class for storage engines."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_connection(self, conf):
|
||||
"""Return a Connection instance based on the configuration settings."""
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class Connection(object):
|
||||
"""Base class for storage system connections."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def __init__(self, conf):
|
||||
"""Constructor."""
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
"""Base classes for API tests."""
|
||||
import os
|
||||
import six
|
||||
import uuid
|
||||
import warnings
|
||||
|
||||
@ -78,8 +79,8 @@ class DB2FakeConnectionUrl(MongoDBFakeConnectionUrl):
|
||||
self.url = self.url.replace('mongodb:', 'db2:', 1)
|
||||
|
||||
|
||||
@six.add_metaclass(test_base.SkipNotImplementedMeta)
|
||||
class MixinTestsWithBackendScenarios(object):
|
||||
__metaclass__ = test_base.SkipNotImplementedMeta
|
||||
|
||||
scenarios = [
|
||||
('sqlalchemy', dict(database_connection='sqlite://')),
|
||||
|
@ -17,6 +17,8 @@
|
||||
# under the License.
|
||||
|
||||
import abc
|
||||
import six
|
||||
|
||||
from stevedore import extension
|
||||
|
||||
|
||||
@ -35,11 +37,10 @@ class TransformerExtensionManager(extension.ExtensionManager):
|
||||
return self.by_name[name]
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class TransformerBase(object):
|
||||
"""Base class for plugins that transform the sample."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""Setup transformer.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user