Skip to content

Commit

Permalink
Merge pull request #2256 from Jonxslays/patch/typing-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism authored Apr 26, 2022
2 parents 6f35455 + 4695370 commit afdfb12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Version 8.1.3

Unreleased

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


Version 8.1.2
-------------
Expand Down
8 changes: 4 additions & 4 deletions src/click/decorators.py
Original file line number Diff line number Diff line change
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 afdfb12

Please sign in to comment.