Skip to content

Commit

Permalink
Apply six for metaclass
Browse files Browse the repository at this point in the history
__metaclass__ cannot be used in python3.
six be used in general for python 3 compatibility.

Change-Id: I1d21c82163a1c00bbf4fbf3c9dd513f1c0591b00
Closes-Bug: #1236648
  • Loading branch information
fujioka yuuichi committed Oct 17, 2013
1 parent 8491cae commit c47bb5b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cinder/api/openstack/wsgi.py
Expand Up @@ -29,6 +29,7 @@
from cinder import wsgi

from lxml import etree
import six
from xml.dom import minidom
from xml.parsers import expat

Expand Down Expand Up @@ -1027,11 +1028,10 @@ def __new__(mcs, name, bases, cls_dict):
cls_dict)


@six.add_metaclass(ControllerMetaclass)
class Controller(object):
"""Default controller."""

__metaclass__ = ControllerMetaclass

_view_builder_class = None

def __init__(self, view_builder=None):
Expand Down
5 changes: 3 additions & 2 deletions cinder/keymgr/key.py
Expand Up @@ -25,12 +25,13 @@ class to represent all encryption keys. The basis for this class was copied

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.
Expand Down
5 changes: 3 additions & 2 deletions cinder/keymgr/key_mgr.py
Expand Up @@ -20,16 +20,17 @@

import abc

import six


@six.add_metaclass(abc.ABCMeta)
class KeyManager(object):
"""Base Key Manager Interface
A Key Manager is responsible for managing encryption keys for volumes. A
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):
Expand Down
5 changes: 3 additions & 2 deletions cinder/taskflow/patterns/base.py
Expand Up @@ -19,6 +19,8 @@
import abc
import threading

import six

from cinder.openstack.common import uuidutils

from cinder.taskflow import decorators
Expand All @@ -27,6 +29,7 @@
from cinder.taskflow import utils


@six.add_metaclass(abc.ABCMeta)
class Flow(object):
"""The base abstract class of all flow implementations.
Expand All @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions cinder/taskflow/task.py
Expand Up @@ -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
Expand Down

0 comments on commit c47bb5b

Please sign in to comment.