diff options
author | Jonxslays <51417989+Jonxslays@users.noreply.github.com> | 2022-04-22 05:06:51 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-04-26 07:35:13 -0700 |
commit | 4695370071b543f6261fcaa26705323ae064050b (patch) | |
tree | 429311d5ce75a9f582439e156523278fc1c22ad3 | |
parent | 6f35455ddf500d57aa746a4dc06d812ca535dd0e (diff) | |
download | click-4695370071b543f6261fcaa26705323ae064050b.tar.gz |
use verbose Callable for @command and @group
-rw-r--r-- | CHANGES.rst | 3 | ||||
-rw-r--r-- | src/click/decorators.py | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index f79a531..a618f5a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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 ------------- diff --git a/src/click/decorators.py b/src/click/decorators.py index ef1b1a5..28618dc 100644 --- a/src/click/decorators.py +++ b/src/click/decorators.py @@ -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]]: @@ -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 @@ -228,7 +228,7 @@ def command( @t.overload def group( - __func: t.Callable, + __func: t.Callable[..., t.Any], ) -> Group: ... @@ -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` |