55from typing import Self
66import attrs .validators
77from pydra .utils .typing import is_optional , is_fileset_or_union
8- from pydra .utils .general import task_fields
8+ from pydra .utils .general import get_fields
99from pydra .utils .typing import StateArray , is_lazy
1010from pydra .utils .hash import hash_function
1111import os
@@ -67,7 +67,7 @@ def _from_job(cls, job: "Job[TaskType]") -> Self:
6767 The outputs of the job
6868 """
6969 defaults = {}
70- for output in task_fields (cls ):
70+ for output in get_fields (cls ):
7171 if output .mandatory :
7272 default = attrs .NOTHING
7373 elif isinstance (output .default , attrs .Factory ):
@@ -116,18 +116,18 @@ def __getitem__(self, name_or_index: str | int) -> ty.Any:
116116 def __eq__ (self , other : ty .Any ) -> bool :
117117 """Check if two tasks are equal"""
118118 values = attrs .asdict (self )
119- fields = task_fields (self )
119+ fields = get_fields (self )
120120 try :
121121 other_values = attrs .asdict (other )
122122 except AttributeError :
123123 return False
124124 try :
125- other_fields = task_fields (other )
125+ other_fields = get_fields (other )
126126 except AttributeError :
127127 return False
128128 if fields != other_fields :
129129 return False
130- for field in task_fields (self ):
130+ for field in get_fields (self ):
131131 if field .hash_eq :
132132 values [field .name ] = hash_function (values [field .name ])
133133 other_values [field .name ] = hash_function (other_values [field .name ])
@@ -137,7 +137,7 @@ def __repr__(self) -> str:
137137 """A string representation of the task"""
138138 fields_str = ", " .join (
139139 f"{ f .name } ={ getattr (self , f .name )!r} "
140- for f in task_fields (self )
140+ for f in get_fields (self )
141141 if getattr (self , f .name ) != f .default
142142 )
143143 return f"{ self .__class__ .__name__ } ({ fields_str } )"
@@ -407,7 +407,7 @@ def __repr__(self) -> str:
407407 """A string representation of the task"""
408408 fields_str = ", " .join (
409409 f"{ f .name } ={ getattr (self , f .name )!r} "
410- for f in task_fields (self )
410+ for f in get_fields (self )
411411 if getattr (self , f .name ) != f .default
412412 )
413413 return f"{ self .__class__ .__name__ } ({ fields_str } )"
@@ -416,7 +416,7 @@ def __iter__(self) -> ty.Generator[str, None, None]:
416416 """Iterate through all the names in the task"""
417417 return (
418418 f .name
419- for f in task_fields (self )
419+ for f in get_fields (self )
420420 if not (f .name .startswith ("_" ) or f .name in self .RESERVED_FIELD_NAMES )
421421 )
422422
@@ -431,7 +431,7 @@ def __eq__(self, other: ty.Any) -> bool:
431431 return False
432432 if set (values ) != set (other_values ):
433433 return False # Return if attribute keys don't match
434- for field in task_fields (self ):
434+ for field in get_fields (self ):
435435 if field .hash_eq :
436436 values [field .name ] = hash_function (values [field .name ])
437437 other_values [field .name ] = hash_function (other_values [field .name ])
@@ -486,7 +486,7 @@ def _hash_changes(self):
486486 def _compute_hashes (self ) -> ty .Tuple [bytes , ty .Dict [str , bytes ]]:
487487 """Compute a basic hash for any given set of fields."""
488488 inp_dict = {}
489- for field in task_fields (self ):
489+ for field in get_fields (self ):
490490 if isinstance (field , Out ):
491491 continue # Skip output fields
492492 # removing values that are not set from hash calculation
@@ -508,7 +508,7 @@ def _rule_violations(self) -> list[str]:
508508
509509 field : Arg
510510 errors = []
511- for field in task_fields (self ):
511+ for field in get_fields (self ):
512512 value = self [field .name ]
513513
514514 if is_lazy (value ):
@@ -625,7 +625,7 @@ def _check_resolved(self):
625625@register_serializer
626626def bytes_repr_task (obj : Task , cache : Cache ) -> ty .Iterator [bytes ]:
627627 yield f"task[{ obj ._task_type ()} ]:(" .encode ()
628- for field in task_fields (obj ):
628+ for field in get_fields (obj ):
629629 yield f"{ field .name } =" .encode ()
630630 yield hash_single (getattr (obj , field .name ), cache )
631631 yield b","
0 commit comments