mypy
mypy copied to clipboard
Optional static typing for Python
While disabled_error_codes and enabled_error_codes are internal fields in the options class, they cannot be set externally, unlike their peers. These tests ensure this intended behavior is maintained. Closes https://github.com/python/mypy/issues/12394, which...
Fixes #20358. As discovered by @randolf-scholz in #20142, `mypy` treats value patterns in match statement in a completely wrong way. From [PEP 622](https://peps.python.org/pep-0622/#literal-patterns): > Literal pattern uses equality with literal...
**Bug Report** MyPy doesn't recognize that `isinstance(type_var, type) and isinstance(another_var, type_var)` narrows `another_var` to whatever `type_var` is. **To Reproduce** ```python class RemoteFunction(Generic[_T]): def __init__(self, return_type: type[_T] | Callable[[Any], _T]): self._return_type...
This PR addresses Issue #20077 by merging the two separate error code documentation pages (`error_code_list.rst` and `error_code_list2.rst`) into a single, unified document. This improves the user experience by eliminating the...
*Memo: - `mypy --strict test.py` - mypy 1.19.0 - Python 3.14.0 - Windows 11 [reveal_type()](https://docs.python.org/3/library/typing.html#typing.reveal_type) can get `T` type of the instance of a generic class as shown below: ```python...
**Bug Report** I have a type variable with a default set. For some reason, this seems to be causing mypy to refuse to allow that variable to be `Never` in...
**Bug Report** ``` from typing import Any, Dict, Literal kw: Dict[Literal["a", "b"], Any] def func(a, b): pass func(**kw) ``` Leads to ``` main.py:8: error: Keywords must be strings ``` https://mypy-play.net/?mypy=latest&python=3.9&gist=582cf5e8c0a6e6a5881d391da64e1455...
**Bug Report** it appears the new `partial` plugin added in mypy 1.11 doesn't properly handle overloads (and just picks the first one) **To Reproduce** ```python import functools from typing import...
This is a follow up to #18874 which broke certain imports of type annotations. /cc @advait-dixit @JukkaL Fixes https://github.com/mypyc/mypyc/issues/1099 Fixes https://github.com/mypyc/mypyc/issues/1167 Fixes #20365 Closes https://github.com/mypyc/mypyc/issues/1100
We always wanted to release more often. I would propose to already aim at 1.19 release mid or late October. cc @JukkaL