basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) _No response_ ### Gist to reproduce ```python Foo = Intersection[1, int] foo: Foo = 1 # error: Variable...
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) _No response_ ### Gist to reproduce ```python foo = Intersection[int, type[int]] ``` ### Basedmypy version _No response_ ###...
```py from typing import overload @overload def f(): ... @overload def f(s: str, a: True = ...): ... def f(s="", a=True): ... v: None f(f"{v}", True) ```
```py a: Final[str] if a == "a": def f(): ... if a == "a": f() ``` this shouldn't be an error also `possibly-undefined`: ```py def func(x: bool): if x: msg...
```py def f(a): # dmypy suggest: (str) -> None return 1 a: int = f("") ```
test.py ```py from typing import Protocol import test2 class P(Protocol): def foo(self) -> None: ... a: P = test2 reveal_type(type(a).foo) # Revealed type is "def (self: test.P) -> None" ```...
```py def outer(): def inner(a, b, c): reveal_type(a) # int reveal_type(b) # str reveal_type(c) # int | str inner(1, "a", "b") inner(2, "c", 3) ``` What about private functions as...
```py import re reveal_type(re) # types.ModuleType ``` But mypy knows what module it is, maybe `types.ModuleType['re']`? - related #69