mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** I expect `n = Callable[P, int]` to work, or at least `n: TypeAlias = Callable[P, int]` **To Reproduce** ```py from typing import ParamSpec, Callable, TypeAlias P = ParamSpec("P")...
**Bug Report** Some code I was working on last week is causing mypy to segfault. I tried retracing my steps to find the change that broke mypy, without luck. Config:...
**Feature** I want mypy to show errors for all platforms and versions, not just the current/selected one ```py import sys if sys.version_info < (3, 11): print(21 + "sus") # very...
```py from typing import overload, Literal class A: ... class B: ... class C(A, B): ... @overload def foo(a: Literal[True], b: Literal[True]) -> C: ... @overload def foo(a: Literal[True], b:...
If Black fails in CI, it would be nice to show prominently the exact command needed to fix the issue (possibly just `black .`). I guess isort could be similar....
```py from typing import Any s: Any = slice(1, 2, 3) class X(s): ... print(X) # slice('X', (slice(1, 2, 3),), {'__module__': '__main__', '__qualname__': 'X'}) x = X() # TypeError: 'slice'...
This PR improves mypy's understanding of the mypy codebase, and reduces the number of false positives if you run the selfcheck with `--warn-unreachable`. --- As stated in this docstring here,...
**Feature** Add a new check, `[disallow-non-exhaustive-match]`, that enforces at type check time that no `match` statements implicitly fall through their bottom. I would prefer if this check were on-by-default, or...
Consider this example: ```py from __future__ import annotations class X: ... class Y: @property def some_property(self) -> Descriptor: # return Descriptor instance return Descriptor() class Descriptor: def __get__(self, obj: X,...
Fixes #10575