fix: use "parameter" instead of "argument" in missing-self error message#21121
Open
nuglifeleoji wants to merge 1 commit intopython:masterfrom
Open
fix: use "parameter" instead of "argument" in missing-self error message#21121nuglifeleoji wants to merge 1 commit intopython:masterfrom
nuglifeleoji wants to merge 1 commit intopython:masterfrom
Conversation
The error message for methods defined without any parameters said 'argument' but the correct term in the context of a function definition is 'parameter'. Update the message and all related test fixtures. Closes python#20939 Made-with: Cursor
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/interfaces.py:113: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:113: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:144: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:144: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:164: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:164: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:181: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:181: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:399: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:399: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:423: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:423: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:427: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:427: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:464: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:464: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:1250: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:1250: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:1334: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:1334: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:1425: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:1425: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/interfaces.py:1503: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/interfaces.py:1503: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/sequence.py:158: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/sequence.py:158: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:83: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:83: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:87: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:87: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:91: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:91: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:95: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:95: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:117: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:117: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:136: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:136: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/mapping.py:156: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/mapping.py:156: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:83: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:83: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:139: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:139: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:148: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:148: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:155: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:155: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:164: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:164: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:173: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:173: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:192: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:192: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:199: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:199: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:202: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:202: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:234: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:234: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:257: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:257: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:343: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:343: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:346: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:346: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:354: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:354: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:402: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:402: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:406: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:406: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:411: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:411: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:414: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:414: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:417: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:417: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:420: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:420: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:426: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:426: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:433: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:433: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:441: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:441: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:462: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:462: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:469: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:469: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:535: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:535: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:544: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:544: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:553: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:553: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:563: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:563: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/idatetime.py:573: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/idatetime.py:573: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
- src/zope/interface/common/tests/test_collections.py:132: error: Method must have at least one argument. Did you forget the "self" argument? [misc]
+ src/zope/interface/common/tests/test_collections.py:132: error: Method must have at least one parameter. Did you forget the "self" parameter? [misc]
|
This file contains hidden or 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
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.
Fixes #20939.
The error message for methods defined without any parameters:
uses the word argument, but in the context of a function definition the correct term is parameter. Updated the message to:
Updated the source string in
mypy/checker.pyand all matching test fixtures.Made with Cursor