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

Consider overlap between instances and callables #17389

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

ilevkivskyi
Copy link
Member

Fixes #8869

The fix seems straightforward.

This comment has been minimized.

Copy link
Contributor

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

psycopg (https://github.com/psycopg/psycopg)
+ tests/test_cursor_server.py:27: error: Unused "type: ignore" comment  [unused-ignore]
+ tests/test_cursor_server_async.py:28: error: Unused "type: ignore" comment  [unused-ignore]

steam.py (https://github.com/Gobot1234/steam.py)
+ steam/ext/commands/commands.py:553: error: Too many arguments for "object"  [call-arg]

antidote (https://github.com/Finistere/antidote)
- src/antidote/lib/lazy_ext/_lazy.py:171: error: Non-overlapping identity check (left operand type: "Literal[FunctionKind.VALUE]", right operand type: "Literal[FunctionKind.METHOD]")  [comparison-overlap]
- src/antidote/lib/lazy_ext/_lazy.py:174: error: Unused "type: ignore" comment  [unused-ignore]
- src/antidote/lib/lazy_ext/_lazy.py:178: error: Non-overlapping identity check (left operand type: "Literal[FunctionKind.VALUE]", right operand type: "Literal[FunctionKind.PROPERTY]")  [comparison-overlap]
- src/antidote/lib/lazy_ext/_lazy.py:181: error: Unused "type: ignore" comment  [unused-ignore]
- src/antidote/lib/lazy_ext/_lazy.py:185: error: Non-overlapping identity check (left operand type: "Literal[FunctionKind.VALUE]", right operand type: "Literal[FunctionKind.FUNCTION]")  [comparison-overlap]
+ src/antidote/lib/interface_ext/__init__.py:1289: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [overload-overlap]
+ src/antidote/lib/interface_ext/__init__.py:1321: error: Overloaded function signatures 1 and 5 overlap with incompatible return types  [overload-overlap]
- tests/lib/interface/test_function.py:83: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:86: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:89: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:154: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:191: error: Unused "type: ignore" comment  [unused-ignore]
- tests/lib/interface/test_function.py:194: error: Unused "type: ignore" comment  [unused-ignore]

tornado (https://github.com/tornadoweb/tornado)
+ tornado/test/ioloop_test.py:55: error: Unused "type: ignore" comment  [unused-ignore]
+ tornado/test/ioloop_test.py:56: error: Unused "type: ignore" comment  [unused-ignore]

operator (https://github.com/canonical/operator)
- ops/framework.py:799: error: Unused "type: ignore" comment  [unused-ignore]
- ops/framework.py:818: error: Unused "type: ignore" comment  [unused-ignore]

spark (https://github.com/apache/spark)
- python/pyspark/sql/worker/write_into_data_source.py:157: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/sql/worker/write_into_data_source.py:164: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/sql/worker/create_data_source.py:131: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/sql/worker/create_data_source.py:156: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/sql/worker/create_data_source.py:166: error: Unused "type: ignore" comment  [unused-ignore]
- python/pyspark/sql/worker/create_data_source.py:168: error: Unused "type: ignore" comment  [unused-ignore]

@ilevkivskyi
Copy link
Member Author

Most things in the mypy_primer are correct. The overload issues is annoying, I am actually going to re-design the whole overload overlap thing, PR incoming.

@hauntsaninja hauntsaninja merged commit e1ff8aa into python:master Jun 19, 2024
18 checks passed
@ilevkivskyi ilevkivskyi deleted the allow-call-overlap branch June 19, 2024 18:19
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.

MethodType incorrectly rejected as subtype of Callable
2 participants