-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
error message: move star prefix to Argument #13146
Open
reka
wants to merge
1
commit into
python:master
Choose a base branch
from
reka:kwargs-error-message
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Move * or ** prefix from argument type to "Argument". Example ------------ Before: ``` Argument 1 to "g" has incompatible type "**Dict[str, object]" ``` After: ``` **Argument 1 to "g" has incompatible type "Dict[str, object]" ```
Diff from mypy_primer, showing the effect of this PR on open source code: vision (https://github.com/pytorch/vision)
- torchvision/datasets/utils.py:71: error: Argument 1 to "md5" has incompatible type "**Dict[str, bool]"; expected "Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]]" [arg-type]
+ torchvision/datasets/utils.py:71: error: **Argument 1 to "md5" has incompatible type "Dict[str, bool]"; expected "Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]]" [arg-type]
pyppeteer (https://github.com/pyppeteer/pyppeteer)
- pyppeteer/launcher.py:149: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "int"
+ pyppeteer/launcher.py:149: error: **Argument 2 to "Popen" has incompatible type "Dict[str, Optional[Any]]"; expected "int"
- pyppeteer/launcher.py:149: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "bool"
+ pyppeteer/launcher.py:149: error: **Argument 2 to "Popen" has incompatible type "Dict[str, Optional[Any]]"; expected "bool"
- pyppeteer/launcher.py:149: error: Argument 2 to "Popen" has incompatible type "**Dict[str, Optional[Any]]"; expected "str"
+ pyppeteer/launcher.py:149: error: **Argument 2 to "Popen" has incompatible type "Dict[str, Optional[Any]]"; expected "str"
discord.py (https://github.com/Rapptz/discord.py)
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "str"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "str"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Iterable[str]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Iterable[str]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "float"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "float"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[float]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[float]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "bool"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "bool"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[BasicAuth]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[BasicAuth]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[str]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[str]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[Mapping[str, str]]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[Mapping[str, str]]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[Mapping[Union[str, istr], str], CIMultiDict[str], CIMultiDictProxy[str], None]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[Mapping[Union[str, istr], str], CIMultiDict[str], CIMultiDictProxy[str], None]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[str, URL, None]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[str, URL, None]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[SSLContext, bool, Fingerprint, None]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Union[SSLContext, bool, Fingerprint, None]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[bool]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[bool]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[bytes]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[bytes]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[SSLContext]"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "Optional[SSLContext]"
- discord/http.py:376: error: Argument 2 to "ws_connect" of "ClientSession" has incompatible type "**Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "int"
+ discord/http.py:376: error: **Argument 2 to "ws_connect" of "ClientSession" has incompatible type "Dict[str, Union[Dict[str, str], float, BasicAuth, None, str]]"; expected "int"
- discord/client.py:666: error: Argument 2 to "from_client" of "DiscordWebSocket" has incompatible type "**Dict[str, Optional[int]]"; expected "bool"
+ discord/client.py:666: error: **Argument 2 to "from_client" of "DiscordWebSocket" has incompatible type "Dict[str, Optional[int]]"; expected "bool"
- discord/client.py:666: error: Argument 2 to "from_client" of "DiscordWebSocket" has incompatible type "**Dict[str, Optional[int]]"; expected "Optional[str]"
+ discord/client.py:666: error: **Argument 2 to "from_client" of "DiscordWebSocket" has incompatible type "Dict[str, Optional[int]]"; expected "Optional[str]"
|
Thanks for the PR! I think that the error message would be a little clearer like this:
We can use this message for both |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move * or ** prefix from argument type to "Argument".
Example
Before:
After:
Description
This is the 1st step to fix #8874 :
Move * or ** prefix from argument type to "Argument".
Further possible steps:
Squash all error messages related to the same argument into one error message.
Add a note with possible fixes:
Test Plan