mypy
mypy copied to clipboard
Optional static typing for Python
Fixes https://github.com/python/mypy/issues/16522. This PR adds special casing for TypeVarTuple inference in the face of kwargs, though I believe the general case requires providing multiple possible constraints (e.g. "constraint a OR...
**Bug Report** Mypy 1.11.0 gives me a false positive that 1.10.1 didn't. Looks like it thinks that `is_dataclass()` narrows to `Type[DataclassInstance]`, whereas in reality it should probably be something more...
A number of false function signatures were being detected by the `DocStringParser`. This PR fixes them that issue. The main problem I was getting was because my doc strings would...
Closes #16111 This PR provides only basic support. Many special cases might need additional attention (descriptors, some special methods like `__int__`, etc.). Other open issues are code comments, eventual documentation...
Apologies if it's a known issue, I searched for some time on the issue tracker, but no luck! **Bug Report** When you access a dataclass instance attribute as a class...
**Bug Report** `--enable-error-code possibly-undefined` does not detect when a local variable is conditionally set by a `for` loop. **To Reproduce** https://gist.github.com/mypy-play/25a51361be6d697e25b32587e4cba351 https://mypy-play.net/?mypy=latest&python=3.11&gist=25a51361be6d697e25b32587e4cba351 **Expected Behavior** If a variable is set by...
**Bug Report** `mypy` does not understand that in an Enum, `self` can be compared to its members. **To Reproduce** ```python from enum import Enum, auto class Glass(Enum): HALF_FULL = auto()...
**Bug Report** Mypy hangs indefinitely when trying to analyse a file with huge nested dicts. **To Reproduce** 1. Copy and paste the contents of this file into a `.py` file:...
This PR fixes the algorithm for determining a classes metaclass. (Together with https://github.com/python/mypy/pull/17681) fixes #14033
Add a flag and config ini options `"enable_installed_packages"`. Setting it to `True` instructs mypy to typecheck also modules that do not have stubs or a `py.typed` marker. Fixes #8545