Open
Description
Consider the following (contrived) code:
from typing import Type
def untyped_function():
return int
def foo() -> Type[int]:
x = untyped_function()
assert issubclass(x, int)
return x
Running mypy on this with the --warn-return-any
option produces the error "Returning Any from function declared to return "Type[int]"
", even though the assert issubclass
should convince mypy that x
is of type Type[int]
and not an Any
.
Your Environment
- Mypy version used: 0.902
- Mypy command-line flags:
--warn-return-any
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: Python 3.9.5
- Operating system and version: macOS 11.3.1