mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Optional static typing for Python

Results 1055 mypy issues
Sort by recently updated
recently updated
newest added

**Bug Report** Trying to infer types from docstrings with python3.12 inline generics fails to generate. **To Reproduce** ```python from mypy.stubdoc import infer_sig_from_docstring infer_sig_from_docstring('\nfunc[T, V](x: T, y: V) -> T', 'func')...

bug
topic-stubgen
topic-pep-695

**Bug Report** Empty properties defined in a protocol class that is subclassed by another protocol are incorrectly classified by mypy as abstract methods - this can then result in a...

bug
topic-inheritance

**Feature** Adding a warning or error if an expression is not assigned would encourage callers to handle return types and pick up on changes to APIs. **Pitch** Imagine you have...

feature

Combining two `isinstance` checks with `and` where the first one deduces the type to `Any` ignores the second one. **To Reproduce** ```python from typing import Any, reveal_type class A: pass...

bug

This PR changes the `fail` method's signature to be positional-only for the first two parameters, due to a mismatch between the [`CheckerPluginInterface` signature](https://github.com/python/mypy/blob/8dd268ffd84ccf549b3aa9105dd35766a899b2bd/mypy/plugin.py#L242-L244) and the implementation class ([`TypeChecker`](https://github.com/python/mypy/blob/8dd268ffd84ccf549b3aa9105dd35766a899b2bd/mypy/checker.py#L7116-L7118)). ```python class...

```py # mypy: enable-error-code=possibly-undefined from typing import Literal value: Literal[1, 2] match value: case 1: result = 1 case 2: result = 2 result # error: possibly-undefined ``` [playground](https://mypy-play.net/?mypy=master&python=3.12&flags=strict%2Ccheck-untyped-defs%2Cdisallow-any-decorated%2Cdisallow-any-expr%2Cdisallow-any-explicit%2Clocal-partial-types%2Cstrict-equality%2Cwarn-incomplete-stub%2Cwarn-redundant-casts%2Cwarn-return-any%2Cwarn-unreachable%2Cwarn-unused-configs%2Cwarn-unused-ignores&gist=7ada949d8f753dab131a7a9a6076a9f4) similar...

bug

**Feature** As the title suggests **Pitch** JSON format output is easier to handle by code,and -- disable-error-code all seems to be a natural and reasonable parameter Both **ruff** and **pylint**...

feature
topic-configuration

**Bug Report** Where the single argument to `__floordiv__`/`__rfloordiv__` includes `numbers.Real`, it results in (what I think is) a false `Signatures … are unsafely overlapping` error. **To Reproduce** ```python # test_case.py...

bug

**Bug Report** The `__sub__` method on the `Arrow` class from the `arrow` package [has several `@overload`s](https://github.com/arrow-py/arrow/blob/d688de482c5379455dfad8163f56749e81b9e806/arrow/arrow.py#L1730): ```python @overload def __sub__(self, other: Union[timedelta, relativedelta]) -> "Arrow": pass # pragma: no cover...

bug
topic-overloads

**Bug Report** When trying to annotate overloads for an asynccontextmanager, I think mypy incorrectly reports an invalid return type. **To Reproduce** ```python from contextlib import asynccontextmanager, contextmanager from typing import...

bug