basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
functions that will be run at type-time. similar to plugins, but don't care about mypy internals. ### ideally: ```py @type_function def Add(left: int, right: int) -> int: return left +...
```py from typing import overload, override class A: def f(self, x: float = 0.0): ... class B(A): @overload def f(self): ... @overload def f(self, x: float): ... @override def f(self,...
```py from typing import overload class Foo: @overload def f(self, x: int): ... @overload def f(self, x: str): ... def f(self, x: object): ... Foo().f.__name__ ```
```py class A[T]: t: ClassVar[T] A[int].t = 1 ``` this is obviously an error, but: ```py class B(A[int]): pass B.t = 1 ``` this should be allowed
totally needs; ```py self.items = flatten_nested_unions(items, handle_type_alias_type=False, type_type=IntersectionType) ```
```py def f[T, T2](t: T, t2: T2) -> T | T2: return t print(f"{f("", "")}") # The string for "object" isn't helpful in a user-facing or semantic string ```
tell mypy which ones are extras, then it could warn you on usages and understand that they might not exist
```py from typing import TypeVar, Collection T = TypeVar('T') L = TypeVar('L', bound=Collection[T]) def foo(l: L) -> T: return l[0] reveal_type(foo([1])) # int def bar[T2, L2: Collection[T2]](l: L2) -> T:...