Repository navigation
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: prefect (https://github.com/PrefectHQ/prefect)
+ src/prefect/input/run_input.py:527: error: Redundant cast to "type[AutomaticRunInput[T]]" [redundant-cast]
openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/solr/data_provider.py: note: In member "get_work_reading_log" of class "DatabaseDataProvider":
+ openlibrary/solr/data_provider.py:569: error: Argument 1 to "sum" has incompatible type "dict_values[str, object]"; expected "Iterable[bool]" [arg-type]
colour (https://github.com/colour-science/colour)
+ colour/plotting/volume.py:506: error: Redundant cast to "list[RGB_Colourspace]" [redundant-cast]
+ colour/plotting/models.py:539: error: Redundant cast to "list[RGB_Colourspace]" [redundant-cast]
+ colour/plotting/colorimetry.py:532: error: Redundant cast to "list[MultiSpectralDistributions]" [redundant-cast]
+ colour/plotting/colorimetry.py:698: error: Redundant cast to "list[SpectralDistribution]" [redundant-cast]
antidote (https://github.com/Finistere/antidote)
+ tests/core/test_exceptions.py:13: error: Redundant cast to "list[Callable[[object], str]]" [redundant-cast]
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
+ pytest_robotframework/_internal/robot/utils.py:232: error: Redundant cast to "list[object] | None" [redundant-cast]
core (https://github.com/home-assistant/core)
+ homeassistant/components/history/__init__.py:130: error: Redundant cast to "Response" [redundant-cast]
+ homeassistant/components/deconz/light.py:138: error: Redundant cast to "dict[str, dict[str, Any]]" [redundant-cast]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ tests/series/test_add.py:49: error: Unused "type: ignore" comment [unused-ignore]
cwltool (https://github.com/common-workflow-language/cwltool)
+ cwltool/builder.py: note: In member "generate_arg" of class "Builder":
+ cwltool/builder.py:636:28: error: Redundant cast to "list[str]" [redundant-cast]
pandas (https://github.com/pandas-dev/pandas)
+ pandas/core/dtypes/concat.py:358: error: Redundant cast to "list[Categorical]" [redundant-cast]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/embed/resources.py: note: In member "union" of class "ResourceRequirements":
+ src/bokeh/embed/resources.py:262:22: error: Redundant cast to "tuple[Literal['bokeh/core', 'bokeh/widgets', 'bokeh/tables', 'bokeh/webgl', 'bokeh/mathjax', 'bokeh/api'], ...]" [redundant-cast]
anyio (https://github.com/agronholm/anyio)
+ src/anyio/_backends/_asyncio.py:2791: error: Redundant cast to "tuple[Transport, StreamProtocol]" [redundant-cast]
kopf (https://github.com/nolar/kopf)
+ kopf/_core/engines/posting.py:119: error: Argument 1 to "walk" has incompatible type "Body | Iterable[Body]"; expected "Iterable[Never] | Iterable[Iterable[Never]]" [arg-type]
+ kopf/_core/engines/posting.py:134: error: Argument 1 to "walk" has incompatible type "Body | Iterable[Body]"; expected "Iterable[Never] | Iterable[Iterable[Never]]" [arg-type]
+ kopf/_core/engines/posting.py:149: error: Argument 1 to "walk" has incompatible type "Body | Iterable[Body]"; expected "Iterable[Never] | Iterable[Iterable[Never]]" [arg-type]
+ kopf/_core/engines/posting.py:169: error: Argument 1 to "walk" has incompatible type "Body | Iterable[Body]"; expected "Iterable[Never] | Iterable[Iterable[Never]]" [arg-type]
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/utils/universal.py:1918:16: error: Redundant cast to "list[_T]" [redundant-cast]
+ mesonbuild/build.py:1644:33: error: Redundant cast to "list[str | None]" [redundant-cast]
paasta (https://github.com/yelp/paasta)
+ paasta_tools/utils.py:4281: error: Redundant cast to "list[str]" [redundant-cast]
|
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.
When a generic function accepts a callable factory, checking its result under an
Anycontext can erase inferred type arguments and hide a cast whose target matches the result type.Check cast operands without an expected type and add regression coverage for this generic callable case.
Verified with
python runtests.py check-warnings.test,python runtests.py testCastToSuperclassNotRedundant, Black, and Ruff.LLM-assisted: prepared and verified with OpenAI Codex.
Fixes #22509