Skip to content

Commit e89299f

Browse files
committed
tidied up workflows linting
1 parent c8cc5e7 commit e89299f

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

nipype2pydra/workflow.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
import typing as ty
23
import json
34
import tempfile
45
from pathlib import Path
@@ -16,12 +17,21 @@ def __init__(self, spec):
1617

1718
self.wf = load_class_or_func(self.spec["function"])(
1819
**self._parse_workflow_args(self.spec["args"])
19-
) # loads the 'function' in smriprep.yaml, and implement the args (creates a dictionary)
20+
)
21+
# loads the 'function' in smriprep.yaml, and implement the args (creates a
22+
# dictionary)
2023

21-
def node_connections(self, workflow, functions: dict[str, dict], wf_inputs: dict[str, str], wf_outputs: dict[str, str]):
22-
connections = defaultdict(dict)
24+
def node_connections(
25+
self,
26+
workflow,
27+
functions: dict[str, dict],
28+
wf_inputs: dict[str, str],
29+
wf_outputs: dict[str, str],
30+
):
31+
connections: defaultdict = defaultdict(dict)
2332

24-
# iterates over wf graph, Get connections from workflow graph, store connections in a dictionary
33+
# iterates over wf graph, Get connections from workflow graph, store connections
34+
# in a dictionary
2535
for edge, props in workflow._graph.edges.items():
2636
src_node = edge[0].name
2737
dest_node = edge[1].name
@@ -88,9 +98,11 @@ def _parse_workflow_args(cls, args):
8898
dct[name] = val
8999
return dct
90100

91-
def save_graph(self, out_path: Path, format: str = "svg", work_dir: Path = None):
101+
def save_graph(
102+
self, out_path: Path, format: str = "svg", work_dir: ty.Optional[Path] = None
103+
):
92104
if work_dir is None:
93-
work_dir = tempfile.mkdtemp()
105+
work_dir = Path(tempfile.mkdtemp())
94106
work_dir = Path(work_dir)
95107
graph_dot_path = work_dir / "wf-graph.dot"
96108
self.wf.write_hierarchical_dotfile(graph_dot_path)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ exclude = [
9696
]
9797

9898
[tool.black]
99+
line-length = 88
99100
target-version = ['py37']
100101
exclude = "nipype2pydra/_version.py"
101102

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = -s
2+
addopts = -s

0 commit comments

Comments
 (0)