Fix Flake8 3.6.0 errors
Flake8 3.6.0 now warns about both line break after and *before* binary operator, you have to choose whether you use W503 or W504. Disable the newer W504. Fix "F841 local variable 'e' is assigned to but never used". Handle warnings about invalid escape sequence in regex. Handle invalid escape sequence in string. Change-Id: I68efbde4e9dd2e6e9455d91313eb45c9c79d35ce
This commit is contained in:
parent
b170daeea7
commit
cb737354f0
@ -52,11 +52,11 @@ def _enforce_policy(action, target, credentials, do_raise=True):
|
||||
try:
|
||||
_ENFORCER.authorize(action, target, credentials.to_policy_view(),
|
||||
**extras)
|
||||
except policy.PolicyNotRegistered as e:
|
||||
except policy.PolicyNotRegistered:
|
||||
LOG.exception('Policy not registered for %(action)s',
|
||||
{'action': action})
|
||||
raise exc.ActionForbidden()
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
with excutils.save_and_reraise_exception():
|
||||
LOG.debug(
|
||||
'Policy check for %(action)s failed with credentials '
|
||||
|
@ -120,7 +120,7 @@ class ReferenceResolver(object):
|
||||
reference
|
||||
"""
|
||||
ks_sess = ks_utils.get_keystone_session()
|
||||
(new_scheme, foo) = re.subn('^[^+]+\+', '', design_uri.scheme)
|
||||
(new_scheme, foo) = re.subn('^[^+]+\+', '', design_uri.scheme) # noqa
|
||||
url = urllib.parse.urlunparse(
|
||||
(new_scheme, design_uri.netloc, design_uri.path, design_uri.params,
|
||||
design_uri.query, design_uri.fragment))
|
||||
|
@ -115,7 +115,7 @@ class ChartWait():
|
||||
return DaemonSetWait(resource_type, self, labels, **kwargs)
|
||||
elif resource_type == 'statefulset':
|
||||
return StatefulSetWait(resource_type, self, labels, **kwargs)
|
||||
except TypeError as e:
|
||||
except TypeError:
|
||||
raise manifest_exceptions.ManifestException(
|
||||
'invalid config for item in `wait.resources`: {}'.format(
|
||||
resource_config))
|
||||
|
@ -461,7 +461,8 @@ class ChartBuilderNegativeTestCase(BaseChartBuilderTestCase):
|
||||
chartbuilder = ChartBuilder(test_chart)
|
||||
|
||||
# Confirm it failed for both encodings.
|
||||
error_re = (r'.*A str exception occurred while trying to read file:'
|
||||
error_re = (
|
||||
r'.*A str exception occurred while trying to read file:' # noqa
|
||||
'.*Details:\n.*\(encoding=utf-8\).*\n\(encoding=latin1\)')
|
||||
with mock.patch("builtins.open", mock.mock_open(read_data="")) \
|
||||
as mock_file:
|
||||
|
@ -322,7 +322,8 @@ class OverrideNegativeTestCase(testtools.TestCase):
|
||||
with open(self.base_manifest) as f:
|
||||
original_documents = list(yaml.safe_load_all(f.read()))
|
||||
|
||||
override = ('manifest:simple-armada:release_prefix=' '\overridden', )
|
||||
# Provide invalid JSON to compel the error to get thrown.
|
||||
override = ('manifest:simple-armada:release_prefix=\\overridden', )
|
||||
ovr = Override(original_documents, override)
|
||||
self.assertRaises(json.decoder.JSONDecodeError, ovr.update_manifests)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user