mirror of
https://github.com/OpenKMIP/PyKMIP.git
synced 2025-07-21 13:04:22 +02:00
Fix source code style to comply with PEP8
This commit is contained in:
parent
155c05069f
commit
263cb34662
@ -776,7 +776,11 @@ class QueryResponsePayload(base.ResponsePayload):
|
||||
|
||||
if kmip_version >= enums.KMIPVersion.KMIP_1_2:
|
||||
attestation_types = []
|
||||
while(self.is_tag_next(enums.Tags.ATTESTATION_TYPE, local_buffer)):
|
||||
while (self.is_tag_next(
|
||||
enums.Tags.ATTESTATION_TYPE,
|
||||
local_buffer
|
||||
)
|
||||
):
|
||||
attestation_type = primitives.Enumeration(
|
||||
enums.AttestationType,
|
||||
tag=enums.Tags.ATTESTATION_TYPE
|
||||
|
@ -658,7 +658,8 @@ class SymmetricKey(Key):
|
||||
}
|
||||
|
||||
def __init__(self, algorithm, length, value, masks=None,
|
||||
name='Symmetric Key', key_wrapping_data=None, app_specific_info=None):
|
||||
name='Symmetric Key', key_wrapping_data=None,
|
||||
app_specific_info=None):
|
||||
"""
|
||||
Create a SymmetricKey.
|
||||
|
||||
@ -674,8 +675,9 @@ class SymmetricKey(Key):
|
||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||
settings, describing how the key value has been wrapped.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing
|
||||
application_namespace and application_data. Optional, defaults
|
||||
to None.
|
||||
"""
|
||||
super(SymmetricKey, self).__init__(
|
||||
key_wrapping_data=key_wrapping_data
|
||||
@ -826,7 +828,8 @@ class PublicKey(Key):
|
||||
|
||||
def __init__(self, algorithm, length, value,
|
||||
format_type=enums.KeyFormatType.X_509, masks=None,
|
||||
name='Public Key', key_wrapping_data=None, app_specific_info=None):
|
||||
name='Public Key', key_wrapping_data=None,
|
||||
app_specific_info=None):
|
||||
"""
|
||||
Create a PublicKey.
|
||||
|
||||
@ -844,8 +847,9 @@ class PublicKey(Key):
|
||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||
settings, describing how the key value has been wrapped.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing
|
||||
application_namespace and application_data. Optional, defaults
|
||||
to None.
|
||||
"""
|
||||
super(PublicKey, self).__init__(
|
||||
key_wrapping_data=key_wrapping_data
|
||||
@ -996,7 +1000,8 @@ class PrivateKey(Key):
|
||||
}
|
||||
|
||||
def __init__(self, algorithm, length, value, format_type, masks=None,
|
||||
name='Private Key', key_wrapping_data=None, app_specific_info=None):
|
||||
name='Private Key', key_wrapping_data=None,
|
||||
app_specific_info=None):
|
||||
"""
|
||||
Create a PrivateKey.
|
||||
|
||||
@ -1013,8 +1018,9 @@ class PrivateKey(Key):
|
||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||
settings, describing how the key value has been wrapped.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing
|
||||
application_namespace and application_data. Optional, defaults
|
||||
to None.
|
||||
"""
|
||||
super(PrivateKey, self).__init__(
|
||||
key_wrapping_data=key_wrapping_data
|
||||
@ -1595,7 +1601,8 @@ class SecretData(CryptographicObject):
|
||||
'sqlite_autoincrement': True
|
||||
}
|
||||
|
||||
def __init__(self, value, data_type, masks=None, name='Secret Data', app_specific_info=None):
|
||||
def __init__(self, value, data_type, masks=None, name='Secret Data',
|
||||
app_specific_info=None):
|
||||
"""
|
||||
Create a SecretData object.
|
||||
|
||||
@ -1606,8 +1613,9 @@ class SecretData(CryptographicObject):
|
||||
masks(list): A list of CryptographicUsageMask enumerations
|
||||
defining how the key will be used.
|
||||
name(string): The string name of the key.
|
||||
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||
Optional, defaults to None.
|
||||
app_specific_info(list): A list of dictionaries containing
|
||||
application_namespace and application_data. Optional, defaults
|
||||
to None.
|
||||
"""
|
||||
super(SecretData, self).__init__()
|
||||
|
||||
|
@ -274,7 +274,7 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||
c = cmac.CMAC(cipher_algorithm(key), backend=default_backend())
|
||||
c.update(data)
|
||||
mac_data = c.finalize()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise exceptions.CryptographicFailure(
|
||||
"An error occurred while computing a CMAC. "
|
||||
"See the server log for more information."
|
||||
|
@ -439,7 +439,7 @@ class KmipEngine(object):
|
||||
).filter(
|
||||
objects.ManagedObject.unique_identifier == unique_identifier
|
||||
).one()[0]
|
||||
except exc.NoResultFound as e:
|
||||
except exc.NoResultFound:
|
||||
self._logger.warning(
|
||||
"Could not identify object type for object: {0}".format(
|
||||
unique_identifier
|
||||
|
@ -107,7 +107,7 @@ class KmipSession(threading.Thread):
|
||||
while True:
|
||||
try:
|
||||
self._handle_message_loop()
|
||||
except exceptions.ConnectionClosed as e:
|
||||
except exceptions.ConnectionClosed:
|
||||
break
|
||||
except Exception as e:
|
||||
self._logger.info("Failure handling message loop")
|
||||
|
@ -103,7 +103,8 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
||||
self.assertNotEqual(unwrapped_key.value, wrapped_key.value)
|
||||
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, key_id)
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, wrapping_id)
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE,
|
||||
wrapping_id)
|
||||
self.client.destroy(key_id)
|
||||
self.client.destroy(wrapping_id)
|
||||
|
||||
@ -187,8 +188,8 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
||||
|
||||
def test_register_app_specific_get(self):
|
||||
"""
|
||||
Test that a key with app specifc info can be registered with the server and that its
|
||||
metadata is retrieved with the get operation.
|
||||
Test that a key with app specifc info can be registered with the
|
||||
server and that its metadata is retrieved with the get operation.
|
||||
"""
|
||||
key = objects.SymmetricKey(
|
||||
enums.CryptographicAlgorithm.AES,
|
||||
@ -275,7 +276,8 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
||||
enums.CryptographicAlgorithm.RSA)
|
||||
self.assertEqual(private_key.cryptographic_length, 2048)
|
||||
finally:
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, public_uid)
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE,
|
||||
public_uid)
|
||||
self.client.destroy(public_uid)
|
||||
self.assertRaises(
|
||||
exceptions.KmipOperationFailure, self.client.get, public_uid)
|
||||
@ -283,7 +285,8 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
||||
exceptions.KmipOperationFailure, self.client.destroy,
|
||||
public_uid)
|
||||
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, private_uid)
|
||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE,
|
||||
private_uid)
|
||||
self.client.destroy(private_uid)
|
||||
self.assertRaises(
|
||||
exceptions.KmipOperationFailure, self.client.get, private_uid)
|
||||
|
@ -1166,8 +1166,7 @@ class TestRequestMessage(TestCase):
|
||||
type(attribute_name)))
|
||||
self.assertEqual('Object Type', attribute_name.value,
|
||||
self.msg.format('attribute name', 'value',
|
||||
'Object Type',
|
||||
attribute_name.value))
|
||||
'Object Type', attribute_name.value))
|
||||
|
||||
attribute_value = attribute_a.attribute_value
|
||||
exp_type = attr.Enumeration
|
||||
|
@ -174,7 +174,7 @@ class TestEnumUtilityFunctions(testtools.TestCase):
|
||||
args = ("invalid", )
|
||||
self.assertRaisesRegex(
|
||||
ValueError,
|
||||
"Unrecognized attribute name: 'invalid'".format(args[0]),
|
||||
"Unrecognized attribute name: 'invalid'",
|
||||
enums.convert_attribute_name_to_tag,
|
||||
*args
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user