Skip to content

Commit 62e9523

Browse files
committed
applied remaining suggestions from Chris' review
1 parent 81eded5 commit 62e9523

File tree

7 files changed

+15
-18
lines changed

7 files changed

+15
-18
lines changed

pydra/engine/core.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import logging
55
import itertools
6+
from functools import cached_property
67
import os
78
import sys
89
from pathlib import Path
@@ -229,12 +230,9 @@ def __setstate__(self, state):
229230
state["inputs"] = make_klass(state["input_spec"])(**state["inputs"])
230231
self.__dict__.update(state)
231232

232-
@property
233+
@cached_property
233234
def lzout(self):
234-
if self._lzout:
235-
return self._lzout
236-
self._lzout = LazyOut(self)
237-
return self._lzout
235+
return LazyOut(self)
238236

239237
def help(self, returnhelp=False):
240238
"""Print class help."""

pydra/engine/helpers_file.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def copy_nested_files(
5757
supported_modes: FileSet.CopyMode = FileSet.CopyMode.any,
5858
**kwargs,
5959
) -> ty.Any:
60-
"""Copies all "file-sets" found with the nested value into the destination
61-
directory. If no nested file-sets are found then the original value is returned. Note
62-
that multiple nested file-sets (e.g. a list) will to have unique names
60+
"""Copies all "file-sets" found within the nested value (e.g. dict, list,...) into the
61+
destination directory. If no nested file-sets are found then the original value is
62+
returned. Note that multiple nested file-sets (e.g. a list) will to have unique names
6363
names (i.e. not differentiated by parent directories) otherwise there will be a path
6464
clash in the destination directory.
6565

pydra/engine/tests/test_submitter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def test_sge_no_limit_maxthreads(tmpdir):
573573
assert job_1_endtime > job_2_starttime
574574

575575

576-
@pytest.mark.xfail(reason="Not sure")
576+
# @pytest.mark.xfail(reason="Not sure")
577577
def test_wf_with_blocked_tasks(tmpdir):
578578
wf = Workflow(name="wf_with_blocked_tasks", input_spec=["x"])
579579
wf.add(identity(name="taska", x=wf.lzin.x))
@@ -585,17 +585,17 @@ def test_wf_with_blocked_tasks(tmpdir):
585585

586586
wf.cache_dir = tmpdir
587587

588-
with pytest.raises(Exception, match="graph is not empty,"):
589-
with Submitter("serial") as sub:
590-
sub(wf)
588+
# with pytest.raises(Exception, match="graph is not empty,"):
589+
with Submitter("serial") as sub:
590+
sub(wf)
591591

592592

593593
class A:
594594
def __init__(self, a):
595595
self.a = a
596596

597-
def __hash__(self):
598-
return hash(self.a)
597+
def __bytes_repr__(self, cache):
598+
yield bytes(self.a)
599599

600600

601601
@mark.task

pydra/engine/tests/test_task.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
)
2323
from ...utils.hash import hash_function
2424

25-
# from ..helpers import hash_file
2625

2726
no_win = pytest.mark.skipif(
2827
sys.platform.startswith("win"),

pydra/engine/tests/test_tasks_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_wf_1(tmpdir):
9494
np.save(file_orig, arr)
9595
wf.inputs.file_orig = file_orig
9696

97-
with Submitter(plugin="serial") as sub:
97+
with Submitter(plugin="cf") as sub:
9898
sub(wf)
9999

100100
assert wf.output_dir.exists()

pydra/engine/tests/test_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_wf_dict_input_and_output_spec():
106106
wf.inputs.a = 1.0
107107
with pytest.raises(
108108
TypeError,
109-
match=("Could not coerce object, bad-value, to any of the union types "),
109+
match=("Could not coerce object, 'bad-value', to any of the union types "),
110110
):
111111
wf.inputs.b = {"foo": 1, "bar": "bad-value"}
112112

pydra/utils/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def coerce_union(obj, pattern_args):
213213
except TypeError as e:
214214
reasons.append(e)
215215
raise TypeError(
216-
f"Could not coerce object, {obj}, to any of the union types {pattern_args}:\n\n"
216+
f"Could not coerce object, {obj!r}, to any of the union types {pattern_args}:\n\n"
217217
+ "\n\n".join(f"{a} -> {e}" for a, e in zip(pattern_args, reasons))
218218
)
219219

0 commit comments

Comments
 (0)