basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
- resolves: #518 - resolves: #432 - resolves: #451
To consider for pages: - stable and latest branches, or branches for each release? Does pages have a multiple releases kind of thing?
Often iterating a string is a mistake, it should be explicit in some way, maybe `iter(my_str)`? ```py s: str for item in s: # error: iterating a string, user 'iter(s)'...
```py foo: "int" = 1 # error: quotes are not necessary (expression is valid at runtime) ``` ```py from __future__ import annotations foo: "Foo & Bar" = 1 # error:...
```py class A: a: ClassVar = [] # expected error: cannot infer type, add explicit annotation ```
```py class A: a: ClassVar = 1 reveal_type(A.a) # Expression has type "Any (from omitted generics)" ```
```py def f(): a = 1 b: 1 = a # error ``` This shouldn't be an error, `a` can never be modified.
```py a: x is int b: TypeGuard[int] ``` Until they are fully supported as subtypes of `bool`
```py def guard(x: object, y: object) -> a is int & b is str if True else a is str & b is int: ... ``` The tricky part is...