mypy
mypy copied to clipboard
Optional static typing for Python
Mypy does not detect the case where a covariant or contravariant class (i.e. a class that is parameterized by a class-scoped covariant or contravariant TypeVar) derives from an invariant class....
**Bug Report** Mypy cannot determine the type of the declared field inside a protocol method. **To Reproduce** Invoke mypy on the following Python file ```python # bug.py from typing import...
**Bug Report** Defining a TypeGuard for callable to check if coroutine doesn't work when passed a generic callable with Concatenate. **To Reproduce** 1. Write this code ``` _PArgs = ParamSpec("_PArgs")...
**Bug Report** When a decorator function hinted to return a callable with any result type effectively returns a callable with more specific return type there's a mypy error. **To Reproduce**...
**Bug Report** When using `Union[Iterable[int], Dict[str, int]]` together with `isinstance(x, Iterable)` in a conditional, the narrowing of the type does not work as expected. The previously correctly narrowed type is...
**Bug Report** I wanted to have a quick way of concatenating results of several mixin-like implementations of similar algorithms. Below is a MWE of what I wanted to implement **To...
### Description Note: This change is part of a series of upcoming MRs to improve `stubgenc`. `stubgenc` tries 3 approaches to infer signatures for a function. There are two problems...
**Feature** The only way I've been able to set the dmypy status file is by passing `--status-file` on the command-line, but I'm running dmypy in a few different scripts and...
This fine-grained incremental test case fails (no error on second run): ``` [case testDecoratedToAsyncReExported] from mm import f x: int = f() [file mm.py] from m import f [file m.py]...
`sus.py`: ```py def f() -> None: ... ``` `amongus.py`: ```py from sus import f f(x=1) ``` ``` 👉 mypy -m amongus amongus.py:2:1: error: Unexpected keyword argument "x" for "f" [call-arg]...