Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Release 0.11.0 #66

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/dewret/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

Param = ParamSpec("Param")
RetType = TypeVar("RetType")

T = TypeVar("T")

class Backend(Enum):
"""Stringy enum representing available backends."""
Expand Down Expand Up @@ -323,6 +323,9 @@ def factory(fn: Callable[..., RetType]) -> Callable[..., RetType]:
"""
return task(is_factory=True)(fn)

# Workaround for PyCharm
factory: Callable[[Callable[..., RetType]], Callable[..., RetType]] = factory


def workflow() -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]:
"""Shortcut for marking a task as nested.
Expand Down Expand Up @@ -351,6 +354,9 @@ def workflow() -> Callable[[Callable[Param, RetType]], Callable[Param, RetType]]
"""
return task(nested=True, flatten_nested=False)

# Workaround for PyCharm
workflow: Callable[[], Callable[[T], T]] = workflow


def task(
nested: bool = False,
Expand Down Expand Up @@ -653,6 +659,8 @@ def {fn.__name__}(...) -> ...:

return _task

# Workaround for PyCharm
task: Callable[[], Callable[[T], T]] = task

def set_backend(backend: Backend) -> None:
"""Choose a backend.
Expand Down
Loading