You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect behavior for functions with keyword-only arguments and **kwargs #15317
Bug Report
mypy reports a arg-type error Argument 2 to "send_command" has incompatible type "**Dict[str, object]"; expected "Optional[float]" [arg-type] for a valid function invocation.
Reacted by tonkolviktor, deadnews, Arne de Laat, Ronnie Dutta, Eugene Gubenkov, Jonathan Green, Donal Fellows, David Chen, Ján Sakáloš and Beniamin Kalinowski
This adds a bit of verbosity and for frequently used functions it might be problematic, but maybe it can help someone (I solved my problem, since I have this situation only in one place).
Activity
aripollak commentedon Jul 12, 2023
I think #11583 might also be somewhat related.
delicb commentedon Jan 2, 2024
I just bumped into the same problem. After some digging, I found a workaround - create
TypedDictwithkwargsand explicitly annotatekwargsdict with it. In case of original problem it would look like this: https://mypy-play.net/?mypy=latest&python=3.11&gist=d0a3e2279a7a6147541570967634f0daThis adds a bit of verbosity and for frequently used functions it might be problematic, but maybe it can help someone (I solved my problem, since I have this situation only in one place).