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: I5f52283b520a3d4b5a7a112afa85d668f9ec4881
This commit is contained in:
Q.hongtao 2020-09-29 15:19:56 +08:00
parent c168c8fad7
commit f0bb09dae2
6 changed files with 7 additions and 20 deletions

View File

@ -86,8 +86,7 @@ def validate_stored_key_rsa_container(project_id, container_ref, req):
ctxt)
@six.add_metaclass(abc.ABCMeta)
class ValidatorBase(object):
class ValidatorBase(object, metaclass=abc.ABCMeta):
"""Base class for validators."""
name = ''

View File

@ -26,8 +26,7 @@ from barbican.plugin.interface import secret_store as ss
LOG = log.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class CastellanSecretStore(ss.SecretStoreBase):
class CastellanSecretStore(ss.SecretStoreBase, metaclass=abc.ABCMeta):
KEY_ID = "key_id"
ALG = "alg"

View File

@ -13,8 +13,6 @@
import abc
import six
from barbican.common import exception
from barbican import i18n as u
@ -240,8 +238,7 @@ class EncryptDTO(object):
self.unencrypted = unencrypted
@six.add_metaclass(abc.ABCMeta)
class CryptoPluginBase(object):
class CryptoPluginBase(object, metaclass=abc.ABCMeta):
"""Base class for all Crypto plugins.
Barbican requests operations by invoking the methods on an instance of the

View File

@ -25,7 +25,6 @@ import datetime
from oslo_config import cfg
from oslo_utils import encodeutils
import six
from stevedore import named
from barbican.common import config
@ -203,8 +202,7 @@ class CertificateStatusInvalidOperation(exception.BarbicanHTTPException):
self.client_message = self.message
@six.add_metaclass(abc.ABCMeta)
class CertificateEventPluginBase(object):
class CertificateEventPluginBase(object, metaclass=abc.ABCMeta):
"""Base class for certificate eventing plugins.
This class is the base plugin contract for issuing certificate related
@ -239,8 +237,7 @@ class CertificateEventPluginBase(object):
raise NotImplementedError # pragma: no cover
@six.add_metaclass(abc.ABCMeta)
class CertificatePluginBase(object):
class CertificatePluginBase(object, metaclass=abc.ABCMeta):
"""Base class for certificate plugins.
This class is the base plugin contract for certificates.

View File

@ -16,7 +16,6 @@
import abc
from oslo_config import cfg
import six
from stevedore import named
from barbican.common import config
@ -389,8 +388,7 @@ class AsymmetricKeyMetadataDTO(object):
self.passphrase_meta = passphrase_meta
@six.add_metaclass(abc.ABCMeta)
class SecretStoreBase(object):
class SecretStoreBase(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def get_plugin_name(self):

View File

@ -18,8 +18,6 @@ Task resources for the Barbican API.
"""
import abc
import six
from barbican import api
from barbican.common import utils
from barbican import i18n as u
@ -33,8 +31,7 @@ from barbican.tasks import common
LOG = utils.getLogger(__name__)
@six.add_metaclass(abc.ABCMeta)
class BaseTask(object):
class BaseTask(object, metaclass=abc.ABCMeta):
"""Base asynchronous task."""
@abc.abstractmethod