Skip to content

Commit 4695370

Browse files
Jonxslaysdavidism
authored andcommitted
use verbose Callable for @command and @group
1 parent 6f35455 commit 4695370

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGES.rst

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Version 8.1.3
55

66
Unreleased
77

8+
- Use verbose form of ``typing.Callable`` for ``@command`` and
9+
``@group``. :issue:`2255`
10+
811

912
Version 8.1.2
1013
-------------

src/click/decorators.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def command(
149149

150150

151151
def command(
152-
name: t.Union[str, t.Callable, None] = None,
152+
name: t.Union[str, t.Callable[..., t.Any], None] = None,
153153
cls: t.Optional[t.Type[Command]] = None,
154154
**attrs: t.Any,
155155
) -> t.Union[Command, t.Callable[..., Command]]:
@@ -182,7 +182,7 @@ def command(
182182
appended to the end of the list.
183183
"""
184184

185-
func: t.Optional[t.Callable] = None
185+
func: t.Optional[t.Callable[..., t.Any]] = None
186186

187187
if callable(name):
188188
func = name
@@ -228,7 +228,7 @@ def decorator(f: t.Callable[..., t.Any]) -> Command:
228228

229229
@t.overload
230230
def group(
231-
__func: t.Callable,
231+
__func: t.Callable[..., t.Any],
232232
) -> Group:
233233
...
234234

@@ -242,7 +242,7 @@ def group(
242242

243243

244244
def group(
245-
name: t.Union[str, t.Callable, None] = None, **attrs: t.Any
245+
name: t.Union[str, t.Callable[..., t.Any], None] = None, **attrs: t.Any
246246
) -> t.Union[Group, t.Callable[[F], Group]]:
247247
"""Creates a new :class:`Group` with a function as callback. This
248248
works otherwise the same as :func:`command` just that the `cls`

0 commit comments

Comments
 (0)