[ty] Fine-tune diagnostic range of unresolved-cast#24688
[ty] Fine-tune diagnostic range of unresolved-cast#24688
unresolved-cast#24688Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 87.94%. The percentage of expected errors that received a diagnostic held steady at 83.36%. The number of fully passing files held steady at 79/133. |
Memory usage reportMemory usage unchanged ✅ |
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
redundant-cast |
13 | 13 | 102 |
| Total | 13 | 13 | 102 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff (128 changes)
Expression (https://github.com/cognitedata/Expression)
- expression/core/fn.py:39:23 warning[redundant-cast] Value is already of type `TailCall[_P@tailrec]`
+ expression/core/fn.py:39:42 warning[redundant-cast] Redundant cast: value is already of type `TailCall[_P@tailrec]`
- expression/core/fn.py:58:23 warning[redundant-cast] Value is already of type `TailCall[_P@tailrec_async]`
+ expression/core/fn.py:58:42 warning[redundant-cast] Redundant cast: value is already of type `TailCall[_P@tailrec_async]`
- expression/extra/result/catch.py:40:30 warning[redundant-cast] Value is already of type `_TError@catch`
+ expression/extra/result/catch.py:40:44 warning[redundant-cast] Redundant cast: value is already of type `_TError@catch`
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/annotations.py:1611:17 warning[redundant-cast] Value is already of type `type[_T@__getitem__]`
+ tanjun/annotations.py:1611:41 warning[redundant-cast] Redundant cast: value is already of type `type[_T@__getitem__]`
altair (https://github.com/vega/altair)
- altair/utils/core.py:332:16 warning[redundant-cast] Value is already of type `bool`
+ altair/utils/core.py:332:29 warning[redundant-cast] Redundant cast: value is already of type `bool`
antidote (https://github.com/Finistere/antidote)
- src/antidote/core/_inject.py:348:19 warning[redundant-cast] Value is already of type `Any`
+ src/antidote/core/_inject.py:348:29 warning[redundant-cast] Redundant cast: value is already of type `Any`
anyio (https://github.com/agronholm/anyio)
- src/anyio/_backends/_asyncio.py:2647:31 warning[redundant-cast] Value is already of type `tuple[Transport, StreamProtocol]`
+ src/anyio/_backends/_asyncio.py:2649:13 warning[redundant-cast] Redundant cast: value is already of type `tuple[Transport, StreamProtocol]`
archinstall (https://github.com/archlinux/archinstall)
- archinstall/tui/ui/result.py:71:10 warning[redundant-cast] Value is already of type `list[ValueT@Result]`
+ archinstall/tui/ui/result.py:71:29 warning[redundant-cast] Redundant cast: value is already of type `list[ValueT@Result]`
bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/util/datatypes.py:73:13 warning[redundant-cast] Value is already of type `set[V@MultiValuedDict]`
+ src/bokeh/util/datatypes.py:73:26 warning[redundant-cast] Redundant cast: value is already of type `set[V@MultiValuedDict]`
- src/bokeh/util/datatypes.py:85:25 warning[redundant-cast] Value is already of type `set[V@MultiValuedDict]`
+ src/bokeh/util/datatypes.py:85:38 warning[redundant-cast] Redundant cast: value is already of type `set[V@MultiValuedDict]`
- src/bokeh/util/datatypes.py:95:24 warning[redundant-cast] Value is already of type `set[V@MultiValuedDict]`
+ src/bokeh/util/datatypes.py:95:37 warning[redundant-cast] Redundant cast: value is already of type `set[V@MultiValuedDict]`
- src/bokeh/util/datatypes.py:112:24 warning[redundant-cast] Value is already of type `set[V@MultiValuedDict]`
+ src/bokeh/util/datatypes.py:112:37 warning[redundant-cast] Redundant cast: value is already of type `set[V@MultiValuedDict]`
colour (https://github.com/colour-science/colour)
- colour/plotting/colorimetry.py:698:19 warning[redundant-cast] Value is already of type `list[SpectralDistribution]`
+ colour/plotting/colorimetry.py:700:9 warning[redundant-cast] Redundant cast: value is already of type `list[SpectralDistribution]`
- colour/plotting/colorimetry.py:532:12 warning[redundant-cast] Value is already of type `list[MultiSpectralDistributions]`
+ colour/plotting/colorimetry.py:532:53 warning[redundant-cast] Redundant cast: value is already of type `list[MultiSpectralDistributions]`
- colour/plotting/models.py:539:20 warning[redundant-cast] Value is already of type `list[RGB_Colourspace]`
+ colour/plotting/models.py:541:9 warning[redundant-cast] Redundant cast: value is already of type `list[RGB_Colourspace]`
- colour/plotting/volume.py:506:20 warning[redundant-cast] Value is already of type `list[RGB_Colourspace]`
+ colour/plotting/volume.py:508:9 warning[redundant-cast] Redundant cast: value is already of type `list[RGB_Colourspace]`
core (https://github.com/home-assistant/core)
- homeassistant/components/history/__init__.py:124:16 warning[redundant-cast] Value is already of type `Response`
+ homeassistant/components/history/__init__.py:126:13 warning[redundant-cast] Redundant cast: value is already of type `Response`
- homeassistant/components/sonos/number.py:144:16 warning[redundant-cast] Value is already of type `int | float`
+ homeassistant/components/sonos/number.py:144:28 warning[redundant-cast] Redundant cast: value is already of type `int | float`
- homeassistant/components/vesync/diagnostics.py:89:9 warning[redundant-cast] Value is already of type `dict[str, Any]`
+ homeassistant/components/vesync/diagnostics.py:89:30 warning[redundant-cast] Redundant cast: value is already of type `dict[str, Any]`
- homeassistant/data_entry_flow.py:355:27 warning[redundant-cast] Value is already of type `Schema`
+ homeassistant/data_entry_flow.py:355:44 warning[redundant-cast] Redundant cast: value is already of type `Schema`
cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/builder.py:637:76 warning[redundant-cast] Value is already of type `list[str]`
+ cwltool/builder.py:637:92 warning[redundant-cast] Redundant cast: value is already of type `list[str]`
- cwltool/command_line_tool.py:461:20 warning[redundant-cast] Value is already of type `str`
+ cwltool/command_line_tool.py:461:30 warning[redundant-cast] Redundant cast: value is already of type `str`
- cwltool/command_line_tool.py:463:24 warning[redundant-cast] Value is already of type `str`
+ cwltool/command_line_tool.py:463:34 warning[redundant-cast] Redundant cast: value is already of type `str`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:480:25 warning[redundant-cast] Value is already of type `_DynamoDBDeleteRequestWriteRequest`
+ ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:480:66 warning[redundant-cast] Redundant cast: value is already of type `_DynamoDBDeleteRequestWriteRequest`
- ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:551:34 warning[redundant-cast] Value is already of type `_DynamoDBTransactUpdateItem`
+ ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:551:68 warning[redundant-cast] Redundant cast: value is already of type `_DynamoDBTransactUpdateItem`
- ddtrace/contrib/internal/subprocess/patch.py:256:26 warning[redundant-cast] Value is already of type `list[str]`
+ ddtrace/contrib/internal/subprocess/patch.py:256:42 warning[redundant-cast] Redundant cast: value is already of type `list[str]`
- ddtrace/debugging/_debugger.py:536:43 warning[redundant-cast] Value is already of type `FunctionType`
+ ddtrace/debugging/_debugger.py:536:62 warning[redundant-cast] Redundant cast: value is already of type `FunctionType`
- ddtrace/debugging/_function/store.py:61:28 warning[redundant-cast] Value is already of type `FullyNamedContextWrappedFunction`
+ ddtrace/debugging/_function/store.py:61:67 warning[redundant-cast] Redundant cast: value is already of type `FullyNamedContextWrappedFunction`
- ddtrace/debugging/_origin/span.py:97:19 warning[redundant-cast] Value is already of type `EntrySpanProbe`
+ ddtrace/debugging/_origin/span.py:97:42 warning[redundant-cast] Redundant cast: value is already of type `EntrySpanProbe`
- ddtrace/debugging/_origin/span.py:199:14 warning[redundant-cast] Value is already of type `FunctionType`
+ ddtrace/debugging/_origin/span.py:199:35 warning[redundant-cast] Redundant cast: value is already of type `FunctionType`
- ddtrace/debugging/_signal/model.py:227:27 warning[redundant-cast] Value is already of type `tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None]`
+ ddtrace/debugging/_signal/model.py:227:45 warning[redundant-cast] Redundant cast: value is already of type `tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None]`
- ddtrace/internal/symbol_db/symbols.py:369:22 warning[redundant-cast] Value is already of type `Scope | None`
+ ddtrace/internal/symbol_db/symbols.py:369:48 warning[redundant-cast] Redundant cast: value is already of type `Scope | None`
- ddtrace/llmobs/_experiment.py:1902:24 warning[redundant-cast] Value is already of type `int`
+ ddtrace/llmobs/_experiment.py:1902:34 warning[redundant-cast] Redundant cast: value is already of type `int`
- ddtrace/llmobs/_experiment.py:2683:18 warning[redundant-cast] Value is already of type `int`
+ ddtrace/llmobs/_experiment.py:2683:28 warning[redundant-cast] Redundant cast: value is already of type `int`
- ddtrace/profiling/collector/memalloc.py:43:33 warning[redundant-cast] Value is already of type `int`
+ ddtrace/profiling/collector/memalloc.py:45:13 warning[redundant-cast] Redundant cast: value is already of type `int`
- ddtrace/profiling/collector/memalloc.py:42:27 warning[redundant-cast] Value is already of type `int`
+ ddtrace/profiling/collector/memalloc.py:42:37 warning[redundant-cast] Redundant cast: value is already of type `int`
- ddtrace/profiling/collector/memalloc.py:47:32 warning[redundant-cast] Value is already of type `bool`
+ ddtrace/profiling/collector/memalloc.py:47:43 warning[redundant-cast] Redundant cast: value is already of type `bool`
- tests/profiling/exporter/test_ddup.py:134:22 warning[redundant-cast] Value is already of type `Span`
+ tests/profiling/exporter/test_ddup.py:134:33 warning[redundant-cast] Redundant cast: value is already of type `Span`
dedupe (https://github.com/dedupeio/dedupe)
- dedupe/api.py:1547:17 warning[redundant-cast] Value is already of type `Literal["match", "distinct"]`
+ dedupe/api.py:1547:52 warning[redundant-cast] Redundant cast: value is already of type `Literal["match", "distinct"]`
- dedupe/datamodel.py:94:26 warning[redundant-cast] Value is already of type `(Any, Any, /) -> int | float | Sequence[int | float]`
+ dedupe/datamodel.py:94:45 warning[redundant-cast] Redundant cast: value is already of type `(Any, Any, /) -> int | float | Sequence[int | float]`
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/_launch.py:92:12 warning[redundant-cast] Value is already of type `T@value_check`
+ src/hydra_zen/_launch.py:92:20 warning[redundant-cast] Redundant cast: value is already of type `T@value_check`
- src/hydra_zen/third_party/beartype.py:130:12 warning[redundant-cast] Value is already of type `_T@validates_with_beartype`
+ src/hydra_zen/third_party/beartype.py:130:21 warning[redundant-cast] Redundant cast: value is already of type `_T@validates_with_beartype`
- src/hydra_zen/third_party/pydantic.py:122:16 warning[redundant-cast] Value is already of type `_T@pydantic_parser`
+ src/hydra_zen/third_party/pydantic.py:122:25 warning[redundant-cast] Redundant cast: value is already of type `_T@pydantic_parser`
jax (https://github.com/google/jax)
- jax/_src/pallas/mosaic/lowering.py:445:12 warning[redundant-cast] Value is already of type `Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"]`
+ jax/_src/pallas/mosaic/lowering.py:445:53 warning[redundant-cast] Redundant cast: value is already of type `Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"]`
- jax/_src/path.py:63:10 warning[redundant-cast] Value is already of type `Path`
+ jax/_src/path.py:63:29 warning[redundant-cast] Redundant cast: value is already of type `Path`
koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/dataclasses.py:117:25 warning[redundant-cast] Value is already of type `type[_DCT@DataclassValidator]`
+ koda_validate/dataclasses.py:117:42 warning[redundant-cast] Redundant cast: value is already of type `type[_DCT@DataclassValidator]`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/modules/python.py:435:21 warning[redundant-cast] Value is already of type `PythonExternalProgram`
+ mesonbuild/modules/python.py:435:53 warning[redundant-cast] Redundant cast: value is already of type `PythonExternalProgram`
- mesonbuild/options.py:676:35 warning[redundant-cast] Value is already of type `list[UserBooleanOption | UserComboOption | UserIntegerOption | ... omitted 3 union elements]`
+ mesonbuild/options.py:676:67 warning[redundant-cast] Redundant cast: value is already of type `list[UserBooleanOption | UserComboOption | UserIntegerOption | ... omitted 3 union elements]`
- mesonbuild/utils/universal.py:1697:16 warning[redundant-cast] Value is already of type `list[_T@typeslistify]`
+ mesonbuild/utils/universal.py:1697:37 warning[redundant-cast] Redundant cast: value is already of type `list[_T@typeslistify]`
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- bson/son.py:192:16 warning[redundant-cast] Value is already of type `bool`
+ bson/son.py:192:27 warning[redundant-cast] Redundant cast: value is already of type `bool`
- pymongo/asynchronous/encryption.py:154:75 warning[redundant-cast] Value is already of type `AsyncCollection[RawBSONDocument]`
+ pymongo/asynchronous/encryption.py:156:13 warning[redundant-cast] Redundant cast: value is already of type `AsyncCollection[RawBSONDocument]`
- pymongo/asynchronous/mongo_client.py:2360:16 warning[redundant-cast] Value is already of type `dict[str, Any]`
+ pymongo/asynchronous/mongo_client.py:2362:13 warning[redundant-cast] Redundant cast: value is already of type `dict[str, Any]`
- pymongo/synchronous/encryption.py:153:70 warning[redundant-cast] Value is already of type `Collection[RawBSONDocument]`
+ pymongo/synchronous/encryption.py:155:13 warning[redundant-cast] Redundant cast: value is already of type `Collection[RawBSONDocument]`
- pymongo/synchronous/mongo_client.py:2352:16 warning[redundant-cast] Value is already of type `dict[str, Any]`
+ pymongo/synchronous/mongo_client.py:2354:13 warning[redundant-cast] Redundant cast: value is already of type `dict[str, Any]`
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/plugins/openlibrary/lists.py:109:29 warning[redundant-cast] Value is already of type `ThingReferenceDict`
+ openlibrary/plugins/openlibrary/lists.py:109:54 warning[redundant-cast] Redundant cast: value is already of type `ThingReferenceDict`
- openlibrary/solr/updater/work.py:536:29 warning[redundant-cast] Value is already of type `str`
+ openlibrary/solr/updater/work.py:536:39 warning[redundant-cast] Redundant cast: value is already of type `str`
paasta (https://github.com/yelp/paasta)
- paasta_tools/utils.py:4155:19 warning[redundant-cast] Value is already of type `list[str]`
+ paasta_tools/utils.py:4157:9 warning[redundant-cast] Redundant cast: value is already of type `list[str]`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/arrays/boolean.py:234:23 warning[redundant-cast] Value is already of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
+ pandas/core/arrays/boolean.py:234:53 warning[redundant-cast] Redundant cast: value is already of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
- pandas/core/arrays/period.py:249:17 warning[redundant-cast] Value is already of type `PeriodDtype`
+ pandas/core/arrays/period.py:249:37 warning[redundant-cast] Redundant cast: value is already of type `PeriodDtype`
- pandas/core/arrays/period.py:1543:20 warning[redundant-cast] Value is already of type `int`
+ pandas/core/arrays/period.py:1543:32 warning[redundant-cast] Redundant cast: value is already of type `int`
- pandas/core/arrays/period.py:1547:24 warning[redundant-cast] Value is already of type `int`
+ pandas/core/arrays/period.py:1547:36 warning[redundant-cast] Redundant cast: value is already of type `int`
- pandas/core/arrays/string_.py:1014:23 warning[redundant-cast] Value is already of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
+ pandas/core/arrays/string_.py:1014:53 warning[redundant-cast] Redundant cast: value is already of type `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]`
- pandas/core/arrays/timedeltas.py:510:16 warning[redundant-cast] Value is already of type `Timedelta | NaTType`
+ pandas/core/arrays/timedeltas.py:510:44 warning[redundant-cast] Redundant cast: value is already of type `Timedelta | NaTType`
- pandas/core/dtypes/concat.py:302:16 warning[redundant-cast] Value is already of type `list[Categorical]`
+ pandas/core/dtypes/concat.py:302:42 warning[redundant-cast] Redundant cast: value is already of type `list[Categorical]`
- pandas/core/generic.py:6588:16 warning[redundant-cast] Value is already of type `Self@astype`
+ pandas/core/generic.py:6588:29 warning[redundant-cast] Redundant cast: value is already of type `Self@astype`
- pandas/core/indexes/timedeltas.py:497:24 warning[redundant-cast] Value is already of type `Literal["s", "ms", "us", "ns"]`
+ pandas/core/indexes/timedeltas.py:497:41 warning[redundant-cast] Redundant cast: value is already of type `Literal["s", "ms", "us", "ns"]`
- pandas/core/indexes/timedeltas.py:499:24 warning[redundant-cast] Value is already of type `Literal["s", "ms", "us", "ns"]`
+ pandas/core/indexes/timedeltas.py:499:41 warning[redundant-cast] Redundant cast: value is already of type `Literal["s", "ms", "us", "ns"]`
- pandas/core/indexes/timedeltas.py:503:20 warning[redundant-cast] Value is already of type `Literal["s", "ms", "us", "ns"]`
+ pandas/core/indexes/timedeltas.py:503:37 warning[redundant-cast] Redundant cast: value is already of type `Literal["s", "ms", "us", "ns"]`
- pandas/core/indexes/timedeltas.py:507:20 warning[redundant-cast] Value is already of type `Literal["s", "ms", "us", "ns"]`
+ pandas/core/indexes/timedeltas.py:507:37 warning[redundant-cast] Redundant cast: value is already of type `Literal["s", "ms", "us", "ns"]`
- pandas/core/reshape/merge.py:1599:30 warning[redundant-cast] Value is already of type `Hashable`
+ pandas/core/reshape/merge.py:1599:47 warning[redundant-cast] Redundant cast: value is already of type `Hashable`
- pandas/core/reshape/merge.py:1611:30 warning[redundant-cast] Value is already of type `Hashable`
+ pandas/core/reshape/merge.py:1611:47 warning[redundant-cast] Redundant cast: value is already of type `Hashable`
- pandas/core/reshape/merge.py:1642:25 warning[redundant-cast] Value is already of type `Hashable`
+ pandas/core/reshape/merge.py:1642:42 warning[redundant-cast] Redundant cast: value is already of type `Hashable`
- pandas/core/reshape/merge.py:1662:25 warning[redundant-cast] Value is already of type `Hashable`
+ pandas/core/reshape/merge.py:1662:42 warning[redundant-cast] Redundant cast: value is already of type `Hashable`
pandera (https://github.com/pandera-dev/pandera)
- pandera/api/dataframe/container.py:483:16 warning[redundant-cast] Value is already of type `Self@add_columns`
+ pandera/api/dataframe/container.py:483:27 warning[redundant-cast] Redundant cast: value is already of type `Self@add_columns`
- pandera/api/dataframe/container.py:546:16 warning[redundant-cast] Value is already of type `Self@remove_columns`
+ pandera/api/dataframe/container.py:546:27 warning[redundant-cast] Redundant cast: value is already of type `Self@remove_columns`
- pandera/api/dataframe/container.py:612:16 warning[redundant-cast] Value is already of type `Self@update_column`
+ pandera/api/dataframe/container.py:612:27 warning[redundant-cast] Redundant cast: value is already of type `Self@update_column`
- pandera/api/dataframe/container.py:701:16 warning[redundant-cast] Value is already of type `Self@update_columns`
+ pandera/api/dataframe/container.py:701:27 warning[redundant-cast] Redundant cast: value is already of type `Self@update_columns`
- pandera/api/dataframe/container.py:787:16 warning[redundant-cast] Value is already of type `Self@rename_columns`
+ pandera/api/dataframe/container.py:787:27 warning[redundant-cast] Redundant cast: value is already of type `Self@rename_columns`
- pandera/api/dataframe/container.py:823:16 warning[redundant-cast] Value is already of type `Self@update_index`
+ pandera/api/dataframe/container.py:823:27 warning[redundant-cast] Redundant cast: value is already of type `Self@update_index`
- pandera/api/dataframe/container.py:855:16 warning[redundant-cast] Value is already of type `Self@update_indexes`
+ pandera/api/dataframe/container.py:855:27 warning[redundant-cast] Redundant cast: value is already of type `Self@update_indexes`
- pandera/api/dataframe/container.py:899:16 warning[redundant-cast] Value is already of type `Self@rename_indexes`
+ pandera/api/dataframe/container.py:899:27 warning[redundant-cast] Redundant cast: value is already of type `Self@rename_indexes`
- pandera/api/dataframe/container.py:962:16 warning[redundant-cast] Value is already of type `Self@select_columns`
+ pandera/api/dataframe/container.py:962:27 warning[redundant-cast] Redundant cast: value is already of type `Self@select_columns`
- pandera/api/dataframe/container.py:1105:16 warning[redundant-cast] Value is already of type `Self@set_index`
+ pandera/api/dataframe/container.py:1105:27 warning[redundant-cast] Redundant cast: value is already of type `Self@set_index`
- pandera/api/dataframe/model.py:246:16 warning[redundant-cast] Value is already of type `DataFrameBase[Self@__new__]`
+ pandera/api/dataframe/model.py:246:42 warning[redundant-cast] Redundant cast: value is already of type `DataFrameBase[Self@__new__]`
- pandera/api/pandas/array.py:285:16 warning[redundant-cast] Value is already of type `Series[Any]`
+ pandera/api/pandas/array.py:285:32 warning[redundant-cast] Redundant cast: value is already of type `Series[Any]`
pip (https://github.com/pypa/pip)
- src/pip/_vendor/rich/console.py:1540:43 warning[redundant-cast] Value is already of type `Literal["left", "center", "right"]`
+ src/pip/_vendor/rich/console.py:1540:61 warning[redundant-cast] Redundant cast: value is already of type `Literal["left", "center", "right"]`
poetry (https://github.com/python-poetry/poetry)
- tests/console/commands/test_show.py:42:12 warning[redundant-cast] Value is already of type `F@output_format_parametrize`
+ tests/console/commands/test_show.py:42:22 warning[redundant-cast] Redundant cast: value is already of type `F@output_format_parametrize`
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/flows.py:3430:28 warning[redundant-cast] Value is already of type `str`
+ src/prefect/flows.py:3430:38 warning[redundant-cast] Redundant cast: value is already of type `str`
- src/prefect/flows.py:3443:28 warning[redundant-cast] Value is already of type `str`
+ src/prefect/flows.py:3443:38 warning[redundant-cast] Redundant cast: value is already of type `str`
- src/prefect/utilities/engine.py:389:16 warning[redundant-cast] Value is already of type `Any`
+ src/prefect/utilities/engine.py:389:26 warning[redundant-cast] Redundant cast: value is already of type `Any`
pylint (https://github.com/pycqa/pylint)
- pylint/checkers/base/basic_checker.py:85:21 warning[redundant-cast] Value is already of type `Literal["function", "class", "method", "module"]`
+ pylint/checkers/base/basic_checker.py:85:76 warning[redundant-cast] Redundant cast: value is already of type `Literal["function", "class", "method", "module"]`
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
- pytest_robotframework/_internal/robot/utils.py:232:25 warning[redundant-cast] Value is already of type `list[object] | None`
+ pytest_robotframework/_internal/robot/utils.py:233:38 warning[redundant-cast] Redundant cast: value is already of type `list[object] | None`
rich (https://github.com/Textualize/rich)
- rich/console.py:1542:43 warning[redundant-cast] Value is already of type `Literal["left", "center", "right"]`
+ rich/console.py:1542:61 warning[redundant-cast] Redundant cast: value is already of type `Literal["left", "center", "right"]`
rotki (https://github.com/rotki/rotki)
- rotkehlchen/api/services/transactions.py:298:33 warning[redundant-cast] Value is already of type `Literal[SupportedBlockchain.ETHEREUM, SupportedBlockchain.OPTIMISM, SupportedBlockchain.POLYGON_POS, SupportedBlockchain.ARBITRUM_ONE, SupportedBlockchain.BASE, ... omitted 6 literals]`
+ rotkehlchen/api/services/transactions.py:298:64 warning[redundant-cast] Redundant cast: value is already of type `Literal[SupportedBlockchain.ETHEREUM, SupportedBlockchain.OPTIMISM, SupportedBlockchain.POLYGON_POS, SupportedBlockchain.ARBITRUM_ONE, SupportedBlockchain.BASE, ... omitted 6 literals]`
- rotkehlchen/db/internal_tx_conflicts.py:216:25 warning[redundant-cast] Value is already of type `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`
+ rotkehlchen/db/internal_tx_conflicts.py:216:70 warning[redundant-cast] Redundant cast: value is already of type `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`
- rotkehlchen/db/internal_tx_conflicts.py:243:13 warning[redundant-cast] Value is already of type `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`
+ rotkehlchen/db/internal_tx_conflicts.py:243:58 warning[redundant-cast] Redundant cast: value is already of type `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`
- rotkehlchen/inquirer.py:1018:20 warning[redundant-cast] Value is already of type `Literal[ChainID.ETHEREUM, ChainID.POLYGON_POS, ChainID.OPTIMISM, ChainID.ARBITRUM_ONE, ChainID.GNOSIS, ... omitted 4 literals]`
+ rotkehlchen/inquirer.py:1018:48 warning[redundant-cast] Redundant cast: value is already of type `Literal[ChainID.ETHEREUM, ChainID.POLYGON_POS, ChainID.OPTIMISM, ChainID.ARBITRUM_ONE, ChainID.GNOSIS, ... omitted 4 literals]`
- rotkehlchen/rotkehlchen.py:1043:30 warning[redundant-cast] Value is already of type `Literal[SupportedBlockchain.ETHEREUM, SupportedBlockchain.OPTIMISM, SupportedBlockchain.POLYGON_POS, SupportedBlockchain.ARBITRUM_ONE, SupportedBlockchain.BASE, ... omitted 5 literals]`
+ rotkehlchen/rotkehlchen.py:1043:72 warning[redundant-cast] Redundant cast: value is already of type `Literal[SupportedBlockchain.ETHEREUM, SupportedBlockchain.OPTIMISM, SupportedBlockchain.POLYGON_POS, SupportedBlockchain.ARBITRUM_ONE, SupportedBlockchain.BASE, ... omitted 5 literals]`
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/hooks.py:81:29 warning[redundant-cast] Value is already of type `str`
+ src/schemathesis/hooks.py:81:39 warning[redundant-cast] Redundant cast: value is already of type `str`
- src/schemathesis/specs/graphql/schemas.py:421:18 warning[redundant-cast] Value is already of type `ExamplesPhaseData | FuzzingPhaseData`
+ src/schemathesis/specs/graphql/schemas.py:421:61 warning[redundant-cast] Redundant cast: value is already of type `ExamplesPhaseData | FuzzingPhaseData`
- src/schemathesis/specs/openapi/_hypothesis.py:300:26 warning[redundant-cast] Value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
+ src/schemathesis/specs/openapi/_hypothesis.py:300:89 warning[redundant-cast] Redundant cast: value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
- src/schemathesis/specs/openapi/_hypothesis.py:322:26 warning[redundant-cast] Value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
+ src/schemathesis/specs/openapi/_hypothesis.py:322:89 warning[redundant-cast] Redundant cast: value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
- src/schemathesis/specs/openapi/_hypothesis.py:344:22 warning[redundant-cast] Value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
+ src/schemathesis/specs/openapi/_hypothesis.py:344:85 warning[redundant-cast] Redundant cast: value is already of type `ExamplesPhaseData | FuzzingPhaseData | StatefulPhaseData`
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/externals/array_api_compat/numpy/_aliases.py:118:14 warning[redundant-cast] Value is already of type `Any`
+ sklearn/externals/array_api_compat/numpy/_aliases.py:118:26 warning[redundant-cast] Redundant cast: value is already of type `Any`
scipy (https://github.com/scipy/scipy)
- subprojects/array_api_compat/array_api_compat/array_api_compat/numpy/_aliases.py:118:14 warning[redundant-cast] Value is already of type `Any`
+ subprojects/array_api_compat/array_api_compat/array_api_compat/numpy/_aliases.py:118:26 warning[redundant-cast] Redundant cast: value is already of type `Any`
sockeye (https://github.com/awslabs/sockeye)
- sockeye/data_io.py:388:34 warning[redundant-cast] Value is already of type `int`
+ sockeye/data_io.py:388:44 warning[redundant-cast] Redundant cast: value is already of type `int`
spack (https://github.com/spack/spack)
- lib/spack/spack/buildcache_prune.py:233:27 warning[redundant-cast] Value is already of type `URLBuildcacheEntry`
+ lib/spack/spack/buildcache_prune.py:233:52 warning[redundant-cast] Redundant cast: value is already of type `URLBuildcacheEntry`
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- backend/api/global_scoreboard_api.py:104:32 warning[redundant-cast] Value is already of type `str`
+ backend/api/global_scoreboard_api.py:104:42 warning[redundant-cast] Redundant cast: value is already of type `str`
sympy (https://github.com/sympy/sympy)
- sympy/polys/compatibility.py:385:24 warning[redundant-cast] Value is already of type `PolyElement[Er@IPolys]`
+ sympy/polys/compatibility.py:385:48 warning[redundant-cast] Redundant cast: value is already of type `PolyElement[Er@IPolys]`
- sympy/polys/rings.py:2847:26 warning[redundant-cast] Value is already of type `PolyElement[Er@PolyElement]`
+ sympy/polys/rings.py:2847:50 warning[redundant-cast] Redundant cast: value is already of type `PolyElement[Er@PolyElement]`
tornado (https://github.com/tornadoweb/tornado)
- tornado/http1connection.py:618:16 warning[redundant-cast] Value is already of type `int`
+ tornado/http1connection.py:618:26 warning[redundant-cast] Redundant cast: value is already of type `int`
twine (https://github.com/pypa/twine)
- twine/utils.py:230:53 warning[redundant-cast] Value is already of type `str`
+ twine/utils.py:230:63 warning[redundant-cast] Redundant cast: value is already of type `str`
websockets (https://github.com/aaugustin/websockets)
- src/websockets/legacy/auth.py:183:23 warning[redundant-cast] Value is already of type `(...) -> BasicAuthWebSocketServerProtocol`
+ src/websockets/legacy/auth.py:184:58 warning[redundant-cast] Redundant cast: value is already of type `(...) -> BasicAuthWebSocketServerProtocol`
werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/test.py:823:33 warning[redundant-cast] Value is already of type `type[TestResponse]`
+ src/werkzeug/test.py:823:62 warning[redundant-cast] Redundant cast: value is already of type `type[TestResponse]`
zulip (https://github.com/zulip/zulip)
- zerver/management/commands/deactivate_realm.py:51:33 warning[redundant-cast] Value is already of type `Any`
+ zerver/management/commands/deactivate_realm.py:51:43 warning[redundant-cast] Redundant cast: value is already of type `Any`|
I think the reason why we didn't do this before is that it has a negative impact on the suppression range. This would no longer have the desired effect: x = cast( # ty: ignore[redundant-cast]
int,
very_very_very_very_very_very_very_very_long_name,
)(and same for less silly examples that are more deeply indented) |
33b0c47 to
560e45e
Compare
oh, no. I forgot about that 😢 |
| return 10 | ||
|
|
||
| # error: [redundant-cast] "Value is already of type `int`" | ||
| # error: [redundant-cast] "Redundant cast: value is already of type `int`" |
There was a problem hiding this comment.
I think the first two words in the concise diagnostic here are obvious from the error code 😄
| # error: [redundant-cast] "Redundant cast: value is already of type `int`" | |
| # error: [redundant-cast] "Value is already of type `int`" |
There was a problem hiding this comment.
Hm, I included it on purpose. I think the message is what people look at first? And there might also be scenarios where you only see the message?
There was a problem hiding this comment.
What about
| # error: [redundant-cast] "Redundant cast: value is already of type `int`" | |
| # error: [redundant-cast] "Redundant cast to `int`" |
?
There was a problem hiding this comment.
And there might also be scenarios where you only see the message?
are you thinking of any in particular here?
This has now come up a lot where I think we should try to support multiple suppression ranges. We can always revert or explore something else if it turns out that this is too confusing for users. Fixing this could be as easy as adding an optional |
| ```snapshot | ||
| warning[redundant-cast]: Value is already of type `int` | ||
| --> src/mdtest_snippet.py:5:1 | ||
| warning[redundant-cast]: Redundant cast to type `int` |
There was a problem hiding this comment.
This could possibly just be
| warning[redundant-cast]: Redundant cast to type `int` | |
| warning[redundant-cast]: Redundant cast |
Since the type being cast to is already mentioned in the primary annotation. "[redundant-cast] Redundant cast" is a bit weird, but matches what we do for revealed-type
There was a problem hiding this comment.
I changed it on purpose. The message is so short anyway, I don't mind the duplicated display of … to type "int". There might also be editors where you see the primary message more prominently, and the annotations are hidden behind additional user actions?
There was a problem hiding this comment.
Hmm, well in that case should we consider also changing our revealed-type diagnostic messages? This feels inconsistent with what we do there.
There was a problem hiding this comment.
There might also be editors where you see the primary message more prominently, and the annotations are hidden behind additional user actions?
I think ideally we'd detect if that's the case and display the concise message instead of the primary message... Though I can understand that that might be hard. Do we know of any editors where that's the case, or is this theoretical?
Well, the "easy" part is probably not true 😅. At least, I'm not so sure if it's easy. The part I'm concerned about is whether this leads to cases where |
Summary
Better diagnostic messages and source annotation range for
redundant-castdiagnostics.Before:
After:
Test Plan
Updated snapshot tests