Skip to content

Commit

Permalink
fix type comparisons
Browse files Browse the repository at this point in the history
linter complained about this over here #1381
  • Loading branch information
bernt-matthias committed Aug 4, 2023
1 parent 6eeffdb commit 75f862b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion planemo/autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def check_tool_step(step, ts): # return a dict with current and newest tool ver
return {}

outdated_tool_dict = {}
steps = wf_dict["steps"].values() if type(wf_dict["steps"]) == dict else wf_dict["steps"]
steps = wf_dict["steps"].values() if isinstance(wf_dict["steps"], dict) else wf_dict["steps"]
for step in steps:
if step.get("type", "tool") == "tool" and not step.get("run", {}).get("class") == "GalaxyWorkflow":
outdated_tool_dict.update(check_tool_step(step, ts))
Expand Down
2 changes: 1 addition & 1 deletion planemo/galaxy/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def rewrite_job_file(input_file, output_file, job):
with open(input_file) as f:
job_contents = yaml.safe_load(f)
for job_input, job_input_name in job_contents.items():
if type(job[job_input]) == dict: # dataset or collection
if isinstance(job[job_input], dict): # dataset or collection
job_contents[job_input] = {"class": job_input_name["class"], "galaxy_id": job[job_input]["id"]}
# else: presumably a parameter, no need to modify
with open(output_file, "w") as f:
Expand Down
6 changes: 3 additions & 3 deletions planemo/workflow_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ def _lint_best_practices(path: str, lint_context: WorkflowLintContext) -> None:
"""

def check_json_for_untyped_params(j):
values = j if type(j) == list else j.values()
values = j if isinstance(j, list) else j.values()
for value in values:
if type(value) in [list, dict, OrderedDict]:
if check_json_for_untyped_params(value):
return True
elif type(value) == str:
elif isinstance(value, str):
if re.match(r"\$\{.+?\}", value):
return True
return False
Expand Down Expand Up @@ -345,7 +345,7 @@ def _tst_input_valid(
input_def: Dict[str, Any],
lint_context: WorkflowLintContext,
) -> bool:
if type(input_def) == dict: # else assume it is a parameter
if isinstance(input_def, dict): # else assume it is a parameter
clazz = input_def.get("class")
if clazz == "File":
input_path = input_def.get("path")
Expand Down

0 comments on commit 75f862b

Please sign in to comment.