Drop use of six

nit: Certificate inherits from ManagedObject which already has
ABCMeta as metaclass.

Change-Id: I17b12980b88e306fbdc99a3e92b1fa22d8e96471
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This commit is contained in:
Moisés Guimarães de Medeiros 2020-03-07 17:05:48 +01:00
parent ec760471f8
commit 3ccf918c98
10 changed files with 16 additions and 37 deletions

View File

@ -23,11 +23,8 @@ authenticating.
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class Credential(object):
class Credential(object, metaclass=abc.ABCMeta):
"""Base class to represent all credentials."""
def __init__(self):

View File

@ -17,7 +17,7 @@
Castellan exception subclasses
"""
import six.moves.urllib.parse as urlparse
import urllib
from castellan.i18n import _
@ -26,7 +26,7 @@ _FATAL_EXCEPTION_FORMAT_ERRORS = False
class RedirectException(Exception):
def __init__(self, url):
self.url = urlparse.urlparse(url)
self.url = urllib.parse.urlparse(url)
class CastellanException(Exception):

View File

@ -19,13 +19,8 @@ Base Certificate Class
This module defines the Certificate class.
"""
import abc
import six
from castellan.common.objects import managed_object
@six.add_metaclass(abc.ABCMeta)
class Certificate(managed_object.ManagedObject):
"""Base class to represent all certificates."""

View File

@ -21,14 +21,11 @@ represent all encryption keys. The basis for this class was copied
from Java.
"""
from castellan.common.objects import managed_object
import abc
import six
from castellan.common.objects import managed_object
@six.add_metaclass(abc.ABCMeta)
class Key(managed_object.ManagedObject):
"""Base class to represent all keys."""

View File

@ -21,11 +21,8 @@ is the base class to represent all objects managed by the key manager.
"""
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class ManagedObject(object):
class ManagedObject(object, metaclass=abc.ABCMeta):
"""Base class to represent all managed objects."""
def __init__(self, name=None, created=None, id=None):

View File

@ -18,6 +18,7 @@ Key manager implementation for Barbican
"""
import calendar
import time
import urllib
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import serialization
@ -44,7 +45,6 @@ from castellan.key_manager import key_manager
from barbicanclient import client as barbican_client_import
from barbicanclient import exceptions as barbican_exceptions
from oslo_utils import timeutils
from six.moves import urllib
_barbican_opts = [

View File

@ -19,11 +19,8 @@ Key manager API
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class KeyManager(object):
class KeyManager(object, metaclass=abc.ABCMeta):
"""Base Key Manager Interface
A Key Manager is responsible for managing encryption keys for volumes. A

View File

@ -31,7 +31,6 @@ from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import timeutils
import requests
import six
from castellan.common import exception
from castellan.common.objects import opaque_data as op_data
@ -174,11 +173,11 @@ class VaultKeyManager(key_manager.KeyManager):
json=params,
verify=self._verify_server)
except requests.exceptions.Timeout as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
except requests.exceptions.ConnectionError as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
except Exception as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
if resp.status_code in _EXCEPTIONS_BY_CODE:
raise exception.KeyManagerError(resp.reason)
@ -200,11 +199,11 @@ class VaultKeyManager(key_manager.KeyManager):
try:
resp = method(resource, headers=headers, json=json, verify=verify)
except requests.exceptions.Timeout as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
except requests.exceptions.ConnectionError as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
except Exception as ex:
raise exception.KeyManagerError(six.text_type(ex))
raise exception.KeyManagerError(str(ex))
if resp.status_code in _EXCEPTIONS_BY_CODE:
raise exception.KeyManagerError(resp.reason)

View File

@ -19,8 +19,6 @@
import functools
import types
import six
def construct_new_test_function(original_func, name, build_params):
"""Builds a new test function based on parameterized data.
@ -32,10 +30,10 @@ def construct_new_test_function(original_func, name, build_params):
:return: A new function object
"""
new_func = types.FunctionType(
six.get_function_code(original_func),
six.get_function_globals(original_func),
original_func.__code__,
original_func.__globals__,
name=name,
argdefs=six.get_function_defaults(original_func)
argdefs=original_func.__defaults__,
)
for key, val in original_func.__dict__.items():

View File

@ -58,7 +58,6 @@ PyYAML==3.12
requests==2.18.0
requestsexceptions==1.2.0
rfc3986==0.3.1
six==1.10.0
smmap==0.9.0
snowballstemmer==1.2.1
stevedore==1.20.0