mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** (A clear and concise description of what the bug is.) **To Reproduce** ```python from typing import Callable, cast import os import re import sys import time import click...
Ref https://github.com/python/mypy/issues/12056 cc @JukkaL Again, let's check the primer...
Hello folks. I'm working on a plugin that uses `get_dynamic_class_hook` to construct type constructors (`TypeInfo`) and class definitions (`ClassDef`) that don't exist in a module. I add these definitions to...
Fixes: #17333 This ensures `can_be_true` and `can_be_false` on enum literals depends on the specific `Enum` fallback type behind the `Literal`, since `__bool__` can be overriden like on any other type....
Fixes #14571. When type checking a call of a `ParamSpec`-typed callable, currently there is an incorrect "fast path" (if there are two arguments of shape `(*args: P.args, **kwargs: P.kwargs)`, accept),...
- Fixes another crash case / type inference in that case - Fix a false positive when calling the partially applied function with kwargs - TypeTraverse / comment / daemon...
Using a Metaclass to define dynamic **class** (not instance) attributes raises `name-defined` error when trying to use an attribute as a type. **To Reproduce** Gist URL: https://gist.github.com/mypy-play/bb0277c6f339cbf374a1d2288cb7d5e6 Playground URL: https://mypy-play.net/?mypy=latest&python=3.12&gist=bb0277c6f339cbf374a1d2288cb7d5e6...
**Bug Report** Although #4043 has been fixed by #4045, it has adverse impact on performance. It results in multiple modules being checked unnecessarily. To repeat the example from #4043: ```...
**Feature** mypy currently infers the type of `attrs.fields(foo)` as `Any`, where `foo` is an instance of an `attrs` class. Is it possible to have mypy infer the correct type? With...
**Bug Report** `Iterator` doesn't require a return statement except when used in an union. **To Reproduce** ```python from typing import Iterator, Union Type = Union[Iterator[int], int] def foo() -> Type:...