gh-15770: Use TypeForm in __class_getitem__ signatures#15776
Draft
Andrew5057 wants to merge 4 commits into
Draft
gh-15770: Use TypeForm in __class_getitem__ signatures#15776Andrew5057 wants to merge 4 commits into
Andrew5057 wants to merge 4 commits into
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: static-frame (https://github.com/static-frame/static-frame)
+ static_frame/core/type_clinic.py:786: error: Argument 1 to "__class_getitem__" of "tuple" has incompatible type "tuple[Any, ...]"; expected "TypeForm[Any]" [arg-type]
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/conftest.py:347: error: Definition of "__class_getitem__" in base class "dict" is incompatible with definition in base class "spmatrix" [misc]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/ext/commands/converter.py:1143: error: Argument 1 of "__class_getitem__" is incompatible with supertype "builtins.list"; supertype defines the argument type as "TypeForm[Any]" [override]
+ discord/ext/commands/converter.py:1143: note: This violates the Liskov substitution principle
+ discord/ext/commands/converter.py:1143: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
cwltool (https://github.com/common-workflow-language/cwltool)
+ .../projects/_cwltool_venv/lib/python3.13/site-packages/galaxy/tool_util_models/parameter_validators.py:24: note: ... from here,
+ .../projects/_cwltool_venv/lib/python3.13/site-packages/galaxy/tool_util_models/parameters.py:57: note: ... from here,
+ .../projects/_cwltool_venv/lib/python3.13/site-packages/galaxy/tool_util_models/__init__.py:31: note: ... from here:
|
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.
Addresses #15770.
TypeFormhas been accepted for 3.15. When major type checkers adopt stable support for it (mypy is the most important holdout right now), we can hopefully start using it throughout the standard library to reject invalid parameterizations.