Fix invoke task decorator (#7511)

The decorator can be called with and without (). The current types only consider the first case
This commit is contained in:
kasium
2022-03-21 00:13:02 +01:00
committed by GitHub
parent a11a6643a7
commit 7d77e9c5c1

View File

@@ -1,6 +1,6 @@
from _typeshed import Self
from collections.abc import Callable, Iterable
from typing import Any, TypeVar
from typing import Any, TypeVar, overload
from .config import Config
from .context import Context
@@ -55,6 +55,9 @@ class Task:
def arg_opts(self, name: str, default: Any, taken_names: Iterable[str]) -> dict[str, Any]: ...
def get_arguments(self) -> list[Argument]: ...
@overload
def task(__func: Callable[..., Any]) -> Task: ...
@overload
def task(
*args: Task,
name: str | None = ...,