mypy
mypy copied to clipboard
Optional static typing for Python
This was originally reported in https://github.com/python/mypy/issues/3644#issuecomment-825494986 ``` from typing import Callable, TypeVar, Generic, Union _U = TypeVar('_U') _T = TypeVar('_T') class Future(Generic[_T]): def __init__(self, t: _T): self._t = t def...
### Repro In `file.py`: ```python import other ``` In `other` (no file extension): ```shell #!/bin/sh echo syntax error ``` Running: ``` $ mypy file.py other:3: error: invalid syntax [syntax] Found...
**Bug Report** In pandas-stubs, we'd like to be able to have a class that can be passed to the standard python `sorted()`, `max()`, `min()` functions, etc. But mypy doesn't seem...
**Bug Report** PEP 604 introduced the `|` syntax, however it's not entirely equivalent to the `Union` syntax. Forward references with `|` are not supported and result in TypeErrors `TypeError: unsupported...
**Bug Report** When I transform a value into an enum, an error occurs in the `match case` construct. If you convert the value in advance, there will be no error....
Avoid false "Incompatible return value type" errors when dealing with `isinstance`, constrained type variables and multiple inheritance (Fixes #13800). The idea is to make a union of the current expanded...
I'm seeing an Incompatible return value type error in 0.981 that wasn't present in previous versions of mypy. **To Reproduce** ```python from typing import TypeVar T = TypeVar("T", dict, float)...
The calls to `f` and `ff` below aren't rejected when using `--disallow-untyped-calls`, even though I believe that they should be: ```py from typing import Any from non_existent import f #...
**Bug Report** I've been trying to mypy to typecheck subclasses that need to provide a required value for a `ClassVar` in a base class that cannot provide the value itself...
**Bug Report** If i have `python_version = 3.5` set, it's not possible to tell mypy to ignore related syntax errors it finds in dependencies. Use case: i have code which...