mirror of https://github.com/OpenKMIP/PyKMIP.git
Fixing violations of E722 for flake8 checks
This change fixes violations of E722, the use of except without specifying an exception type. For now the high-level Exception class is used as a generic catchall. In the future these cases will be updated to handle the specific exceptions expected.
This commit is contained in:
parent
626798b327
commit
e77dcadf41
|
@ -83,7 +83,7 @@ class ConfigHelper(object):
|
||||||
self.logger.debug(CONF_MSG.format(return_value,
|
self.logger.debug(CONF_MSG.format(return_value,
|
||||||
CONFIG_FILE,
|
CONFIG_FILE,
|
||||||
config_option_name))
|
config_option_name))
|
||||||
except:
|
except Exception:
|
||||||
return_value = default_value
|
return_value = default_value
|
||||||
self.logger.debug(DEFAULT_MSG.format(default_value,
|
self.logger.debug(DEFAULT_MSG.format(default_value,
|
||||||
config_option_name))
|
config_option_name))
|
||||||
|
|
|
@ -678,7 +678,7 @@ class Boolean(Base):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
value = unpack('!Q', istream.read(self.LENGTH))[0]
|
value = unpack('!Q', istream.read(self.LENGTH))[0]
|
||||||
except:
|
except Exception:
|
||||||
self.logger.error("Error reading boolean value from buffer")
|
self.logger.error("Error reading boolean value from buffer")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -713,7 +713,7 @@ class Boolean(Base):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
ostream.write(pack('!Q', self.value))
|
ostream.write(pack('!Q', self.value))
|
||||||
except:
|
except Exception:
|
||||||
self.logger.error("Error writing boolean value to buffer")
|
self.logger.error("Error writing boolean value to buffer")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -357,11 +357,11 @@ class KMIPProxy(KMIP):
|
||||||
result['result_status'] = batch_item.result_status.value
|
result['result_status'] = batch_item.result_status.value
|
||||||
try:
|
try:
|
||||||
result['result_reason'] = batch_item.result_reason.value
|
result['result_reason'] = batch_item.result_reason.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_reason'] = batch_item.result_reason
|
result['result_reason'] = batch_item.result_reason
|
||||||
try:
|
try:
|
||||||
result['result_message'] = batch_item.result_message.value
|
result['result_message'] = batch_item.result_message.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_message'] = batch_item.result_message
|
result['result_message'] = batch_item.result_message
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -571,11 +571,11 @@ class KMIPProxy(KMIP):
|
||||||
result['result_status'] = batch_item.result_status.value
|
result['result_status'] = batch_item.result_status.value
|
||||||
try:
|
try:
|
||||||
result['result_reason'] = batch_item.result_reason.value
|
result['result_reason'] = batch_item.result_reason.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_reason'] = batch_item.result_reason
|
result['result_reason'] = batch_item.result_reason
|
||||||
try:
|
try:
|
||||||
result['result_message'] = batch_item.result_message.value
|
result['result_message'] = batch_item.result_message.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_message'] = batch_item.result_message
|
result['result_message'] = batch_item.result_message
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -646,11 +646,11 @@ class KMIPProxy(KMIP):
|
||||||
result['result_status'] = batch_item.result_status.value
|
result['result_status'] = batch_item.result_status.value
|
||||||
try:
|
try:
|
||||||
result['result_reason'] = batch_item.result_reason.value
|
result['result_reason'] = batch_item.result_reason.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_reason'] = batch_item.result_reason
|
result['result_reason'] = batch_item.result_reason
|
||||||
try:
|
try:
|
||||||
result['result_message'] = batch_item.result_message.value
|
result['result_message'] = batch_item.result_message.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_message'] = batch_item.result_message
|
result['result_message'] = batch_item.result_message
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -721,11 +721,11 @@ class KMIPProxy(KMIP):
|
||||||
result['result_status'] = batch_item.result_status.value
|
result['result_status'] = batch_item.result_status.value
|
||||||
try:
|
try:
|
||||||
result['result_reason'] = batch_item.result_reason.value
|
result['result_reason'] = batch_item.result_reason.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_reason'] = batch_item.result_reason
|
result['result_reason'] = batch_item.result_reason
|
||||||
try:
|
try:
|
||||||
result['result_message'] = batch_item.result_message.value
|
result['result_message'] = batch_item.result_message.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_message'] = batch_item.result_message
|
result['result_message'] = batch_item.result_message
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
@ -787,11 +787,11 @@ class KMIPProxy(KMIP):
|
||||||
result['result_status'] = batch_item.result_status.value
|
result['result_status'] = batch_item.result_status.value
|
||||||
try:
|
try:
|
||||||
result['result_reason'] = batch_item.result_reason.value
|
result['result_reason'] = batch_item.result_reason.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_reason'] = batch_item.result_reason
|
result['result_reason'] = batch_item.result_reason
|
||||||
try:
|
try:
|
||||||
result['result_message'] = batch_item.result_message.value
|
result['result_message'] = batch_item.result_message.value
|
||||||
except:
|
except Exception:
|
||||||
result['result_message'] = batch_item.result_message
|
result['result_message'] = batch_item.result_message
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -1208,7 +1208,7 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||||
backend=default_backend()
|
backend=default_backend()
|
||||||
)
|
)
|
||||||
return private_key
|
return private_key
|
||||||
except:
|
except Exception:
|
||||||
private_key = serialization.load_der_private_key(
|
private_key = serialization.load_der_private_key(
|
||||||
bytes,
|
bytes,
|
||||||
password=None,
|
password=None,
|
||||||
|
@ -1271,7 +1271,7 @@ class CryptographyEngine(api.CryptographicEngine):
|
||||||
if crypto_alg == enums.CryptographicAlgorithm.RSA:
|
if crypto_alg == enums.CryptographicAlgorithm.RSA:
|
||||||
try:
|
try:
|
||||||
key = self._create_RSA_private_key(signing_key)
|
key = self._create_RSA_private_key(signing_key)
|
||||||
except:
|
except Exception:
|
||||||
raise exceptions.InvalidField('Unable to deserialize key '
|
raise exceptions.InvalidField('Unable to deserialize key '
|
||||||
'bytes, unknown format.')
|
'bytes, unknown format.')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -2664,7 +2664,7 @@ def load_private_key(key):
|
||||||
password=None,
|
password=None,
|
||||||
backend=default_backend()
|
backend=default_backend()
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
return serialization.load_pem_private_key(
|
return serialization.load_pem_private_key(
|
||||||
key,
|
key,
|
||||||
password=None,
|
password=None,
|
||||||
|
|
|
@ -17,7 +17,7 @@ import logging
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import unittest.mock as mock
|
import unittest.mock as mock
|
||||||
except:
|
except Exception:
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
import signal
|
import signal
|
||||||
|
|
Loading…
Reference in New Issue