mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** In the code below, `decorator_pass` works fine while `decorator_fail` fails. The only difference between the two is that I extracted `Callable[[Method[C, P, T]], Method[C, P, T]]` into its...
**Bug Report** The enum metaclass will skip callables so that defining methods on an enum still works. This introduces a subtle logic error that won't be caught be mypy. If...
I'm afraid I'm not sure whether I'm reporting a bug or requesting a feature. I'm happy to leave that up for you all to triage. I'll start with what I'm...
# Fixes #13574 This PR fixes the generation of type hints for static methods of pybind11 classes. The code changes are based on the suggestions in #13574. The fix introduces...
**Bug Report** Mypy fails to preserve types when a union of tuples is transformed to a union of typed dicts. see linked mypy play link **To Reproduce** https://mypy-play.net/?mypy=latest&python=3.11&gist=84a763d09cf7fb68631fa74359d135e7 **Expected Behavior**...
**Bug Report** Mypy wrongly infers the type of the expression `x.get("a") or x.get("b", "c")` to be `str | None`, even when `x` is explicitly a `dict[str, str]`. **To Reproduce** ```python...
This seems to be a regression with v1.4 of mypy. It looks to me like globals are considered constant if they’re not explicitly typed. For example (see issue https://github.com/Bogdanp/dramatiq/issues/555) a...
**Feature** Add the ability to make mypy report errors but not fail (that is, not exit with a non-zero code), and make that ability controllable by module / path. This...
**Bug Report** When I assign `typing.final` to another name, it stops decorating things as final. The usecase for this is to add runtime behavior to my final classes by making...
**Bug Report** One of the most [common gotchas](https://docs.python-guide.org/writing/gotchas/#late-binding-closures) in Python is that a loop reassigns its iteration variable rather than creating a new binding for each iteration, and a `lambda`...