File tree Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Expand file tree Collapse file tree 5 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 2
2
import inspect
3
3
from typing import dataclass_transform
4
4
import attrs
5
- from pydra .utils .general import task_fields , task_dict
5
+ from pydra .utils .general import task_fields , task_as_dict
6
6
from pydra .compose import base
7
7
from pydra .compose .base import (
8
8
ensure_field_objects ,
@@ -236,7 +236,7 @@ class PythonTask(base.Task[PythonOutputsType]):
236
236
237
237
def _run (self , job : "Job[PythonTask]" , rerun : bool = True ) -> None :
238
238
# Prepare the inputs to the function
239
- inputs = task_dict (self )
239
+ inputs = task_as_dict (self )
240
240
del inputs ["function" ]
241
241
# Run the actual function
242
242
returned = self .function (** inputs )
Original file line number Diff line number Diff line change 3
3
from enum import Enum
4
4
import attrs
5
5
from pydra .engine import lazy
6
- from pydra .utils .general import attrs_values , task_dict
6
+ from pydra .utils .general import attrs_values , task_as_dict
7
7
from pydra .utils .typing import is_lazy
8
8
from pydra .engine .state import State , add_name_splitter , add_name_combiner
9
9
@@ -162,7 +162,7 @@ def combiner(self):
162
162
def _check_if_outputs_have_been_used (self , msg ):
163
163
used = []
164
164
if self ._lzout :
165
- for outpt_name , outpt_val in task_dict (self ._lzout ).items ():
165
+ for outpt_name , outpt_val in task_as_dict (self ._lzout ).items ():
166
166
if outpt_val ._type_checked :
167
167
used .append (outpt_name )
168
168
if used :
Original file line number Diff line number Diff line change 19
19
from pydra .engine .submitter import Submitter , NodeExecution
20
20
from pydra .utils .general import (
21
21
attrs_values ,
22
- task_dict ,
22
+ task_as_dict ,
23
23
task_fields ,
24
24
)
25
25
from pydra .utils .typing import is_lazy
@@ -147,7 +147,7 @@ def construct(
147
147
constructor = input_values .pop ("constructor" )
148
148
# Call the user defined constructor to set the outputs
149
149
output_lazy_fields = constructor (** input_values )
150
- if all (v is attrs .NOTHING for v in task_dict (outputs ).values ()):
150
+ if all (v is attrs .NOTHING for v in task_as_dict (outputs ).values ()):
151
151
if output_lazy_fields is None :
152
152
raise ValueError (
153
153
f"Constructor function for { task } returned None, must a lazy field "
@@ -160,7 +160,7 @@ def construct(
160
160
"if any of the outputs are already set explicitly"
161
161
)
162
162
if unset_outputs := [
163
- n for n , v in task_dict (outputs ).items () if v is attrs .NOTHING
163
+ n for n , v in task_as_dict (outputs ).items () if v is attrs .NOTHING
164
164
]:
165
165
raise ValueError (
166
166
f"Mandatory outputs { unset_outputs } are not set by the "
Original file line number Diff line number Diff line change 1
1
from .general import (
2
2
task_fields ,
3
+ task_as_dict ,
3
4
plot_workflow ,
4
5
show_workflow ,
5
6
task_help ,
12
13
__all__ = [
13
14
"__version__" ,
14
15
"task_fields" ,
16
+ "task_as_dict" ,
15
17
"plot_workflow" ,
16
18
"show_workflow" ,
17
19
"task_help" ,
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ def task_fields(task: "type[Task] | Task") -> _TaskFieldsList:
352
352
)
353
353
354
354
355
- def task_dict (obj , ** kwargs ) -> dict [str , ty .Any ]:
355
+ def task_as_dict (obj , ** kwargs ) -> dict [str , ty .Any ]:
356
356
"""Get the values of an attrs object."""
357
357
return {f .name : getattr (obj , f .name ) for f in task_fields (obj )}
358
358
You can’t perform that action at this time.
0 commit comments