-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the "Argument must be a mapping" error message #12070
Comments
Yes, we should improve this. PR welcome! |
@JelleZijlstra |
Go for it! I haven't looked at the code for this error, but here's what I would do:
|
@JelleZijlstra |
Hi @JelleZijlstra, I am new to open source and really interested to contribute my favorite language i.e python, may I work on this issue or could you please suggest any other beginner-friendly issue to start with. Thanks!! |
This is a pretty good one to start! Everyone reading this should feel free to go ahead, start coding, and submit a PR. |
Thanks @JelleZijlstra |
Hello, even i am a beginner to open source contribution, found this good-first-issue, so i have managed to find the file where we raise the issue 'Argument after ** must be a mapping' but i don't know what grepping is, how it is done, also how can i debug the process step by step, i know the python lib 'pdb' for debugging but how do i call it with mypy |
Feature
This could also be classified as a bug report, but it's also a feature request. Consider code like this:
Now, this is obviously wrong on purpose, and in latest MyPy, results in this error message:
The problem with this message is that, it doesn't say what exactly is wrong, unlike when you normally mismatch types where it says:
Argument 1 to "test" has incompatible type "Union[int, str]"; expected "bool"
, for example. In my case, I had a variable with the same name inferringOptional[Any]
higher up in the code, and tracking down the root cause took me good 10 minutes,Pitch
Even though
**kwargs
usage like this is uncommon, having a similarly improved message would help with debugging why this may be happening. Something like:Argument after ** to "test" has incompatible type "Union[Any, None]", expected "Mapping[str, Any]"
should help a lot.The text was updated successfully, but these errors were encountered: