From 7d77e9c5c1c8f275c07cbe4c74a9fb634f450f73 Mon Sep 17 00:00:00 2001 From: kasium <15907922+kasium@users.noreply.github.com> Date: Mon, 21 Mar 2022 00:13:02 +0100 Subject: [PATCH] Fix invoke task decorator (#7511) The decorator can be called with and without (). The current types only consider the first case --- stubs/invoke/invoke/tasks.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stubs/invoke/invoke/tasks.pyi b/stubs/invoke/invoke/tasks.pyi index a42064558..9aacd380f 100644 --- a/stubs/invoke/invoke/tasks.pyi +++ b/stubs/invoke/invoke/tasks.pyi @@ -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 = ...,