mypy
mypy copied to clipboard
Optional static typing for Python
This seems to be a somewhat common `zip` idiom: ```py >>> a = [('a', 1), ('b', 2), ('c', 3)] >>> list(zip(*a)) [('a', 'b', 'c'), (1, 2, 3)] ``` The inferred...
Modules can implement protocols, so `type(x)` is not necessarily a type object if `x` has a protocol type. ```py from typing import Protocol class P(Protocol): def f(self) -> None: ......
**Bug Report** In the global scope, mypy allows destructuring any object in `match case` with `object(x=y)`: ```py @dataclass class A: id: int # SUCCESS match A(id=5): case object(id=object_id): print(object_id) ```...
* (fix): when --include-private is not passed stubgen omits packages and modules which names start with "_" and do not end with "__" ___ This commit aims to close #16808....
Nothing much, updated several docstrings. ___ * (docs): update docstrings in `.check_override()`, add missing args description * (docs): update docstring in `maybe_process_conditional_comparison()`, add missings args description
**Crash Report** mypy crashes with segmentation fault as such: ```plaintext mypy-segmentation-fault on main is 📦 v0.1.0 via 🐍 v3.11.6 (mypy-segmentation-fault-py3.11) ❯ mypy --version mypy 1.7.1 (compiled: yes) mypy-segmentation-fault on...
```py from typing import Hashable, Any t1: type[Any] = type h1: Hashable = t1 # error: Incompatible types in assignment (expression has type "Type[Any]", variable has type "Hashable") ``` Which...
```py from typing import Protocol import test2 # def foo() -> None: ... class P(Protocol): def foo(self) -> None: ... a: P = test2 reveal_type(a.foo()) # None a = test2...
**Bug Report** When using `MYPY_FORCE_COLOR` (or `FORCE_COLOR` with `master`) on GitHub Actions (which is not a tty), colour only shows up for Windows, and not for Ubuntu or macOS. **To...
Very similar to https://github.com/python/mypy/issues/1983 but still happens with mypy 1.0 **Bug Report** **To Reproduce** ```python from typing import Callable, Any from random import randrange def test(x: Callable[[Any], None]): pass def...