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