basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```py class A(ABC): @classmethod @abstractmethod def foo(cls): ... A.foo() # no error? ``` until we have `@notabstract`, then maybe we should allow calling methods that return `Self` related: - #753
```py class A(ABC): @abstractmethod @classmethod def foo(): ... @notabstract @classmethod def bar(cls): print("hi") A.foo() # should be an error A.bar() # should be okay ``` maybe this could work for...
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) The relevant code: https://github.com/jorenham/scipy-stubs/blob/master/scipy-stubs/stats/_distn_infrastructure.pyi#L197-L233 When I run `mypy --show-traceback scipy-stubs/stats/_distn_infrastructure.pyi`: ``` scipy-stubs/stats/_distn_infrastructure.pyi:197: error: INTERNAL ERROR -- Please try...
in some ways, similar to `Not` types, but at the declaration site: ```py @category class Missing: .... a: object = Missing() # error: "Missing" is in a different category to...
```py def f(*args: tuple[object, ...], **kwargs: dict[str, object]): ... ``` this is much nicer than the short form in 484
```py from dataclasses import dataclass @dataclass(repr=False) class Foo: a: int = 1 print(f"{Foo(1)}") # ```
```py from typing import TYPE_CHECKING b = 1 if TYPE_CHECKING else "" reveal_type(b) # int | str ```
```py from types import FunctionType fn: "() -> int" assert isinstance(fn, FunctionType) reveal_type(fn) # Revealed type is "types.FunctionType" (narrowed from "() -> int") ```
upstream issue, but: ```py class A: ... class B: ... class C: ... other: (A & B) | C data: B | C data = other if isinstance(data, A): reveal_type(data)...
```py from typing import Unpack def f(*a: *(tuple[str, ...] | tuple[int, ...])): ... f(1, 2) f("a", "b") f(1, "b") ```