Skip to content

Commit

Permalink
Fix typing on command and group decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonxslays authored and davidism committed Apr 26, 2022
1 parent 4883c93 commit 9a3ac69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGES.rst
@@ -1,5 +1,12 @@
.. currentmodule:: click

Unreleased
----------

- Use verbose form of ``Callable`` typing for ``@command`` and
``@group``. :issue:`2255`


Version 8.1.2
-------------

Expand Down
8 changes: 4 additions & 4 deletions src/click/decorators.py
Expand Up @@ -149,7 +149,7 @@ def command(


def command(
name: t.Union[str, t.Callable, None] = None,
name: t.Union[str, t.Callable[..., t.Any], None] = None,
cls: t.Optional[t.Type[Command]] = None,
**attrs: t.Any,
) -> t.Union[Command, t.Callable[..., Command]]:
Expand Down Expand Up @@ -182,7 +182,7 @@ def command(
appended to the end of the list.
"""

func: t.Optional[t.Callable] = None
func: t.Optional[t.Callable[..., t.Any]] = None

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

@t.overload
def group(
__func: t.Callable,
__func: t.Callable[..., t.Any],
) -> Group:
...

Expand All @@ -242,7 +242,7 @@ def group(


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

0 comments on commit 9a3ac69

Please sign in to comment.