Merge "Fix all H201 pep8 errors"
This commit is contained in:
mistralclient/commands/v2
tox.ini@ -116,7 +116,7 @@ class Create(show.ShowOne):
|
||||
if parsed_args.input:
|
||||
try:
|
||||
action_input = json.loads(parsed_args.input)
|
||||
except:
|
||||
except Exception:
|
||||
action_input = json.load(open(parsed_args.input))
|
||||
|
||||
action_ex = action_executions.ActionExecutionManager(
|
||||
@ -202,7 +202,7 @@ class Update(show.ShowOne):
|
||||
if parsed_args.output:
|
||||
try:
|
||||
output = json.loads(parsed_args.output)
|
||||
except:
|
||||
except Exception:
|
||||
output = json.load(open(parsed_args.output))
|
||||
|
||||
execution = action_executions.ActionExecutionManager(
|
||||
@ -237,7 +237,7 @@ class GetOutput(command.Command):
|
||||
try:
|
||||
output = json.loads(output)
|
||||
output = json.dumps(output, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Task result is not JSON.")
|
||||
|
||||
self.app.stdout.write(output or "\n")
|
||||
@ -265,7 +265,7 @@ class GetInput(command.Command):
|
||||
try:
|
||||
result = json.loads(result)
|
||||
result = json.dumps(result, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Task result is not JSON.")
|
||||
|
||||
self.app.stdout.write(result or "\n")
|
||||
|
@ -144,7 +144,7 @@ class Create(show.ShowOne):
|
||||
if string:
|
||||
try:
|
||||
return json.loads(string)
|
||||
except:
|
||||
except Exception:
|
||||
return json.load(open(string))
|
||||
else:
|
||||
return {}
|
||||
|
@ -95,7 +95,7 @@ def load_file_content(f):
|
||||
|
||||
try:
|
||||
data = yaml.safe_load(content)
|
||||
except:
|
||||
except Exception:
|
||||
data = json.loads(content)
|
||||
|
||||
return data
|
||||
|
@ -164,7 +164,7 @@ class Create(show.ShowOne):
|
||||
if parsed_args.workflow_input:
|
||||
try:
|
||||
wf_input = json.loads(parsed_args.workflow_input)
|
||||
except:
|
||||
except Exception:
|
||||
wf_input = json.load(open(parsed_args.workflow_input))
|
||||
else:
|
||||
wf_input = {}
|
||||
@ -172,7 +172,7 @@ class Create(show.ShowOne):
|
||||
if parsed_args.params:
|
||||
try:
|
||||
params = json.loads(parsed_args.params)
|
||||
except:
|
||||
except Exception:
|
||||
params = json.load(open(parsed_args.params))
|
||||
else:
|
||||
params = {}
|
||||
@ -264,7 +264,7 @@ class GetInput(command.Command):
|
||||
try:
|
||||
ex_input = json.loads(ex_input)
|
||||
ex_input = json.dumps(ex_input, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Execution input is not JSON.")
|
||||
|
||||
self.app.stdout.write(ex_input or "\n")
|
||||
@ -287,7 +287,7 @@ class GetOutput(command.Command):
|
||||
try:
|
||||
output = json.loads(output)
|
||||
output = json.dumps(output, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Execution output is not JSON.")
|
||||
|
||||
self.app.stdout.write(output or "\n")
|
||||
|
@ -115,7 +115,7 @@ class GetResult(command.Command):
|
||||
try:
|
||||
result = json.loads(result)
|
||||
result = json.dumps(result, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Task result is not JSON.")
|
||||
|
||||
self.app.stdout.write(result or "\n")
|
||||
@ -139,7 +139,7 @@ class GetPublished(command.Command):
|
||||
try:
|
||||
result = json.loads(result)
|
||||
result = json.dumps(result, indent=4) + "\n"
|
||||
except:
|
||||
except Exception:
|
||||
LOG.debug("Task result is not JSON.")
|
||||
|
||||
self.app.stdout.write(result or "\n")
|
||||
|
2
tox.ini
2
tox.ini
@ -43,8 +43,6 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
commands = bash tools/lintstack.sh
|
||||
|
||||
[flake8]
|
||||
#H201 no 'except:' at least use 'except Exception:'
|
||||
show-source = true
|
||||
ignore = H201
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
|
||||
|
Reference in New Issue
Block a user