Skip to content

Commit

Permalink
renamed FunctionTask -> PythonTask and ShellCommandTask -> ShellTask …
Browse files Browse the repository at this point in the history
…for consistent naming convention with Spec & Outputs classes
  • Loading branch information
tclose committed Dec 9, 2024
1 parent a9071e4 commit 1b50350
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions pydra/design/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions pydra/design/shell.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -339,7 +339,7 @@ def make(
interface = make_task_spec(
ShellSpec,
ShellOutputs,
ShellCommandTask,
ShellTask,
parsed_inputs,
parsed_outputs,
name=class_name,
Expand Down
4 changes: 2 additions & 2 deletions pydra/engine/boutiques.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
4 changes: 2 additions & 2 deletions pydra/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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__(
Expand Down
6 changes: 3 additions & 3 deletions pydra/mark/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand All @@ -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
8 changes: 4 additions & 4 deletions pydra/mark/shell.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions pydra/utils/tests/utils.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

0 comments on commit 1b50350

Please sign in to comment.