[ty] narrow TypedDict unions with not in by felixscherz · Pull Request #22349 · astral-sh/ruff (original) (raw)
mypy_primer results
Changes were detected when running on open source projects
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- backend/services/utils.py:71:16: error[invalid-return-type] Return type does not match returned value: expected
dict[Literal["data"], Any] | None, foundSrcErrorResultDto - Found 29 diagnostics
- Found 28 diagnostics
meson (https://github.com/mesonbuild/meson)
- mesonbuild/modules/simd.py:103:54: error[invalid-argument-type] Argument to function
extract_as_listis incorrect: Expecteddict[str, Unknown], foundStaticLibrary
- mesonbuild/modules/simd.py:103:54: error[invalid-argument-type] Argument to function
extract_as_listis incorrect: Expecteddict[Never, Unknown], foundStaticLibrary
- mesonbuild/modules/simd.py:105:24: error[invalid-key] TypedDict
StaticLibrarycan only be subscripted with a string literal key, got key of typestr.
- mesonbuild/modules/simd.py:105:24: error[invalid-assignment] Cannot assign value of type
Neverto key of typeNeveron TypedDictStaticLibrary
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/plugins/openlibrary/lists.py:89:19: error[invalid-key] Unknown key "key" for TypedDict
AnnotatedSeedDict: Unknown key "key"
- openlibrary/plugins/openlibrary/lists.py:90:25: warning[redundant-cast] Value is already of type
ThingReferenceDict
prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type
T@resolve_block_document_references | dict[str, Any] | str | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:94:28: error[invalid-assignment] Object of type
T@resolve_block_document_references | dict[str, Any]is not assignable todict[str, Any]
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type
T@resolve_variables | str | int | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/integrations/prefect-dbt/prefect_dbt/core/settings.py:99:28: error[invalid-assignment] Object of type
T@resolve_variables | dict[str, Any]is not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type
T@resolve_block_document_references | dict[str, Any] | str | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:86:21: error[invalid-assignment] Object of type
T@resolve_block_document_references | dict[str, Any]is not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type
T@resolve_variables | str | int | ... omitted 4 union elementsis not assignable todict[str, Any]
- src/prefect/cli/deploy/_core.py:87:21: error[invalid-assignment] Object of type
T@resolve_variablesis not assignable todict[str, Any]
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Expected
T@resolve_variables, foundT@resolve_block_document_references | dict[str, Any] | str | ... omitted 4 union elements
- src/prefect/deployments/steps/core.py:137:38: error[invalid-argument-type] Argument is incorrect: Expected
T@resolve_variables, foundT@resolve_block_document_references | dict[str, Any]
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type
objectand value of typeT@resolve_block_document_references | dict[str, Any] | str | ... omitted 4 union elementson object of typedict[str, Any]
- src/prefect/utilities/templating.py:320:13: error[invalid-assignment] Invalid subscript assignment with key of type
objectand value of typeT@resolve_block_document_references | dict[str, Any]on object of typedict[str, Any]
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_block_document_references | dict[str, Any], foundlist[T@resolve_block_document_references | dict[str, Any] | str | ... omitted 5 union elements]
- src/prefect/utilities/templating.py:323:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_block_document_references | dict[str, Any], foundlist[T@resolve_block_document_references | dict[str, Any] | Unknown]
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_variables, founddict[object, T@resolve_variables | str | int | ... omitted 5 union elements]
- src/prefect/utilities/templating.py:437:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_variables, founddict[object, T@resolve_variables | Unknown]
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_variables, foundlist[T@resolve_variables | str | int | ... omitted 5 union elements]
- src/prefect/utilities/templating.py:442:16: error[invalid-return-type] Return type does not match returned value: expected
T@resolve_variables, foundlist[T@resolve_variables | Unknown]
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Expected
T@resolve_variables, foundT@resolve_block_document_references | dict[str, Any] | str | ... omitted 4 union elements
- src/prefect/workers/base.py:232:13: error[invalid-argument-type] Argument is incorrect: Expected
T@resolve_variables, foundT@resolve_block_document_references | dict[str, Any]
- src/prefect/workers/base.py:234:20: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
T@resolve_variables | str | int | ... omitted 4 union elements
- src/prefect/workers/base.py:234:20: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
T@resolve_variables
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:483:25: warning[redundant-cast] Value is already of type
_DynamoDBDeleteRequestWriteRequest - ddtrace/_trace/utils_botocore/span_pointers/dynamodb.py:554:34: warning[redundant-cast] Value is already of type
_DynamoDBTransactUpdateItem
- Found 8425 diagnostics
- Found 8427 diagnostics
jax (https://github.com/google/jax)
- jax/_src/tree_util.py:302:31: error[invalid-argument-type] Argument to bound method
register_nodeis incorrect: Expected(Hashable, Iterable[object], /) -> T@register_pytree_node, found(_AuxData@register_pytree_node, _Children@register_pytree_node, /) -> T@register_pytree_node - jax/_src/tree_util.py:305:31: error[invalid-argument-type] Argument to bound method
register_nodeis incorrect: Expected(Hashable, Iterable[object], /) -> T@register_pytree_node, found(_AuxData@register_pytree_node, _Children@register_pytree_node, /) -> T@register_pytree_node - jax/_src/tree_util.py:308:31: error[invalid-argument-type] Argument to bound method
register_nodeis incorrect: Expected(Hashable, Iterable[object], /) -> T@register_pytree_node, found(_AuxData@register_pytree_node, _Children@register_pytree_node, /) -> T@register_pytree_node - Found 2801 diagnostics
- Found 2798 diagnostics
static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/bus.py:671:16: error[invalid-return-type] Return type does not match returned value: expected
InterGetItemLocReduces[Bus[Any], object_], foundInterGetItemLocReduces[Top[Bus[Any]] | TypeBlocks | Batch | ... omitted 6 union elements, object_]
- static_frame/core/bus.py:671:16: error[invalid-return-type] Return type does not match returned value: expected
InterGetItemLocReduces[Bus[Any], object_], foundInterGetItemLocReduces[Top[Index[Any]] | Top[Series[Any, Any]] | TypeBlocks | ... omitted 6 union elements, object_]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- pandas-stubs/_typing.pyi:1232:16: warning[unused-ignore-comment] Unused blanket
type: ignoredirective - Found 5160 diagnostics
- Found 5159 diagnostics
core (https://github.com/home-assistant/core)
- homeassistant/components/tts/init.py:292:53: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
MediaSourceOptions | str - homeassistant/components/tts/init.py:292:53: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
MediaSourceOptions | str - homeassistant/components/tts/init.py:292:62: error[invalid-key] Unknown key "options" for TypedDict
ParsedMediaSourceStreamId: Unknown key "options" - homeassistant/components/tts/init.py:293:41: error[invalid-key] Unknown key "message" for TypedDict
ParsedMediaSourceStreamId: Unknown key "message" - homeassistant/components/tts/media_source.py:145:61: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
MediaSourceOptions | str - homeassistant/components/tts/media_source.py:145:61: error[invalid-argument-type] Argument expression after ** must be a mapping type: Found
MediaSourceOptions | str - homeassistant/components/tts/media_source.py:145:70: error[invalid-key] Unknown key "options" for TypedDict
ParsedMediaSourceStreamId: Unknown key "options" - homeassistant/components/tts/media_source.py:146:49: error[invalid-key] Unknown key "message" for TypedDict
ParsedMediaSourceStreamId: Unknown key "message" - Found 14443 diagnostics
- Found 14435 diagnostics
No memory usage changes detected ✅