Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Lint and deprecation fixes #70

Merged
merged 2 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gxformat2/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def register_output_source(output_source):

for step in steps_as_list(workflow_dict, mutate=False):
step_in = step.get("in", {})
for step_in_name, step_in_def in step_in.items():
for step_in_def in step_in.values():
register_output_source(step_in_def)

for step in steps_as_list(workflow_dict, add_ids=True, inputs_offset=len(workflow_dict["inputs"]), mutate=True):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

from gxformat2._yaml import ordered_load
from gxformat2.converter import ImportOptions
from gxformat2.export import from_galaxy_native
from gxformat2.yaml import ordered_load
from ._helpers import (
assert_valid_native,
copy_without_workflow_output_labels,
Expand Down Expand Up @@ -263,7 +263,7 @@ def test_export_native_no_labels():
# Ensure outputs don't get mapped to 'null' key and ensure
native_unicycler = ordered_load(open(os.path.join(TEST_PATH, "unicycler.ga")).read())
before_output_count = 0
for workflow_output in native_workflow_outputs(native_unicycler):
for _ in native_workflow_outputs(native_unicycler):
before_output_count += 1
before_step_count = len(native_unicycler["steps"])

Expand All @@ -273,7 +273,7 @@ def test_export_native_no_labels():
round_trip_unicycler = to_native(as_format2)

after_output_count = 0
for workflow_output in native_workflow_outputs(round_trip_unicycler):
for _ in native_workflow_outputs(round_trip_unicycler):
after_output_count += 1
after_step_count = len(round_trip_unicycler["steps"])

Expand Down
2 changes: 1 addition & 1 deletion tests/test_export_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
tool_resolver,
)

from gxformat2._yaml import ordered_dump, ordered_load
from gxformat2.abstract import CWL_VERSION, from_dict
from gxformat2.yaml import ordered_dump, ordered_load
from ._helpers import TEST_PATH, to_example_path
from .example_wfs import (
BASIC_WORKFLOW,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_lint.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import copy
import os

from gxformat2._yaml import ordered_dump, ordered_load
from gxformat2.lint import main
from gxformat2.yaml import ordered_dump, ordered_load
from ._helpers import (
assert_valid_native,
copy_without_workflow_output_labels,
Expand Down Expand Up @@ -93,7 +93,7 @@ def setup_module(module):
_dump_with_exit_code(green_native, 0, "basic_native")

green_explicit_errors_null = _deep_copy(green_native)
for step, step_def in green_explicit_errors_null["steps"].items():
for step_def in green_explicit_errors_null["steps"].values():
step_def["errors"] = None
_dump_with_exit_code(green_explicit_errors_null, 0, "basic_native_explicit_no_errors")

Expand Down
4 changes: 2 additions & 2 deletions tests/test_normalize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from gxformat2._yaml import ordered_load
from gxformat2.normalize import Inputs, inputs_normalized, NormalizedWorkflow, outputs_normalized
from gxformat2.yaml import ordered_load
from ._helpers import (
to_native,
)
Expand Down Expand Up @@ -55,7 +55,7 @@ def test_normalized_workflow():
# same workflow with slightly different input definitions, make sure normalize
# unifies these
for wf in [INTEGER_INPUT, INT_INPUT]:
int_input_normalized = NormalizedWorkflow(ordered_load(INT_INPUT)).normalized_workflow_dict
int_input_normalized = NormalizedWorkflow(ordered_load(wf)).normalized_workflow_dict
inputs = int_input_normalized["inputs"]
assert isinstance(inputs, list)
assert isinstance(inputs[0], dict) # str converted to dictionary
Expand Down
2 changes: 1 addition & 1 deletion tests/test_to_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import os

from gxformat2._scripts import ensure_format2_from_path
from gxformat2._yaml import ordered_dump
from gxformat2.converter import main
from gxformat2.lint import lint_ga_path
from gxformat2.linting import LintContext
from gxformat2.yaml import ordered_dump
from ._helpers import TEST_PATH, to_example_path
from .example_wfs import (
BASIC_WORKFLOW,
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ commands =
mypy: mypy gxformat2 {posargs}
deps =
lint: flake8-import-order
lint: flake8-bugbear
lint,lintdocstrings: flake8
lintdocstrings: flake8_docstrings
mypy: mypy
Expand Down