Add function definition notes for too_many_positional_arguments errors#21410
Add function definition notes for too_many_positional_arguments errors#21410KevinRK29 wants to merge 1 commit into
too_many_positional_arguments errors#21410Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: urllib3 (https://github.com/urllib3/urllib3)
+ test/with_dummyserver/test_poolmanager.py:659: note: "request" defined in "urllib3"
+ test/with_dummyserver/test_poolmanager.py:659: note: Error code "call-arg" not covered by "type: ignore[misc]" comment
core (https://github.com/home-assistant/core)
+ homeassistant/components/http/__init__.py:493: note: "HTTPRedirection" defined in "aiohttp.web_exceptions"
+ homeassistant/components/http/__init__.py:493: note: Error code "call-arg" not covered by "type: ignore[arg-type, misc]" comment
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/test_string_accessors.py:226: note: "wrap" defined in "pandas.core.strings.accessor"
+ tests/test_string_accessors.py:226: note: Error code "call-arg" not covered by "type: ignore[misc]" comment
+ tests/test_string_accessors.py:284: note: "wrap" defined in "pandas.core.strings.accessor"
+ tests/test_string_accessors.py:284: note: Error code "call-arg" not covered by "type: ignore[misc]" comment
cryptography (https://github.com/pyca/cryptography)
+ tests/hazmat/primitives/test_kbkdf.py:358: note: "KBKDFHMAC" defined in "cryptography.hazmat.bindings._rust.openssl.kdf"
+ tests/hazmat/primitives/test_kbkdf.py:808: note: "KBKDFCMAC" defined in "cryptography.hazmat.bindings._rust.openssl.kdf"
xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_groupby.py: note: In function "test_multiple_groupers_string":
+ xarray/tests/test_groupby.py:2980: note: "groupby" defined in "xarray.core.dataarray"
+ xarray/tests/test_groupby.py:2980: note: Error code "call-arg" not covered by "type: ignore[arg-type, misc]" comment
+ xarray/tests/test_groupby.py: note: At top level:
|
| @@ -972,6 +972,7 @@ def too_many_positional_arguments(self, callee: CallableType, context: Context) | |||
| msg = "Too many positional arguments" + for_function(callee) | |||
| self.fail(msg, context) | |||
There was a problem hiding this comment.
Looking at the primer, I think I may need to change it to self.fail(msg, context, code=codes.CALL_ARG) similar to the error cases above?
There was a problem hiding this comment.
Usually we try to avoid changing the error code. But in this case this looks like an oversight. I leave this up to @JukkaL to decide.
There was a problem hiding this comment.
Let's try switching to CALL_ARG and see if the mypy primer looks any worse. The current error code is inconsistent, so it's reasonable to change it if it doesn't cause a big fallout. If there are many new errors, we can use the misc error code for the note as well -- they both need to use the same error code.
Followup to #20794
Adds the "foo" is defined in "bar" note for the
too_many_positional_argumentserror case