basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```py async def f(): return 1 reveal_type(f) # CoroutineType[None, None, 1] narrowed from Coroutine[None, None, 1] ```
```py a: object a = "a" while True: if a == 1: break a = 1 reveal_type(a) # 'a' | 1 ```
```py from __future__ import annotations class A: ... class B: ... class C: ... a: A & (B | C) b: A & (B | C) = a # Incompatible...
```py class A[*Ts]: ... class B[**P]: ... # unknown/projected - currently impossible unknown_a: A[...] unknown_b: B[...] # `...` will now mean unknown, not Any # variadic - currently disgusting A[*tuple[int,...
seo: extend, stub like basedpyright does: https://docs.basedpyright.com/latest/usage/builtins/
```py def f[**P](fn: Callable[P, None]) -> Callable[[int, *P], None]: ... ``` this seems completely unambiguous
I can't use `--always-false=MYPY` if I already have `always_true = "MYPY"` in the config: ```shell $ mypy --always-false=MYPY . usage: mypy [-h] [-v] [-V] [more options; see below] [-m MODULE]...
```py class A[T: (int, str)]: ... type BoolA[T: bool] = A[T] BoolA[str] BoolA[bool] type B[T: str] = object type C[T: int] = B[T] C[str] B[int] ```
```py def f(): a = 1 global a ```
```py from typing import Callable, TypeVar def asdf[T, **P](fn: Callable[P, T]) -> Callable[P, T]: ... T = TypeVar("T") foo: "() -> T" reveal_type(asdf(foo)) # "() -> Never", should be "[T]...