mypy
mypy copied to clipboard
Optional static typing for Python
**Documentation** error_code_list.rst and error_code_list2.rst should be merged. The main result of having two pages is that half the time I end up checking the wrong page if I don't know...
*Memo: - `mypy --strict test.py` - mypy 1.19.0 - Python 3.14.0 - Windows 11 [Invariance vs covariance](https://mypy.readthedocs.io/en/stable/common_issues.html#invariance-vs-covariance) says **_mypy considers all user-defined generic classes invariant by default_** as shown below:...
This PR ensures that the values set for mypyc attrs `native_class` and `allow_interpreted_subclasses` are compatible with each other A user should not be able to pass both `native_class=False` and `allow_interpreted_subclasses=True`...
When a for loop contains branches with `break` and an `else` block, variables declared inside those branches were incorrectly discarded from further analysis, leading Mypy to incorrectly report a variable...
**Documentation** The current documentation [https://mypy.readthedocs.io/en/latest/protocols.html#defining-subprotocols-and-subclassing-protocols](https://mypy.readthedocs.io/en/latest/protocols.html#defining-subprotocols-and-subclassing-protocols) mentions the following: > explicitly assigning to a protocol instance can be a way to ask the type checker to verify that your class implements...
Fixes #19328 Fixes #20294 The logic is very similar to what we did to report different revealed types that were discovered in multiple iteration steps in one line. I think...
Fixes Issue #2393 Updated generic error statements within the single Common Issues page with actual error responses when running examples. Tried to incorporate the comments from the PR #3404 as...
**Feature** Ideally, if anyone has the time, documentation code blocks should be type checked as real tests **Pitch** This will ensure that the examples stay up to date and valid;...
**Bug Report** This came up with `pandas-stubs`, but can reproduce with just numpy **To Reproduce** ```python from typing import TypeVar import numpy as np NDArrayT = TypeVar("NDArrayT", bound=np.ndarray) def foo(x:...