Package list python-castellan / 3ccf918
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> Moisés Guimarães de Medeiros 1 year, 8 months ago
10 changed file(s) with 17 addition(s) and 38 deletion(s). Raw diff Collapse all Expand all
2222
2323 import abc
2424
25 import six
2625
27
28 @six.add_metaclass(abc.ABCMeta)
29 class Credential(object):
26 class Credential(object, metaclass=abc.ABCMeta):
3027 """Base class to represent all credentials."""
3128
3229 def __init__(self):
1616 Castellan exception subclasses
1717 """
1818
19 import six.moves.urllib.parse as urlparse
19 import urllib
2020
2121 from castellan.i18n import _
2222
2525
2626 class RedirectException(Exception):
2727 def __init__(self, url):
28 self.url = urlparse.urlparse(url)
28 self.url = urllib.parse.urlparse(url)
2929
3030
3131 class CastellanException(Exception):
1818 This module defines the Certificate class.
1919 """
2020
21 import abc
22
23 import six
24
2521 from castellan.common.objects import managed_object
2622
2723
28 @six.add_metaclass(abc.ABCMeta)
2924 class Certificate(managed_object.ManagedObject):
3025 """Base class to represent all certificates."""
2020 from Java.
2121 """
2222
23 import abc
24
2325 from castellan.common.objects import managed_object
2426
25 import abc
2627
27 import six
28
29
30 @six.add_metaclass(abc.ABCMeta)
3128 class Key(managed_object.ManagedObject):
3229 """Base class to represent all keys."""
3330
2020 """
2121 import abc
2222
23 import six
2423
25
26 @six.add_metaclass(abc.ABCMeta)
27 class ManagedObject(object):
24 class ManagedObject(object, metaclass=abc.ABCMeta):
2825 """Base class to represent all managed objects."""
2926
3027 def __init__(self, name=None, created=None, id=None):
1717 """
1818 import calendar
1919 import time
20 import urllib
2021
2122 from cryptography.hazmat import backends
2223 from cryptography.hazmat.primitives import serialization
4344 from barbicanclient import client as barbican_client_import
4445 from barbicanclient import exceptions as barbican_exceptions
4546 from oslo_utils import timeutils
46 from six.moves import urllib
4747
4848
4949 _barbican_opts = [
1818
1919 import abc
2020
21 import six
2221
23
24 @six.add_metaclass(abc.ABCMeta)
25 class KeyManager(object):
22 class KeyManager(object, metaclass=abc.ABCMeta):
2623 """Base Key Manager Interface
2724
2825 A Key Manager is responsible for managing encryption keys for volumes. A
3030 from oslo_log import log as logging
3131 from oslo_utils import timeutils
3232 import requests
33 import six
3433
3534 from castellan.common import exception
3635 from castellan.common.objects import opaque_data as op_data
173172 json=params,
174173 verify=self._verify_server)
175174 except requests.exceptions.Timeout as ex:
176 raise exception.KeyManagerError(six.text_type(ex))
175 raise exception.KeyManagerError(str(ex))
177176 except requests.exceptions.ConnectionError as ex:
178 raise exception.KeyManagerError(six.text_type(ex))
177 raise exception.KeyManagerError(str(ex))
179178 except Exception as ex:
180 raise exception.KeyManagerError(six.text_type(ex))
179 raise exception.KeyManagerError(str(ex))
181180
182181 if resp.status_code in _EXCEPTIONS_BY_CODE:
183182 raise exception.KeyManagerError(resp.reason)
199198 try:
200199 resp = method(resource, headers=headers, json=json, verify=verify)
201200 except requests.exceptions.Timeout as ex:
202 raise exception.KeyManagerError(six.text_type(ex))
201 raise exception.KeyManagerError(str(ex))
203202 except requests.exceptions.ConnectionError as ex:
204 raise exception.KeyManagerError(six.text_type(ex))
203 raise exception.KeyManagerError(str(ex))
205204 except Exception as ex:
206 raise exception.KeyManagerError(six.text_type(ex))
205 raise exception.KeyManagerError(str(ex))
207206
208207 if resp.status_code in _EXCEPTIONS_BY_CODE:
209208 raise exception.KeyManagerError(resp.reason)
1818 import functools
1919 import types
2020
21 import six
22
2321
2422 def construct_new_test_function(original_func, name, build_params):
2523 """Builds a new test function based on parameterized data.
3129 :return: A new function object
3230 """
3331 new_func = types.FunctionType(
34 six.get_function_code(original_func),
35 six.get_function_globals(original_func),
32 original_func.__code__,
33 original_func.__globals__,
3634 name=name,
37 argdefs=six.get_function_defaults(original_func)
35 argdefs=original_func.__defaults__,
3836 )
3937
4038 for key, val in original_func.__dict__.items():
5757 requests==2.18.0
5858 requestsexceptions==1.2.0
5959 rfc3986==0.3.1
60 six==1.10.0
6160 smmap==0.9.0
6261 snowballstemmer==1.2.1
6362 stevedore==1.20.0