Skip to content

Commit 562349a

Browse files
committed
STY: Auto-ruff fixes (+black)
1 parent 5193a06 commit 562349a

19 files changed

+78
-114
lines changed

pydra/engine/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def _run(self, rerun=False, **kwargs):
491491
lockfile = self.cache_dir / (checksum + ".lock")
492492
# Eagerly retrieve cached - see scenarios in __init__()
493493
self.hooks.pre_run(self)
494-
logger.debug(f"'%s' is attempting to acquire lock on %s", self.name, lockfile)
494+
logger.debug("'%s' is attempting to acquire lock on %s", self.name, lockfile)
495495
with SoftFileLock(lockfile):
496496
if not (rerun or self.task_rerun):
497497
result = self.result()
@@ -1105,7 +1105,7 @@ async def _run(self, submitter=None, rerun=False, **kwargs):
11051105
lockfile = self.cache_dir / (checksum + ".lock")
11061106
self.hooks.pre_run(self)
11071107
logger.debug(
1108-
f"'%s' is attempting to acquire lock on %s with Pydra lock",
1108+
"'%s' is attempting to acquire lock on %s with Pydra lock",
11091109
self.name,
11101110
lockfile,
11111111
)

pydra/engine/helpers_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def template_update(inputs, output_dir, state_ind=None, map_copyfiles=None):
606606
for fld in fields_templ:
607607
if fld.type not in [str, ty.Union[str, bool]]:
608608
raise Exception(
609-
f"fields with output_file_template"
609+
"fields with output_file_template"
610610
" has to be a string or Union[str, bool]"
611611
)
612612
dict_mod[fld.name] = template_update_single(
@@ -638,7 +638,7 @@ def template_update_single(
638638
if spec_type == "input":
639639
if field.type not in [str, ty.Union[str, bool]]:
640640
raise Exception(
641-
f"fields with output_file_template"
641+
"fields with output_file_template"
642642
"has to be a string or Union[str, bool]"
643643
)
644644
inp_val_set = inputs_dict_st[field.name]

pydra/engine/tests/data_tests/loading.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import os
2-
3-
41
def loading(filename):
52
with open(filename) as f:
63
txt = f.read()

pydra/engine/tests/data_tests/saving.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import os
2-
3-
41
def saving(filename):
52
with open(filename, "w") as f:
63
f.write("Hello!")

pydra/engine/tests/test_boutiques.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import os, shutil
1+
import shutil
22
import subprocess as sp
3-
from pathlib import Path
43
import attr
54
import pytest
65

@@ -9,7 +8,6 @@
98
from ..submitter import Submitter
109
from ..boutiques import BoshTask
1110
from .utils import result_no_submitter, result_submitter, no_win
12-
from ...engine.specs import File
1311

1412
need_bosh_docker = pytest.mark.skipif(
1513
shutil.which("docker") is None

pydra/engine/tests/test_dockertask.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import pytest
32
import attr
43

@@ -71,9 +70,7 @@ def test_docker_1_dockerflag_exception(plugin):
7170
"""using ShellComandTask with container_info=("docker"), no image provided"""
7271
cmd = "whoami"
7372
with pytest.raises(Exception) as excinfo:
74-
shocky = ShellCommandTask(
75-
name="shocky", executable=cmd, container_info=("docker")
76-
)
73+
ShellCommandTask(name="shocky", executable=cmd, container_info=("docker"))
7774
assert "container_info has to have 2 elements" in str(excinfo.value)
7875

7976

@@ -1080,7 +1077,7 @@ def test_docker_inputspec_3a(plugin, tmpdir):
10801077
)
10811078

10821079
with pytest.raises(Exception) as excinfo:
1083-
res = docky()
1080+
docky()
10841081
assert "use field.metadata['container_path']=True" in str(excinfo.value)
10851082

10861083

pydra/engine/tests/test_graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ def test_edges_3():
6565

6666
def test_edges_ecxeption_1():
6767
with pytest.raises(Exception) as excinfo:
68-
graph = DiGraph(nodes=[A, B, A], edges=[(A, B)])
68+
DiGraph(nodes=[A, B, A], edges=[(A, B)])
6969
assert "repeated elements" in str(excinfo.value)
7070

7171

7272
def test_edges_ecxeption_2():
7373
with pytest.raises(Exception) as excinfo:
74-
graph = DiGraph(nodes=[A, B], edges=[(A, C)])
74+
DiGraph(nodes=[A, B], edges=[(A, C)])
7575
assert "can't be added" in str(excinfo.value)
7676

7777

pydra/engine/tests/test_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,9 @@ def test_load_and_run(tmpdir):
228228
def test_load_and_run_exception_load(tmpdir):
229229
"""testing raising exception and saving info in crashfile when when load_and_run"""
230230
task_pkl = Path(tmpdir.join("task_main.pkl"))
231-
task = raise_xeq1(name="raise", x=[1, 2]).split("x")
232-
with pytest.raises(FileNotFoundError) as excinfo:
233-
task_0 = load_and_run(task_pkl=task_pkl, ind=0)
231+
raise_xeq1(name="raise", x=[1, 2]).split("x")
232+
with pytest.raises(FileNotFoundError):
233+
load_and_run(task_pkl=task_pkl, ind=0)
234234

235235

236236
def test_load_and_run_exception_run(tmpdir):
@@ -245,7 +245,7 @@ def test_load_and_run_exception_run(tmpdir):
245245
cp.dump(task, fp)
246246

247247
with pytest.raises(Exception) as excinfo:
248-
task_0 = load_and_run(task_pkl=task_pkl, ind=0)
248+
load_and_run(task_pkl=task_pkl, ind=0)
249249
assert "i'm raising an exception!" in str(excinfo.value)
250250
# checking if the crashfile has been created
251251
assert "crash" in str(excinfo.value)

pydra/engine/tests/test_nipype1_convert.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import attr
21
import typing as ty
3-
import os, sys
42
import pytest
5-
from pathlib import Path
63

74

85
from ..task import ShellCommandTask
9-
from ..submitter import Submitter
10-
from ..core import Workflow
116
from ..specs import ShellOutSpec, ShellSpec, SpecInfo, File
12-
from .utils import result_no_submitter, result_submitter, use_validator
137

148
interf_input_spec = SpecInfo(
159
name="Input", fields=[("test", ty.Any, {"help_string": "test"})], bases=(ShellSpec,)

pydra/engine/tests/test_node_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def test_task_nostate_cachedir(plugin_dask_opt, tmpdir):
575575
@pytest.mark.flaky(reruns=2) # when dask
576576
def test_task_nostate_cachedir_relativepath(tmpdir, plugin_dask_opt):
577577
"""task with provided cache_dir as relative path"""
578-
cwd = tmpdir.chdir()
578+
tmpdir.chdir()
579579
cache_dir = "test_task_nostate"
580580
tmpdir.mkdir(cache_dir)
581581

@@ -1266,7 +1266,7 @@ def test_task_state_comb_singl_1(plugin, tmpdir):
12661266
assert nn.state.splitter == "NA.a"
12671267
assert nn.state.splitter_rpn == ["NA.a"]
12681268
assert nn.state.combiner == ["NA.a"]
1269-
assert nn.state.splitter_final == None
1269+
assert nn.state.splitter_final is None
12701270
assert nn.state.splitter_rpn_final == []
12711271

12721272
with Submitter(plugin=plugin) as sub:

0 commit comments

Comments
 (0)