basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```py from typing import * out_T = TypeVar("out_T", covariant = True) class A(Generic[out_T]): @classmethod def f(cls, t: out_T) -> None: print("hi") ```
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) When writing tests with pytest, any method decorated with `@pytest.fixture` causes `no-any-expr` to be reported. ``` $ poetry...
```py from typing import Annotated from typing import _T as T F = Annotated[T, 1] # error a: F[int] = 1 ```
```py @overload def foo(value: str) -> int: ... @overload def foo[T](value: T) -> T: ... def foo[T](value: T | str): if isinstance(value, str): return 1 return value # Incompatible return...
```py class A[T]: def f(self) -> T: ... reveal_type(A) # [T] () -> test.A[out T] reveal_type(A[int]) # () -> test.A[out int] ```
```py type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 # error: valid-type type X = (int,...
```py type ClassMethod[T, **P, R] = FunctionType[Concatenate[type[T], P], R] ```
stringizer will kill us, but anyway: cpython compatible based syntax: - `(str) > int` for callable syntax, annoyingly `ast` wont see the parens here - `"foo" | "bar"` for string...
```py list[1] # error: invalid bare literal ``` but this is fine actually
```py foo: {"foo": str} ```