-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
NOTE: Appears to be caused by #5483. Issue does not occur against stubs prior to 7a9a107 (e.g. with types-click==0.1.12
).
The stubs for click
annotate the return type of many of the library's decorator factories as IdentityFunction
(e.g. see argument
stub, but the revealed type when running mypy
is Any
. See sample program below.
I'm not sure if this is indicative of an underlying bug in mypy
or if there's something missing in the usage of IdentityFunction
from typeshed
that keeps it from resolving that helper. Insight from someone who is more familiar with the details would be appreciated.
Sample program
import click
reveal_type(click.argument("foo"))
@click.command()
@click.argument("foo")
def cli(foo: str) -> None:
...
reveal_type(cli)
Output
12:17 [snoopjedi@denton ~]
$ python3 -m mypy --strict repro.py
repro.py:3: note: Revealed type is "Any"
repro.py:6: error: Untyped decorator makes function "cli" untyped
repro.py:10: note: Revealed type is "click.core.Command"
Found 1 error in 1 file (checked 1 source file)
Version information
- Python: 3.8.10
mypy
: 0.910types-click
: 7.1.6
NOTE: I am submitting this issue on behalf of a user who asked a question about it in #python on the Libera IRC network.
Metadata
Metadata
Assignees
Labels
No labels