Addressed more pylint issues

Change-Id: I888d8b4725e07753e608739ee09bde582184c473
This commit is contained in:
Sorin Sbarnea 2021-03-15 15:03:36 +00:00
parent 5dd2b4d4e8
commit 08902597bc
4 changed files with 25 additions and 33 deletions

View File

@ -12,7 +12,7 @@ repos:
- id: check-yaml - id: check-yaml
files: .*\.(yaml|yml)$ files: .*\.(yaml|yml)$
- repo: https://gitlab.com/pycqa/flake8.git - repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.4 rev: 3.9.0
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/openstack-dev/bashate.git - repo: https://github.com/openstack-dev/bashate.git
@ -28,6 +28,6 @@ repos:
# use jinja templating, this will often fail and the syntax # use jinja templating, this will often fail and the syntax
# error will be discovered in execution anyway) # error will be discovered in execution anyway)
- repo: https://github.com/PyCQA/pylint - repo: https://github.com/PyCQA/pylint
rev: pylint-2.6.0 rev: pylint-2.7.2
hooks: hooks:
- id: pylint - id: pylint

View File

@ -17,7 +17,6 @@ disable =
import-error, import-error,
inconsistent-return-statements, inconsistent-return-statements,
invalid-name, invalid-name,
lost-exception,
missing-class-docstring, missing-class-docstring,
missing-function-docstring, missing-function-docstring,
missing-module-docstring, missing-module-docstring,
@ -28,7 +27,6 @@ disable =
redefined-argument-from-local, redefined-argument-from-local,
redefined-builtin, redefined-builtin,
redefined-outer-name, redefined-outer-name,
simplifiable-if-statement,
super-init-not-called, super-init-not-called,
super-with-arguments, super-with-arguments,
superfluous-parens, superfluous-parens,
@ -42,14 +40,12 @@ disable =
too-many-nested-blocks, too-many-nested-blocks,
too-many-public-methods, too-many-public-methods,
too-many-statements, too-many-statements,
try-except-raise,
unidiomatic-typecheck, unidiomatic-typecheck,
unnecessary-comprehension, unnecessary-comprehension,
unnecessary-pass, unnecessary-pass,
unsubscriptable-object, unsubscriptable-object,
unused-argument, unused-argument,
unused-variable, unused-variable,
useless-else-on-loop,
useless-object-inheritance, useless-object-inheritance,
useless-super-delegation, useless-super-delegation,
wrong-import-order, wrong-import-order,

View File

@ -354,31 +354,31 @@ class BuildahBuilder(base.BaseBuilder):
exception=job._exception exception=job._exception
) )
) )
else:
if exceptions: if exceptions:
raise RuntimeError( raise RuntimeError(
'\nThe following errors were detected during ' '\nThe following errors were detected during '
'container build(s):\n{exceptions}'.format( 'container build(s):\n{exceptions}'.format(
exceptions='\n'.join(exceptions) exceptions='\n'.join(exceptions)
)
) )
)
if not_done: if not_done:
error_msg = ( error_msg = (
'The following jobs were incomplete: {}'.format( 'The following jobs were incomplete: {}'.format(
[future_to_build[job] for job in not_done] [future_to_build[job] for job in not_done]
)
) )
)
jobs_with_exceptions = [{ jobs_with_exceptions = [{
'container': future_to_build[job], 'container': future_to_build[job],
'exception': job._exception} 'exception': job._exception}
for job in not_done if job._exception] for job in not_done if job._exception]
if jobs_with_exceptions: if jobs_with_exceptions:
for job_with_exception in jobs_with_exceptions: for job_with_exception in jobs_with_exceptions:
error_msg = error_msg + os.linesep + ( error_msg = error_msg + os.linesep + (
"%(container)s raised the following " "%(container)s raised the following "
"exception: %(exception)s" % "exception: %(exception)s" %
job_with_exception) job_with_exception)
raise SystemError(error_msg) raise SystemError(error_msg)

View File

@ -1980,8 +1980,6 @@ class PythonImageUploader(BaseImageUploader):
LOG.error('[%s] Failed processing layer for the target ' LOG.error('[%s] Failed processing layer for the target '
'image %s' % (layer, target_url.geturl())) 'image %s' % (layer, target_url.geturl()))
raise raise
except Exception:
raise
else: else:
if layer_val and known_path: if layer_val and known_path:
image_ref = target_url.path.split(':')[0][1:] image_ref = target_url.path.split(':')[0][1:]
@ -2343,8 +2341,6 @@ class PythonImageUploader(BaseImageUploader):
LOG.error('[%s] Failed processing layer for the target ' LOG.error('[%s] Failed processing layer for the target '
'image %s' % (layer['digest'], target_url.geturl())) 'image %s' % (layer['digest'], target_url.geturl()))
raise raise
except Exception:
raise
else: else:
if layer_val and known_path: if layer_val and known_path:
image_ref = target_url.path.split(':')[0][1:] image_ref = target_url.path.split(':')[0][1:]