2727
2828
2929if ty .TYPE_CHECKING :
30- from pydra .engine .specs import TaskDef , TaskOutputs
30+ from pydra .engine .specs import Task , TaskOutputs
3131
3232
3333__all__ = [
3434 "Field" ,
3535 "Arg" ,
3636 "Out" ,
3737 "ensure_field_objects" ,
38- "make_task_def " ,
38+ "make_task " ,
3939]
4040
4141
@@ -89,7 +89,7 @@ class Requirement:
8989 default = None , converter = allowed_values_converter
9090 )
9191
92- def satisfied (self , inputs : "TaskDef " ) -> bool :
92+ def satisfied (self , inputs : "Task " ) -> bool :
9393 """Check if the requirement is satisfied by the inputs"""
9494 value = getattr (inputs , self .name )
9595 field = {f .name : f for f in list_fields (inputs )}[self .name ]
@@ -157,7 +157,7 @@ class RequirementSet:
157157 converter = requirements_converter ,
158158 )
159159
160- def satisfied (self , inputs : "TaskDef " ) -> bool :
160+ def satisfied (self , inputs : "Task " ) -> bool :
161161 """Check if all the requirements are satisfied by the inputs"""
162162 return all (req .satisfied (inputs ) for req in self .requirements )
163163
@@ -203,7 +203,7 @@ def requires_converter(
203203
204204@attrs .define (kw_only = True )
205205class Field :
206- """Base class for input and output fields to task definitions
206+ """Base class for input and output fields to tasks
207207
208208 Parameters
209209 ----------
@@ -245,7 +245,7 @@ class Field:
245245 validator : ty .Callable [..., bool ] | None = None
246246 hash_eq : bool = False
247247
248- def requirements_satisfied (self , inputs : "TaskDef " ) -> bool :
248+ def requirements_satisfied (self , inputs : "Task " ) -> bool :
249249 """Check if all the requirements are satisfied by the inputs"""
250250 return any (req .satisfied (inputs ) for req in self .requires )
251251
@@ -264,7 +264,7 @@ def _requires_validator(self, _, value):
264264
265265@attrs .define (kw_only = True )
266266class Arg (Field ):
267- """Base class for input fields of task definitions
267+ """Base class for input fields of tasks
268268
269269 Parameters
270270 ----------
@@ -303,7 +303,7 @@ class Arg(Field):
303303
304304@attrs .define (kw_only = True , slots = False )
305305class Out (Field ):
306- """Base class for output fields of task definitions
306+ """Base class for output fields of tasks
307307
308308 Parameters
309309 ----------
@@ -328,7 +328,7 @@ class Out(Field):
328328
329329
330330def extract_fields_from_class (
331- spec_type : type ["TaskDef " ],
331+ spec_type : type ["Task " ],
332332 outputs_type : type ["TaskOutputs" ],
333333 klass : type ,
334334 arg_type : type [Arg ],
@@ -436,8 +436,8 @@ def get_fields(klass, field_type, auto_attribs, helps) -> dict[str, Field]:
436436 return inputs , outputs
437437
438438
439- def make_task_def (
440- spec_type : type ["TaskDef " ],
439+ def make_task (
440+ spec_type : type ["Task " ],
441441 out_type : type ["TaskOutputs" ],
442442 inputs : dict [str , Arg ],
443443 outputs : dict [str , Out ],
@@ -447,7 +447,7 @@ def make_task_def(
447447 outputs_bases : ty .Sequence [type ] = (),
448448 xor : ty .Sequence [str | None ] | ty .Sequence [ty .Sequence [str | None ]] = (),
449449):
450- """Create a task definition class and its outputs definition class from the
450+ """Create a task class and its outputs class from the
451451 input and output fields provided to the decorator/function.
452452
453453 Modifies the class so that its attributes are converted from pydra fields to attrs fields
@@ -467,9 +467,9 @@ def make_task_def(
467467 name : str, optional
468468 The name of the class, by default
469469 bases : ty.Sequence[type], optional
470- The base classes for the task definition class, by default ()
470+ The base classes for the task class, by default ()
471471 outputs_bases : ty.Sequence[type], optional
472- The base classes for the outputs definition class, by default ()
472+ The base classes for the outputs class, by default ()
473473 xor: Sequence[str | None] | Sequence[Sequence[str | None]], optional
474474 Names of args that are exclusive mutually exclusive, which must include
475475 the name of the current field. If this list includes None, then none of the
@@ -509,14 +509,14 @@ def make_task_def(
509509 if name is None :
510510 raise ValueError ("name must be provided if klass is not" )
511511 bases = tuple (bases )
512- # Ensure that TaskDef is a base class
512+ # Ensure that Task is a base class
513513 if not any (issubclass (b , spec_type ) for b in bases ):
514514 bases = bases + (spec_type ,)
515515 # If building from a decorated class (as opposed to dynamically from a function
516516 # or shell-template), add any base classes not already in the bases tuple
517517 if klass is not None :
518518 bases += tuple (c for c in klass .__mro__ if c not in bases + (object ,))
519- # Create a new class with the TaskDef as a base class
519+ # Create a new class with the Task as a base class
520520 klass = types .new_class (
521521 name = name ,
522522 bases = bases ,
@@ -580,7 +580,7 @@ def make_outputs_spec(
580580 bases : ty .Sequence [type ],
581581 spec_name : str ,
582582) -> type ["TaskOutputs" ]:
583- """Create an outputs definition class and its outputs definition class from the
583+ """Create an outputs class and its outputs class from the
584584 output fields provided to the decorator/function.
585585
586586 Creates a new class with attrs fields and then calls `attrs.define` to create an
@@ -591,9 +591,9 @@ def make_outputs_spec(
591591 outputs : dict[str, Out]
592592 The output fields of the task
593593 bases : ty.Sequence[type], optional
594- The base classes for the outputs definition class, by default ()
594+ The base classes for the outputs class, by default ()
595595 spec_name : str
596- The name of the task definition class the outputs are for
596+ The name of the task class the outputs are for
597597
598598 Returns
599599 -------
0 commit comments