Apply six for metaclass

__metaclass__ cannot be used in python3.
six be used in general for python 3 compatibility.

Change-Id: I1d21c82163a1c00bbf4fbf3c9dd513f1c0591b00
Closes-Bug: #1236648
This commit is contained in:
fujioka yuuichi 2013-10-17 09:53:30 +09:00
parent 8491caeba1
commit c47bb5b89e
5 changed files with 14 additions and 10 deletions

View File

@ -29,6 +29,7 @@ from cinder import utils
from cinder import wsgi
from lxml import etree
import six
from xml.dom import minidom
from xml.parsers import expat
@ -1027,11 +1028,10 @@ class ControllerMetaclass(type):
cls_dict)
@six.add_metaclass(ControllerMetaclass)
class Controller(object):
"""Default controller."""
__metaclass__ = ControllerMetaclass
_view_builder_class = None
def __init__(self, view_builder=None):

View File

@ -25,12 +25,13 @@ from Java.
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class Key(object):
"""Base class to represent all keys."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def get_algorithm(self):
"""Returns the key's algorithm.

View File

@ -20,7 +20,10 @@ Key manager API
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class KeyManager(object):
"""Base Key Manager Interface
@ -28,8 +31,6 @@ class KeyManager(object):
Key Manager is responsible for creating, reading, and deleting keys.
"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def create_key(self, ctxt, algorithm='AES', length=256, expiration=None,
**kwargs):

View File

@ -19,6 +19,8 @@
import abc
import threading
import six
from cinder.openstack.common import uuidutils
from cinder.taskflow import decorators
@ -27,6 +29,7 @@ from cinder.taskflow import states
from cinder.taskflow import utils
@six.add_metaclass(abc.ABCMeta)
class Flow(object):
"""The base abstract class of all flow implementations.
@ -45,8 +48,6 @@ class Flow(object):
- soft_reset
"""
__metaclass__ = abc.ABCMeta
# Common states that certain actions can be performed in. If the flow
# is not in these sets of states then it is likely that the flow operation
# can not succeed.

View File

@ -18,15 +18,16 @@
import abc
import six
from cinder.taskflow import utils
@six.add_metaclass(abc.ABCMeta)
class Task(object):
"""An abstraction that defines a potential piece of work that can be
applied and can be reverted to undo the work as a single unit.
"""
__metaclass__ = abc.ABCMeta
def __init__(self, name):
self.name = name
# An *immutable* input 'resource' name set this task depends