Skip to content

fix: use "parameter" instead of "argument" in missing-self error message#21121

Open
nuglifeleoji wants to merge 1 commit intopython:masterfrom
nuglifeleoji:fix/method-self-parameter-message
Open

fix: use "parameter" instead of "argument" in missing-self error message#21121
nuglifeleoji wants to merge 1 commit intopython:masterfrom
nuglifeleoji:fix/method-self-parameter-message

Conversation

@nuglifeleoji
Copy link
Copy Markdown
Contributor

Fixes #20939.

The error message for methods defined without any parameters:

error: Method must have at least one argument. Did you forget the "self" argument?

uses the word argument, but in the context of a function definition the correct term is parameter. Updated the message to:

error: Method must have at least one parameter. Did you forget the "self" parameter?

Updated the source string in mypy/checker.py and all matching test fixtures.

Made with Cursor

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
@github-actions
Copy link
Copy Markdown
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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A method with no parameter gets a wrong error message saying argument instead of parameter

1 participant