basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
They should work in: - `cast` - `assert_type` - Make basedtyping versions of the things in `typing` that support bare literals.
```py from typing import overload @overload def f(b: str, d: int, /): ... @overload def f(a: int, b: int): ... def f(a, b): reveal_type(a) # "int | str" reveal_type(b) #...
- resolves #598
```py print(exit()) print("hi") # error: unreachable ``` I would expect the first `print` to also be unreachable
```py a: "(int) -> str" b: int | "(int) -> str" ``` using `ast.parse(x, mode="func_type")`
include/exclude config options: ```toml [tool.mypy] helpful_string_include = ["utils.amongus.AMONGUS"] helpful_string_exclude = ["utils.amongus.SUS"] ``` config option for allowing `None`? config option for allowing certain functions:`print`/anything and `basedtyping.HasHelpfulString`/``basedtyping.UnhelpfulString`, which can be used: ```py...
```py from typing import TypeVar Int = TypeVar("Int", bound=Int) def f(i: Int): ... ```
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) _No response_ ### Gist to reproduce ```python from typing import TypeVar _T = TypeVar("_T", bound=int) def asdf(a: _T,...
- related to #463 ```py A = int | str reveal_type(A) # Currently `typing._SpecialForm`, expect `SpecialForm[int | str]` ```