Skip to content
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

Added error code for overlapping function signatures #17597

Merged
merged 15 commits into from
Sep 18, 2024

Conversation

katconnors
Copy link
Contributor

Closes #17570. This is my first contribution to mypy! 🐍
Added an error code for overlapping function signatures.
Test in check-errorcodes.test is a derivative of this post: https://stackoverflow.com/q/69341607

@katconnors
Copy link
Contributor Author

mypy_primer (2) timed out- wonder if it had the same issue as here:
#17588 (comment)

This comment has been minimized.

mypy/errorcodes.py Outdated Show resolved Hide resolved
katconnors and others added 2 commits July 29, 2024 16:54
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

This comment has been minimized.

mypy/checker.py Outdated Show resolved Hide resolved
mypy/errorcodes.py Outdated Show resolved Hide resolved
docs/source/error_code_list.rst Outdated Show resolved Hide resolved

This comment has been minimized.

@katconnors
Copy link
Contributor Author

@JelleZijlstra made the requested changes, if you don't mind taking another look. Thanks in advance!

mypy/message_registry.py Outdated Show resolved Hide resolved
mypy/errorcodes.py Outdated Show resolved Hide resolved
docs/source/error_code_list.rst Outdated Show resolved Hide resolved
docs/source/error_code_list.rst Outdated Show resolved Hide resolved

This comment has been minimized.

@katconnors
Copy link
Contributor Author

Gentle reminder for review, @JelleZijlstra or @AlexWaygood. Thanks both!

docs/source/error_code_list.rst Outdated Show resolved Hide resolved
docs/source/error_code_list.rst Outdated Show resolved Hide resolved
docs/source/error_code_list.rst Outdated Show resolved Hide resolved
katconnors and others added 3 commits September 13, 2024 16:09
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

pydantic (https://github.com/pydantic/pydantic)
- pydantic/experimental/pipeline.py:209: error: Overloaded function signature 10 will never be matched: signature 8's parameter type(s) are the same or broader  [misc]
+ pydantic/experimental/pipeline.py:209: error: Overloaded function signature 10 will never be matched: signature 8's parameter type(s) are the same or broader  [overload-cannot-match]
- pydantic/experimental/pipeline.py:212: error: Overloaded function signature 11 will never be matched: signature 8's parameter type(s) are the same or broader  [misc]
+ pydantic/experimental/pipeline.py:212: error: Overloaded function signature 11 will never be matched: signature 8's parameter type(s) are the same or broader  [overload-cannot-match]
- pydantic/experimental/pipeline.py:215: error: Overloaded function signature 12 will never be matched: signature 8's parameter type(s) are the same or broader  [misc]
+ pydantic/experimental/pipeline.py:215: error: Overloaded function signature 12 will never be matched: signature 8's parameter type(s) are the same or broader  [overload-cannot-match]
- pydantic/experimental/pipeline.py:218: error: Overloaded function signature 13 will never be matched: signature 8's parameter type(s) are the same or broader  [misc]
+ pydantic/experimental/pipeline.py:218: error: Overloaded function signature 13 will never be matched: signature 8's parameter type(s) are the same or broader  [overload-cannot-match]

pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ pandas-stubs/io/excel/_base.pyi:123: error: Unused "type: ignore" comment, use narrower [overload-cannot-match] instead of [misc] code  [unused-ignore]

discord.py (https://github.com/Rapptz/discord.py)
- discord/guild.py:3061: error: Overloaded function signature 3 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ discord/guild.py:3061: error: Overloaded function signature 3 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]
- discord/guild.py:3076: error: Overloaded function signature 4 will never be matched: signature 2's parameter type(s) are the same or broader  [misc]
+ discord/guild.py:3076: error: Overloaded function signature 4 will never be matched: signature 2's parameter type(s) are the same or broader  [overload-cannot-match]
- discord/ext/commands/core.py:1484: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ discord/ext/commands/core.py:1484: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]
- discord/ext/commands/core.py:1544: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ discord/ext/commands/core.py:1544: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]

pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
- pytest_robotframework/__init__.py:338: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ pytest_robotframework/__init__.py:338: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]
- pytest_robotframework/__init__.py:472: error: Overloaded function signature 5 will never be matched: signature 4's parameter type(s) are the same or broader  [misc]
+ pytest_robotframework/__init__.py:472: error: Overloaded function signature 5 will never be matched: signature 4's parameter type(s) are the same or broader  [overload-cannot-match]
- pytest_robotframework/__init__.py:476: error: Overloaded function signature 6 will never be matched: signature 4's parameter type(s) are the same or broader  [misc]
+ pytest_robotframework/__init__.py:476: error: Overloaded function signature 6 will never be matched: signature 4's parameter type(s) are the same or broader  [overload-cannot-match]
- pytest_robotframework/__init__.py:476: error: Overloaded function signature 6 will never be matched: signature 5's parameter type(s) are the same or broader  [misc]
+ pytest_robotframework/__init__.py:476: error: Overloaded function signature 6 will never be matched: signature 5's parameter type(s) are the same or broader  [overload-cannot-match]

pandera (https://github.com/pandera-dev/pandera)
+ pandera/schema_inference/pandas.py:25: error: Unused "type: ignore" comment, use narrower [overload-cannot-match] instead of [misc] code  [unused-ignore]

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/utilities/asyncutils.py:323: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ src/prefect/utilities/asyncutils.py:323: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]
- src/prefect/client/schemas/objects.py:196: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [misc]
+ src/prefect/client/schemas/objects.py:196: error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader  [overload-cannot-match]

antidote (https://github.com/Finistere/antidote)
- src/antidote/lib/interface_ext/__init__.py:1303: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [misc]
+ src/antidote/lib/interface_ext/__init__.py:1303: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [overload-cannot-match]
- src/antidote/lib/interface_ext/__init__.py:1335: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [misc]
+ src/antidote/lib/interface_ext/__init__.py:1335: error: Overloaded function signature 4 will never be matched: signature 3's parameter type(s) are the same or broader  [overload-cannot-match]

@katconnors
Copy link
Contributor Author

Looks like checks have passed, and this can be merged when someone has time.

@JelleZijlstra JelleZijlstra merged commit 4554bd0 into python:master Sep 18, 2024
20 checks passed
@katconnors katconnors deleted the issue-17570-error-code branch September 18, 2024 21:32
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.

Use a more specific error code for overlapping function signatures
3 participants