basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```python from typing import TypeVar class Foo: ... class Bar: ... T = TypeVar("T", bound=Foo & Bar) # error: TypeVar "bound" must be a type # error: Unsupported left operand...
We can't use `In`/`Out` modifiers because that's a syntax error ```py class A[Out[T]]: ... ^ SyntaxError: invalid syntax ``` So what about semantic naming for type vars? `in_T`/`out_T`? - related...
```py def foo() -> Never: ... # allowed b = Union[int, str] # not allowed ``` `basedtyping` as well. Maybe `types` as well. We could modify `sitecustomize.py` to actually load...
```py a: int & str reveal_type(a) # int & str, should be Never ```
- resolves #614 - resolves #80 - resolves #620 - resolves #624 ```py from __future__ import annotations from typing import * from types import FunctionType some_callable: Callable[['C'], int] class C:...
Before you raise this, consider if it's better suited to a discussion: https://github.com/KotlinIsland/basedmypy/discussions e.g. ```py def foo(x: int,_) -> int:#Error, but I don't want it to be ... ``` Sometimes,...
```py a: int | None b: str | None a == b # Non-overlapping equality check (left operand type: "int | None", right operand type: "str | None") [comparison-overlap] ```...
I think `sealed` should be default be scoped to the root package, not the current module.
```py def f(value: str, optional=False): if value.startswith("a"): if optional: return None raise ValueError return value ``` This should find the two overloads automatically.
```py def f(a): # def f[T](a: T) -> T return a def find(data: list, predicate: "(...) -> ..."): # find[T](data: list[T], predicate: (T) -> T) -> T for item in...