File tree Expand file tree Collapse file tree 4 files changed +6
-13
lines changed Expand file tree Collapse file tree 4 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 162162 "metadata" : {},
163163 "outputs" : [],
164164 "source" : [
165- " from pydra.utils import fields_dict \n " ,
165+ " from pydra.utils import task_fields \n " ,
166166 " \n " ,
167167 " Cp = shell.define(\n " ,
168168 " \" cp <in_fs_objects:fs-object+> <out|out_dir:directory> \"\n " ,
172172 " \" --tuple-arg <tuple_arg:int,str=(1,'bar')> \"\n " ,
173173 " )\n " ,
174174 " \n " ,
175- " print(f\" '--int-arg' default: {fields_dict (Cp)[' int_arg'] .default}\" )"
175+ " print(f\" '--int-arg' default: {task_fields (Cp). int_arg.default}\" )"
176176 ]
177177 },
178178 {
Original file line number Diff line number Diff line change 1919from pydra .engine .submitter import Submitter , NodeExecution
2020from pydra .utils .general import (
2121 attrs_values ,
22- fields_values ,
22+ task_dict ,
2323 task_fields ,
2424)
2525from pydra .utils .typing import is_lazy
@@ -147,7 +147,7 @@ def construct(
147147 constructor = input_values .pop ("constructor" )
148148 # Call the user defined constructor to set the outputs
149149 output_lazy_fields = constructor (** input_values )
150- if all (v is attrs .NOTHING for v in fields_values (outputs ).values ()):
150+ if all (v is attrs .NOTHING for v in task_dict (outputs ).values ()):
151151 if output_lazy_fields is None :
152152 raise ValueError (
153153 f"Constructor function for { task } returned None, must a lazy field "
@@ -160,7 +160,7 @@ def construct(
160160 "if any of the outputs are already set explicitly"
161161 )
162162 if unset_outputs := [
163- n for n , v in fields_values (outputs ).items () if v is attrs .NOTHING
163+ n for n , v in task_dict (outputs ).items () if v is attrs .NOTHING
164164 ]:
165165 raise ValueError (
166166 f"Mandatory outputs { unset_outputs } are not set by the "
Original file line number Diff line number Diff line change 11from .general import (
22 task_fields ,
3- fields_dict ,
43 plot_workflow ,
54 show_workflow ,
65 task_help ,
1514 "show_workflow" ,
1615 "task_help" ,
1716 "print_help" ,
18- "fields_dict" ,
1917]
Original file line number Diff line number Diff line change @@ -349,16 +349,11 @@ def task_fields(task: "type[Task] | Task") -> _TaskFieldsList:
349349 )
350350
351351
352- def fields_values (obj , ** kwargs ) -> dict [str , ty .Any ]:
352+ def task_dict (obj , ** kwargs ) -> dict [str , ty .Any ]:
353353 """Get the values of an attrs object."""
354354 return {f .name : getattr (obj , f .name ) for f in task_fields (obj )}
355355
356356
357- def fields_dict (task : "type[Task] | Task" ) -> dict [str , "Field" ]:
358- """Returns the fields of a task in a dictionary"""
359- return {f .name : f for f in task_fields (task )}
360-
361-
362357def from_list_if_single (obj : ty .Any ) -> ty .Any :
363358 """Converts a list to a single item if it is of length == 1"""
364359 from pydra .utils .typing import is_lazy
You can’t perform that action at this time.
0 commit comments