mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** Mypy complains when default an unpacked TypeVarTuple (`tuple[*Ts]`) to an empty tuple, but accepts one as input, which seems a conflicting behaviour at least. **To Reproduce** https://mypy-play.net/?mypy=latest&python=3.12&gist=9c2fa71781c45ed24b1901b8e9252e64 ```python...
(Forwarded from https://github.com/python/typing/issues/1523) I'm trying to annotate a method that only accepts a union of specific types, with the types specified via variadic generic. Although mypy supports variadic unpacking like...
**Bug Report** `operator.call` and similar `ParamSpec` callables (e.g. `concurrent.futures.Executor.submit`) produce an `arg-type` error when doing `call(fn, fn2, some_kwarg=...)` where `fn` has signature `(fn2: Callable[[Unpack[Ts]], T], *args: Unpack[Ts], some_kwarg: ...) ->...
```py # mypy: disable-error-code=empty-body from typing import Any, Protocol, Unpack, TypeVarTuple Ts = TypeVarTuple("Ts") class A1(Protocol[Unpack[Ts]]): def f(self, *args: Unpack[Ts]) -> None: ... class B1: def f(self, x: str) ->...
**Bug Report** Looks like pytest fails in few units. **To Reproduce** I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test...
It's time for the next public release! I'll probably cut the branch at https://github.com/python/mypy/commit/43a605f742bd554acbdff9bea74c764621e3aa44. If there's any fixes or really important changes you'd like to make the cut, please post...
Enables the narrowing of variable types when checking a variable is "in" a collection, and the collection type is a subtype of the variable type. Fixes #3229 (Explain how this...
**Bug Report** MyPy doesn't raise a warning if you pass in an class implementation that enforces positional arguments on a method, for a protocol that does not. **To Reproduce** Example...
Fixes #12046 It does not raise "already defined" fail if already existing node is `InitVar`, so name of the property will be redefined. Then, when getting the method of that...
```py # Some stub from typing import TypeVar T = TypeVar("T") def something(x: T = ...) -> T: """x, the parameter for everything (formally Twitter)""" # some other file f:...