mypy
mypy copied to clipboard
Optional static typing for Python
This is a feature request From the docs https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks > More specifically, mypy will understand the use of sys.version_info and sys.platform checks within if/elif/else statements. and > As a special...
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues Please...
**Bug Report** With the latest mypy 1.11.0, it reports errors for awaiting an awaitable object. For previous versions, there was no error. **To Reproduce** ```python from typing import Any, Awaitable,...
This PR fixes some points of #14033: * Give metaclass errors to their own error code (I chose `metaclass`). * Document shortcomings of and workarounds for mypy's metaclass handling. I...
**Bug Report** When using if-statements, the type is being properly narrowed depending on the conditions checked. mypy seems unable to do the same type of narrowing in a match statement...
Refs https://github.com/python/mypy/issues/17264 I will add docs in a separate PR.
**Bug Report** When importing lastest version of numpy>=2.0.0, report "AssertionError: Internal error: unresolved placeholder type None" when using stubgen. The error looks like this: ``` Traceback (most recent call last):...
**Bug Report** If a subclass of an ABC implements an `abstractmethod` as an attribute (e.g. not as method or class variable), (and the subclass is instantiated,) then mypy passes. But...
``` from typing import Any, TypedDict class _SessionData(TypedDict): created: int session: dict[str, Any] class _EmptyDict(TypedDict): """Empty dict for typing.""" SessionData = _SessionData | _EmptyDict data: SessionData reveal_type(data) a = data...
Fixes #17706 Handles recursion error during parse of too complex expressions, differentiates from internal recursion errors by attempting to unparse the ast. If builtin ast.unparse fails, then the error is...