mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** Since `mypy` version 1.11 the `comparison-overlap` error occurred in the following code. This error did not occur in older versions that I have used before. **To Reproduce** ```python...
**Bug Report, To Reproduce, & Actual Behaviour** The following snippet will fail at runtime, which mypy should catch with `[possibly-undefined]` (see [mypy Playground](https://mypy-play.net/?mypy=latest&python=3.12&gist=ffd0896ef508012a9825872ae6df3778)): ```python # mypy: enable-error-code=possibly-undefined from typing import...
**Bug Report** A regression bug has been identified in `mypy` version 1.11.1, where the use of `typing.Self` in class method factory functions triggers an error. This issue does not occur...
**Bug Report** If you subclass a class with a metaclass but change the metaclass to your own with a different method signature, mypy does not pick up on that. **To...
The following code: ```python3 from collections.abc import Callable, Sequence from functools import partial, reduce from typing import cast, Any CA = Callable[[Any], Any] CB = Callable[[Callable[..., Any], Any], Any] def...
```python from typing import Any from array_api_compat import get_namespace import numpy as np import numpy.typing as npt def create_diagonal_array(m: npt.NDArray[Any]) -> npt.NDArray[Any]: """A vectorized version of diagonal. Args: m: Has...
**Bug Report** I have a generic class and function, which return Union containing TypeVar as in generic. Mypy will give error [arg-type] if I pass function result in another function...
**Bug Report, To Reproduce, & Actual Behaviour** I'm hitting a strange error in `data_structures.py` with the following project structure, with a potential culprit in `runtime_validation.py`: ``` Project/ └── package/ ├──...
@ilevkivskyi This is part two of the [checker.py chase](https://github.com/python/mypy/pull/17899#issuecomment-2408149716). I had to extend `InstanceDeprecatedVisitor` so that it refrains from reporting that `self` in the signature of a deprecated class' method...
Fixes https://github.com/mypyc/mypyc/issues/1070 Missed in https://github.com/python/mypy/pull/10543