mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** Given a protocol with just a read-only property, mypy allows it to bind to a class with that property declared as a `ClassVar`, but not with it declared...
**Bug Report** If there is a function that takes `*args: Iterable[float]` as an argument, mypy still thinks it is a tuple of iterates after converting it to tuple of tuple...
Despite having: ``` class g(): ... def __getitem__(self, index): # type: (Union[int, slice, Callable]) -> Union[IterableWrapper, Any] ``` Running mypy triggers "error: Slice index must be an integer or None"...
(Not sure if it should be here or in typing) Consider this function: ```python def f(): return "hello" def g(x): if x: return A(1) else: return A(2) ``` `f` obviously...
See [this code](https://mypy-play.net/?mypy=master&python=3.12&gist=bf61d4531945848c1732335981e3396d). ```python from typing import TypeVar T = TypeVar("T", list, dict) def ctor(cls: type[T]) -> T: return cls() def ctor_union(cls: type[list] | type[dict]) -> list | dict: return...
**Bug Report** We want to indicate that a (super-)class must implement a specific protocol in order to inherit from a specific (sub-) class. We used to annotate `self` as the...
1. Fix wrong error location when assignment errors is due to `__set__`. Presently, the error location appears on the right: ```python # mypy: pretty=True import typing as t class desc:...
Fixes #17036 When a union includes `None`, new users may not know they need an `is not None` check before accessing attributes. For example, the following code: ``` class A:...
I don't think Dropbox's plugin still works on any recent version of PyCharm, which means Robert Leinardi's is the only functional plugin left.