Remove six.add_metaclass
With python 3.x, classes can use the metaclass= logic to not require usage of the six library. Subsequent patches will replace other six usages. Change-Id: I02b6fbbdc70b228e1734c6085ae4e06a484a556e
This commit is contained in:
parent
71d4993edc
commit
a80f3d4f0e
@ -13,7 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import six
|
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
|
|
||||||
@ -24,8 +23,7 @@ from vitrage.utils import datetime as datetime_utils
|
|||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class DriverBase(object, metaclass=abc.ABCMeta):
|
||||||
class DriverBase(object):
|
|
||||||
|
|
||||||
_datasource_name = None
|
_datasource_name = None
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import six
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
@ -99,8 +98,7 @@ def is_update_event(event):
|
|||||||
return event[DSProps.DATASOURCE_ACTION] == DatasourceAction.UPDATE
|
return event[DSProps.DATASOURCE_ACTION] == DatasourceAction.UPDATE
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class TransformerBase(object, metaclass=abc.ABCMeta):
|
||||||
class TransformerBase(object):
|
|
||||||
|
|
||||||
KEY_SEPARATOR = ':'
|
KEY_SEPARATOR = ':'
|
||||||
QUERY_RESULT = 'graph_query_result'
|
QUERY_RESULT = 'graph_query_result'
|
||||||
|
@ -14,11 +14,8 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class HandlerBase(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class HandlerBase(object):
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -14,11 +14,8 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class ProcessorBase(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class ProcessorBase(object):
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import abc
|
import abc
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
ActionStepWrapper = namedtuple('ActionStepWrapper', ['type', 'params'])
|
ActionStepWrapper = namedtuple('ActionStepWrapper', ['type', 'params'])
|
||||||
@ -23,8 +22,7 @@ ActionStepWrapper = namedtuple('ActionStepWrapper', ['type', 'params'])
|
|||||||
EVALUATOR_EVENT_TYPE = 'type'
|
EVALUATOR_EVENT_TYPE = 'type'
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class Recipe(object, metaclass=abc.ABCMeta):
|
||||||
class Recipe(object):
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import six
|
|
||||||
|
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
from vitrage.evaluator.template_fields import TemplateFields
|
from vitrage.evaluator.template_fields import TemplateFields
|
||||||
@ -66,8 +65,7 @@ def get_template_schema(template):
|
|||||||
return get_content_fault_result(63), None
|
return get_content_fault_result(63), None
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class ActionValidator(object, metaclass=abc.ABCMeta):
|
||||||
class ActionValidator(object):
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
@ -15,15 +15,12 @@
|
|||||||
import abc
|
import abc
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from osprofiler import profiler
|
from osprofiler import profiler
|
||||||
import six
|
|
||||||
|
|
||||||
Mapping = \
|
Mapping = \
|
||||||
namedtuple('Mapping', ['subgraph_element', 'graph_element', 'is_vertex'])
|
namedtuple('Mapping', ['subgraph_element', 'graph_element', 'is_vertex'])
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(profiler.TracedMeta)
|
class GraphAlgorithm(object, metaclass=profiler.TracedMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class GraphAlgorithm(object):
|
|
||||||
__trace_args__ = {'name': 'graph',
|
__trace_args__ = {'name': 'graph',
|
||||||
'info': None,
|
'info': None,
|
||||||
'hide_args': False,
|
'hide_args': False,
|
||||||
|
@ -21,7 +21,6 @@ vitrage.graph.driver namespace.
|
|||||||
"""
|
"""
|
||||||
import abc
|
import abc
|
||||||
import copy
|
import copy
|
||||||
import six
|
|
||||||
|
|
||||||
from vitrage.graph.driver.elements import Edge
|
from vitrage.graph.driver.elements import Edge
|
||||||
from vitrage.graph.driver.elements import Vertex
|
from vitrage.graph.driver.elements import Vertex
|
||||||
@ -34,8 +33,7 @@ class Direction(object):
|
|||||||
BOTH = 3
|
BOTH = 3
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class Graph(object, metaclass=abc.ABCMeta):
|
||||||
class Graph(object):
|
|
||||||
def __init__(self, name, graph_type, vertices=None, edges=None):
|
def __init__(self, name, graph_type, vertices=None, edges=None):
|
||||||
"""Create a Graph instance
|
"""Create a Graph instance
|
||||||
|
|
||||||
|
@ -13,11 +13,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class MachineLearningBase(object, metaclass=abc.ABCMeta):
|
||||||
class MachineLearningBase(object):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def process_event(self, data, event_type):
|
def process_event(self, data, event_type):
|
||||||
|
@ -13,11 +13,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class NotifierBase(object, metaclass=abc.ABCMeta):
|
||||||
class NotifierBase(object):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def process_event(self, data, event_type):
|
def process_event(self, data, event_type):
|
||||||
|
@ -13,11 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class SnmpSenderBase(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class SnmpSenderBase(object):
|
|
||||||
"""Abstract Vitrage snmp trap sender"""
|
"""Abstract Vitrage snmp trap sender"""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
@ -13,11 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
import abc
|
import abc
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
class Connection(object, metaclass=abc.ABCMeta):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Connection(object):
|
|
||||||
"""Base class for storage system connections."""
|
"""Base class for storage system connections."""
|
||||||
|
|
||||||
def __init__(self, url):
|
def __init__(self, url):
|
||||||
@ -64,8 +61,7 @@ class Connection(object):
|
|||||||
raise NotImplementedError('clear is not implemented')
|
raise NotImplementedError('clear is not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class ActiveActionsConnection(object, metaclass=abc.ABCMeta):
|
||||||
class ActiveActionsConnection(object):
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create(self, active_action):
|
def create(self, active_action):
|
||||||
"""Create a new action.
|
"""Create a new action.
|
||||||
@ -112,8 +108,7 @@ class ActiveActionsConnection(object):
|
|||||||
raise NotImplementedError('delete active actions is not implemented')
|
raise NotImplementedError('delete active actions is not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class WebhooksConnection(object, metaclass=abc.ABCMeta):
|
||||||
class WebhooksConnection(object):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create(self, webhook):
|
def create(self, webhook):
|
||||||
@ -145,8 +140,7 @@ class WebhooksConnection(object):
|
|||||||
raise NotImplementedError('delete webhook is not implemented')
|
raise NotImplementedError('delete webhook is not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class TemplatesConnection(object, metaclass=abc.ABCMeta):
|
||||||
class TemplatesConnection(object):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def create(self, template):
|
def create(self, template):
|
||||||
@ -183,8 +177,7 @@ class TemplatesConnection(object):
|
|||||||
raise NotImplementedError('Delete Templates not implemented')
|
raise NotImplementedError('Delete Templates not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class EventsConnection(object, metaclass=abc.ABCMeta):
|
||||||
class EventsConnection(object):
|
|
||||||
def create(self, event):
|
def create(self, event):
|
||||||
"""Create a new event.
|
"""Create a new event.
|
||||||
|
|
||||||
@ -216,8 +209,7 @@ class EventsConnection(object):
|
|||||||
raise NotImplementedError('delete events is not implemented')
|
raise NotImplementedError('delete events is not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class GraphSnapshotsConnection(object, metaclass=abc.ABCMeta):
|
||||||
class GraphSnapshotsConnection(object):
|
|
||||||
def create(self, graph_snapshot):
|
def create(self, graph_snapshot):
|
||||||
"""Create a new graph snapshot.
|
"""Create a new graph snapshot.
|
||||||
|
|
||||||
@ -244,8 +236,7 @@ class GraphSnapshotsConnection(object):
|
|||||||
raise NotImplementedError('delete graph snapshots not implemented')
|
raise NotImplementedError('delete graph snapshots not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class AlarmsConnection(object, metaclass=abc.ABCMeta):
|
||||||
class AlarmsConnection(object):
|
|
||||||
def create(self, alarm):
|
def create(self, alarm):
|
||||||
raise NotImplementedError('create alarm not implemented')
|
raise NotImplementedError('create alarm not implemented')
|
||||||
|
|
||||||
@ -259,8 +250,7 @@ class AlarmsConnection(object):
|
|||||||
raise NotImplementedError('delete alarms not implemented')
|
raise NotImplementedError('delete alarms not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class EdgesConnection(object, metaclass=abc.ABCMeta):
|
||||||
class EdgesConnection(object):
|
|
||||||
def create(self, edge):
|
def create(self, edge):
|
||||||
raise NotImplementedError('create edge not implemented')
|
raise NotImplementedError('create edge not implemented')
|
||||||
|
|
||||||
@ -274,8 +264,7 @@ class EdgesConnection(object):
|
|||||||
raise NotImplementedError('delete edges not implemented')
|
raise NotImplementedError('delete edges not implemented')
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class ChangesConnection(object, metaclass=abc.ABCMeta):
|
||||||
class ChangesConnection(object):
|
|
||||||
def create(self, change):
|
def create(self, change):
|
||||||
raise NotImplementedError('create change not implemented')
|
raise NotImplementedError('create change not implemented')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user