Skip to content

Commit 7272623

Browse files
committed
STY: Automatic linting by pre-commit
1 parent 2e50f46 commit 7272623

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

nipype/pipeline/plugins/tests/test_callback.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ def test_callback_gantt(tmpdir, plugin):
7272
from nipype.utils.profiler import log_nodes_cb
7373
from nipype.utils.draw_gantt_chart import generate_gantt_chart
7474

75-
log_filename = 'callback.log'
76-
logger = logging.getLogger('callback')
75+
log_filename = "callback.log"
76+
logger = logging.getLogger("callback")
7777
logger.setLevel(logging.DEBUG)
7878
handler = logging.FileHandler(log_filename)
7979
logger.addHandler(handler)
8080

81-
#create workflow
81+
# create workflow
8282
wf = pe.Workflow(name="test", base_dir=tmpdir.strpath)
8383
f_node = pe.Node(
8484
niu.Function(function=func, input_names=[], output_names=[]), name="f_node"
@@ -88,8 +88,8 @@ def test_callback_gantt(tmpdir, plugin):
8888

8989
plugin_args = {"status_callback": log_nodes_cb}
9090
if plugin != "Linear":
91-
plugin_args['n_procs'] = 8
91+
plugin_args["n_procs"] = 8
9292
wf.run(plugin=plugin, plugin_args=plugin_args)
9393

94-
generate_gantt_chart('callback.log', 1 if plugin == "Linear" else 8)
95-
assert path.exists('callback.log.html')
94+
generate_gantt_chart("callback.log", 1 if plugin == "Linear" else 8)
95+
assert path.exists("callback.log.html")

nipype/utils/draw_gantt_chart.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -531,17 +531,20 @@ def generate_gantt_chart(
531531

532532
# Only include nodes with timing information, and covert timestamps
533533
# from strings to datetimes
534-
nodes_list = [{
535-
k: datetime.datetime.strptime(
536-
i[k], "%Y-%m-%dT%H:%M:%S.%f"
537-
) if k in {"start", "finish"} else i[k] for k in i
538-
} for i in nodes_list if "start" in i and "finish" in i]
534+
nodes_list = [
535+
{
536+
k: datetime.datetime.strptime(i[k], "%Y-%m-%dT%H:%M:%S.%f")
537+
if k in {"start", "finish"}
538+
else i[k]
539+
for k in i
540+
}
541+
for i in nodes_list
542+
if "start" in i and "finish" in i
543+
]
539544

540545
for node in nodes_list:
541546
if "duration" not in node:
542-
node["duration"] = (
543-
node["finish"] - node["start"]
544-
).total_seconds()
547+
node["duration"] = (node["finish"] - node["start"]).total_seconds()
545548

546549
# Create the header of the report with useful information
547550
start_node = nodes_list[0]

0 commit comments

Comments
 (0)