basedmypy
basedmypy copied to clipboard
Render `Any` subtypes
class A(Any): ...
reveal_type(A()) # A
This could reveal something like A(Any) or Any(A) or Any[A]
class A:
def __getattr__(...) -> Any: ...
a: A
reveal_type(a.foo) # Any
This could mention that the signature of foo is actually comming from an operator.
Original Content
import tempfile
from os import PathLike
with tempfile.NamedTemporaryFile() as file:
reveal_type(file) # tempfile._TemporaryFileWrapper[builtins.bytes]
foo: PathLike[str] = file # no error even though it's not a PathLike
it wwould also be useful if the error provided some information as to what's causing it
The source of the Any would be good to show. In this case it's an Any __getattr__.