Consider the following (contrived) code:
fromtypingimportTypedefuntyped_function():
returnintdeffoo() ->Type[int]:
x=untyped_function()
assertissubclass(x, int)
returnx
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
Consider the following (contrived) code:
Running mypy on this with the
--warn-return-anyoption produces the error "Returning Any from function declared to return "Type[int]"", even though theassert issubclassshould convince mypy thatxis of typeType[int]and not anAny.Your Environment
--warn-return-anymypy.ini(and other config files): none