From 1b5035030850e0257d19eb859449e0d1f3c46faf Mon Sep 17 00:00:00 2001 From: Tom Close Date: Mon, 9 Dec 2024 21:53:09 +1100 Subject: [PATCH] renamed FunctionTask -> PythonTask and ShellCommandTask -> ShellTask for consistent naming convention with Spec & Outputs classes --- pydra/design/python.py | 4 ++-- pydra/design/shell.py | 6 +++--- pydra/engine/boutiques.py | 4 ++-- pydra/engine/task.py | 4 ++-- pydra/mark/functions.py | 6 +++--- pydra/mark/shell.py | 8 ++++---- pydra/utils/tests/utils.py | 8 ++++---- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pydra/design/python.py b/pydra/design/python.py index 5f050ac11b..610979910c 100644 --- a/pydra/design/python.py +++ b/pydra/design/python.py @@ -102,7 +102,7 @@ def define( auto_attribs : bool Whether to use auto_attribs mode when creating the class. """ - from pydra.engine.task import FunctionTask + from pydra.engine.task import PythonTask from pydra.engine.specs import PythonSpec, PythonOutputs def make(wrapped: ty.Callable | type) -> PythonSpec: @@ -143,7 +143,7 @@ def make(wrapped: ty.Callable | type) -> PythonSpec: interface = make_task_spec( PythonSpec, PythonOutputs, - FunctionTask, + PythonTask, parsed_inputs, parsed_outputs, name=name, diff --git a/pydra/design/shell.py b/pydra/design/shell.py index 4c08612fcd..94e96b23ba 100644 --- a/pydra/design/shell.py +++ b/pydra/design/shell.py @@ -1,4 +1,4 @@ -"""Decorators and helper functions to create ShellCommandTasks used in Pydra workflows""" +"""Decorators and helper functions to create ShellTasks used in Pydra workflows""" from __future__ import annotations import typing as ty @@ -254,7 +254,7 @@ def define( ShellSpec The interface for the shell command """ - from pydra.engine.task import ShellCommandTask + from pydra.engine.task import ShellTask from pydra.engine.specs import ShellSpec, ShellOutputs def make( @@ -339,7 +339,7 @@ def make( interface = make_task_spec( ShellSpec, ShellOutputs, - ShellCommandTask, + ShellTask, parsed_inputs, parsed_outputs, name=class_name, diff --git a/pydra/engine/boutiques.py b/pydra/engine/boutiques.py index 3f1b7bb4b2..8d7782b3e5 100644 --- a/pydra/engine/boutiques.py +++ b/pydra/engine/boutiques.py @@ -6,12 +6,12 @@ from functools import reduce from pydra.utils.messenger import AuditFlag -from pydra.engine.task import ShellCommandTask +from pydra.engine.task import ShellTask from pydra.engine.specs import SpecInfo, ShellSpec, ShellOutputs, File, attrs_fields from .helpers_file import is_local_file -class BoshTask(ShellCommandTask): +class BoshTask(ShellTask): """Shell Command Task based on the Boutiques descriptor""" def __init__( diff --git a/pydra/engine/task.py b/pydra/engine/task.py index 378f8ae5c3..78ab415d38 100644 --- a/pydra/engine/task.py +++ b/pydra/engine/task.py @@ -70,7 +70,7 @@ from .environments import Native -class FunctionTask(Task): +class PythonTask(Task): """Wrap a Python callable as a task element.""" def _run_task(self, environment=None): @@ -95,7 +95,7 @@ def _run_task(self, environment=None): ) -class ShellCommandTask(Task): +class ShellTask(Task): """Wrap a shell command as a task element.""" def __init__( diff --git a/pydra/mark/functions.py b/pydra/mark/functions.py index d3bdaa9b03..c8b45fc265 100644 --- a/pydra/mark/functions.py +++ b/pydra/mark/functions.py @@ -30,7 +30,7 @@ def decorate(func): def task(func): """ - Promote a function to a :class:`~pydra.engine.task.FunctionTask`. + Promote a function to a :class:`~pydra.engine.task.PythonTask`. Example ------- @@ -40,10 +40,10 @@ def task(func): ... return a ** 2.0 """ - from pydra.engine.task import FunctionTask + from pydra.engine.task import PythonTask @wraps(func) def decorate(**kwargs): - return FunctionTask(func=func, **kwargs) + return PythonTask(func=func, **kwargs) return decorate diff --git a/pydra/mark/shell.py b/pydra/mark/shell.py index 0f700d6970..869a24362d 100644 --- a/pydra/mark/shell.py +++ b/pydra/mark/shell.py @@ -1,4 +1,4 @@ -"""Decorators and helper functions to create ShellCommandTasks used in Pydra workflows""" +"""Decorators and helper functions to create ShellTasks used in Pydra workflows""" from __future__ import annotations import typing as ty @@ -93,7 +93,7 @@ def ensure_base_included(base_class: type, bases_list: list[type]): pass # Ensure bases are lists and can be modified - ensure_base_included(pydra.engine.task.ShellCommandTask, bases) + ensure_base_included(pydra.engine.task.ShellTask, bases) ensure_base_included(pydra.engine.specs.ShellSpec, inputs_bases) ensure_base_included(pydra.engine.specs.ShellOutputs, outputs_bases) @@ -140,8 +140,8 @@ def convert_to_attrs(fields: dict[str, dict[str, ty.Any]], attrs_func): name = klass.__name__ bases = [klass] - if not issubclass(klass, pydra.engine.task.ShellCommandTask): - bases.append(pydra.engine.task.ShellCommandTask) + if not issubclass(klass, pydra.engine.task.ShellTask): + bases.append(pydra.engine.task.ShellTask) try: executable = klass.executable diff --git a/pydra/utils/tests/utils.py b/pydra/utils/tests/utils.py index 0a65c780d7..9760704b38 100644 --- a/pydra/utils/tests/utils.py +++ b/pydra/utils/tests/utils.py @@ -1,7 +1,7 @@ from fileformats.generic import File from fileformats.core.mixin import WithSeparateHeader, WithMagicNumber from pydra import mark -from pydra.engine.task import ShellCommandTask +from pydra.engine.task import ShellTask from pydra.engine import specs @@ -69,7 +69,7 @@ def generic_func_task(in_file: File) -> File: ) -class GenericShellTask(ShellCommandTask): +class GenericShellTask(ShellTask): input_spec = generic_shell_input_spec output_spec = generic_shelloutput_spec executable = "echo" @@ -121,7 +121,7 @@ def specific_func_task(in_file: MyFormatX) -> MyFormatX: ) -class SpecificShellTask(ShellCommandTask): +class SpecificShellTask(ShellTask): input_spec = specific_shell_input_spec output_spec = specific_shelloutput_spec executable = "echo" @@ -175,7 +175,7 @@ def other_specific_func_task(in_file: MyOtherFormatX) -> MyOtherFormatX: ) -class OtherSpecificShellTask(ShellCommandTask): +class OtherSpecificShellTask(ShellTask): input_spec = other_specific_shell_input_spec output_spec = other_specific_shelloutput_spec executable = "echo"