Skip to content

Commit 7d77e9c

Browse files
authored
Fix invoke task decorator (#7511)
The decorator can be called with and without (). The current types only consider the first case
1 parent a11a664 commit 7d77e9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stubs/invoke/invoke/tasks.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import Self
22
from collections.abc import Callable, Iterable
3-
from typing import Any, TypeVar
3+
from typing import Any, TypeVar, overload
44

55
from .config import Config
66
from .context import Context
@@ -55,6 +55,9 @@ class Task:
5555
def arg_opts(self, name: str, default: Any, taken_names: Iterable[str]) -> dict[str, Any]: ...
5656
def get_arguments(self) -> list[Argument]: ...
5757

58+
@overload
59+
def task(__func: Callable[..., Any]) -> Task: ...
60+
@overload
5861
def task(
5962
*args: Task,
6063
name: str | None = ...,

0 commit comments

Comments
 (0)