basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

Based Python static type checker with baseline, sane default settings and based typing features

Results 446 basedmypy issues
Sort by recently updated
recently updated
newest added

```py a = [] # E: error: Need type annotation for "a" (hint: "a: list[] = ...") [var-annotated] reveal_type(a) # E: Expression type contains "Any" (has type "list[Any (unannotated)]") [no-any-expr]...

feature

```py class A[LowerBound[T, int]]: ... A[object] # ok A[int] # ok A[bool] # nah ``` # mypy in real life ```py class list[T]: def copy[R: lower=T](self) -> list[R]: ... a:...

feature
generic modifier

```py a = [1, 2, 3] b: list[object] = a.copy() # error: invariance, expected no error ``` ```py class list[T]: def copy[R >: T]() -> list[R]: ... ``` (which doesn't...

feature

```py a: Callable[[object], TypeGuard[int] ``` how denote? ```py a: Callable[[object], "argument 1 is int"] ```

feature
TypeGuard

it would be nice to have a variable like `TYPE_CHECKING` that's only true in basedmypy, so we can conditionally support based features while still supporting regular type checkers: ```py from...

feature
basedtyping
p-3

The current solution is heuristic based and highly unsound. This will require reworking `AbstractContextManager` to know about the types of Exception and return type of `__exit__` ```py class Base: def...

feature

```py print("hi") ``` ```console > mypy --run test.py Success: no issues found in 1 source file hi ```

feature

```py a: object def guard() -> a is int: ... assert guard() reveal_type(a) ```

feature
TypeGuard

```py class A: value: int | str def f() -> bool: if self.guard(): return self.value.isnumeric() return False def guard(self) -> self.value is str: ... ```

feature
TypeGuard