Skip to content

[ty] Type inference for genererator expressions#21437

Merged
sharkdp merged 3 commits intomainfrom
david/generator-expression-inference
Nov 14, 2025
Merged

[ty] Type inference for genererator expressions#21437
sharkdp merged 3 commits intomainfrom
david/generator-expression-inference

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Nov 13, 2025

Summary

Add type inference for (async) generator expressions.

closes astral-sh/ty#1510

Test Plan

New Markdown tests.

@sharkdp sharkdp added ty Multi-file analysis & type inference ecosystem-analyzer labels Nov 13, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 13, 2025

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 13, 2025

mypy_primer results

Changes were detected when running on open source projects
attrs (https://github.com/python-attrs/attrs)
+ src/attr/_make.py:480:37: warning[possibly-missing-attribute] Attribute `default` may be missing on object of type `Attribute | Unknown`
- src/attr/_make.py:1608:5: error[invalid-assignment] Object of type `tuple[@Todo, ...]` is not assignable to `list[Attribute | Unknown]`
+ src/attr/_make.py:1608:5: error[invalid-assignment] Object of type `tuple[Attribute | Unknown, ...]` is not assignable to `list[Attribute | Unknown]`
+ src/attr/validators.py:175:24: error[invalid-argument-type] Argument to function `sorted` is incorrect: Argument type `((Overload[(pattern: str | Pattern[str], string: str, flags: int = Literal[0]) -> Match[str] | None, (pattern: bytes | Pattern[bytes], string: @Todo, flags: int = Literal[0]) -> Match[bytes] | None]) & ~AlwaysTruthy & ~AlwaysFalsy) | (str & ~AlwaysFalsy)` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
- Found 581 diagnostics
+ Found 583 diagnostics

spack (https://github.com/spack/spack)
+ .github/workflows/bin/format-rst.py:32:16: error[non-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
+ .github/workflows/bin/format-rst.py:39:37: error[unresolved-attribute] Object of type `object` has no attribute `get`
+ lib/spack/spack/cmd/license.py:81:24: error[no-matching-overload] No overload of bound method `match` matches arguments
+ lib/spack/spack/vendor/attr/validators.py:186:25: error[invalid-argument-type] Argument to function `sorted` is incorrect: Argument type `((Overload[(pattern: str | Pattern[str], string: str, flags: int = Literal[0]) -> Match[str] | None, (pattern: bytes | Pattern[bytes], string: @Todo, flags: int = Literal[0]) -> Match[bytes] | None]) & ~AlwaysTruthy & ~AlwaysFalsy) | (str & ~AlwaysFalsy)` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ lib/spack/spack/vendor/typing_extensions.py:111:49: error[unsupported-operator] Operator `-` is unsupported between objects of type `~AlwaysFalsy | int` and `int`
- share/spack/qa/flake8_formatter.py:62:16: warning[possibly-missing-attribute] Attribute `search` may be missing on object of type `Unknown | str`
+ share/spack/qa/flake8_formatter.py:62:16: warning[possibly-missing-attribute] Attribute `search` may be missing on object of type `Unknown | str | Pattern[str]`
- Found 7923 diagnostics
+ Found 7928 diagnostics

pip (https://github.com/pypa/pip)
- src/pip/_internal/exceptions.py:896:57: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- src/pip/_internal/wheel_builder.py:220:55: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 585 diagnostics
+ Found 583 diagnostics

paasta (https://github.com/yelp/paasta)
+ paasta_tools/cli/cmds/rollback.py:157:12: error[invalid-return-type] Return type does not match returned value: expected `Generator[str, None, None]`, found `GeneratorType[str | None, None, None]`
- Found 991 diagnostics
+ Found 992 diagnostics

scrapy (https://github.com/scrapy/scrapy)
+ scrapy/downloadermiddlewares/cookies.py:182:13: error[invalid-assignment] Object of type `tuple[dict[Unknown | str, Unknown], ...]` is not assignable to `Iterable[VerboseCookie]`
- Found 1704 diagnostics
+ Found 1705 diagnostics

rich (https://github.com/Textualize/rich)
+ examples/fullscreen.py:140:9: error[no-matching-overload] No overload of function `sum` matches arguments
+ examples/live_progress.py:25:9: error[no-matching-overload] No overload of function `sum` matches arguments
- Found 342 diagnostics
+ Found 344 diagnostics

nox (https://github.com/wntrblm/nox)
+ nox/_options.py:293:12: error[invalid-return-type] Return type does not match returned value: expected `Iterable[str]`, found `filter[Unknown | Sequence[str] | bool]`
- Found 29 diagnostics
+ Found 30 diagnostics

tornado (https://github.com/tornadoweb/tornado)
+ tornado/auth.py:387:13: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["verifier"]` and value of type `str & ~AlwaysFalsy` on object of type `dict[str, bytes]`
- Found 329 diagnostics
+ Found 330 diagnostics

mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ test/individual_coverage.py:103:46: error[invalid-argument-type] Argument to function `run_tests` is incorrect: Expected `bool`, found `Match[str] | None`
- Found 1843 diagnostics
+ Found 1844 diagnostics

artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/type_hints.py:161:60: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- tests/arti/test_fingerprints.py:51:30: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 174 diagnostics
+ Found 172 diagnostics

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/writers/text.py:539:72: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 520 diagnostics
+ Found 519 diagnostics

mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/topology_description.py:111:17: error[invalid-argument-type] Argument to function `min` is incorrect: Argument type `int | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
- Found 474 diagnostics
+ Found 475 diagnostics

xarray (https://github.com/pydata/xarray)
+ xarray/backends/zarr.py:1242:21: error[invalid-argument-type] Argument to function `grid_rechunk` is incorrect: Expected `tuple[slice[Any, Any, Any], ...]`, found `tuple[Unknown | str | slice[Any, Any, Any], ...]`
+ xarray/backends/zarr.py:1259:21: error[invalid-argument-type] Argument to function `validate_grid_chunks_alignment` is incorrect: Expected `tuple[slice[Any, Any, Any], ...]`, found `tuple[Unknown | str | slice[Any, Any, Any], ...]`
+ xarray/core/dataset.py:661:16: error[no-matching-overload] No overload of function `sum` matches arguments
- xarray/core/datatree.py:588:75: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 1778 diagnostics
+ Found 1780 diagnostics

apprise (https://github.com/caronc/apprise)
+ apprise/asset.py:471:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[int, int, int]`, found `tuple[int, ...]`
- Found 2501 diagnostics
+ Found 2502 diagnostics

vision (https://github.com/pytorch/vision)
- test/test_datasets.py:461:37: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown]`, found `Unknown | str | tuple[@Todo, ...] | tuple[str] | int`
+ test/test_datasets.py:461:37: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown]`, found `Unknown | str | tuple[str, ...] | int`
- test/test_datasets.py:461:74: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown]`, found `Unknown | str | tuple[@Todo, ...] | tuple[str] | int`
+ test/test_datasets.py:461:74: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Unknown]`, found `Unknown | str | tuple[str, ...] | int`
- test/test_datasets.py:468:19: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | str | tuple[@Todo, ...] | tuple[str] | int`
+ test/test_datasets.py:468:19: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Unknown | str | tuple[str, ...] | int`
- test/test_datasets.py:480:30: error[unsupported-operator] Operator `-` is unsupported between objects of type `Unknown | str | tuple[@Todo, ...] | tuple[str] | int` and `Literal[1]`
+ test/test_datasets.py:480:30: error[unsupported-operator] Operator `-` is unsupported between objects of type `Unknown | str | tuple[str, ...] | int` and `Literal[1]`
- test/test_datasets.py:481:30: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `SupportsIndex`, found `Unknown | str | tuple[@Todo, ...] | tuple[str] | int`
+ test/test_datasets.py:481:30: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `SupportsIndex`, found `Unknown | str | tuple[str, ...] | int`
- test/test_image.py:46:1: error[invalid-assignment] Object of type `tuple[@Todo, ...]` is not assignable to `Literal["12.0.0"]`
+ test/test_image.py:46:1: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `Literal["12.0.0"]`
- test/test_utils.py:17:1: error[invalid-assignment] Object of type `tuple[@Todo, ...]` is not assignable to `Literal["12.0.0"]`
+ test/test_utils.py:17:1: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `Literal["12.0.0"]`

cloud-init (https://github.com/canonical/cloud-init)
+ cloudinit/net/network_state.py:963:5: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["routes"]` and value of type `list[Unknown]` on object of type `dict[Unknown, Unknown & ~AlwaysFalsy]`
- Found 1176 diagnostics
+ Found 1177 diagnostics

meson (https://github.com/mesonbuild/meson)
+ mesonbuild/mintro.py:337:25: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[str]`, found `GeneratorType[bytes, None, None]`
- Found 1738 diagnostics
+ Found 1739 diagnostics

freqtrade (https://github.com/freqtrade/freqtrade)
+ freqtrade/persistence/trade_model.py:1885:28: error[no-matching-overload] No overload of function `sum` matches arguments
- Found 614 diagnostics
+ Found 615 diagnostics

strawberry (https://github.com/strawberry-graphql/strawberry)
- strawberry/schema/name_converter.py:121:44: warning[possibly-missing-attribute] Attribute `__strawberry_definition__` may be missing on object of type `StrawberryType | (@Todo & ~Top[LazyType[Unknown, Unknown]])`
+ strawberry/schema/name_converter.py:121:44: error[unresolved-attribute] Object of type `StrawberryType` has no attribute `__strawberry_definition__`

scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/datasets/_base.py:1342:9: error[invalid-argument-type] Argument to function `sorted` is incorrect: Argument type `Traversable` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
- Found 2570 diagnostics
+ Found 2571 diagnostics

openlibrary (https://github.com/internetarchive/openlibrary)
+ openlibrary/i18n/__init__.py:209:13: error[invalid-assignment] Not enough values to unpack: Expected 6
- Found 944 diagnostics
+ Found 945 diagnostics

pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/color/disasm.py:140:27: error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `int | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ pwndbg/lib/zig.py:170:5: error[invalid-assignment] Object of type `str` is not assignable to `list[Path] | None`
+ pwndbg/lib/zig.py:179:21: error[invalid-argument-type] Argument to bound method `write` is incorrect: Expected `str`, found `list[Path] | None`
- Found 2709 diagnostics
+ Found 2712 diagnostics

setuptools (https://github.com/pypa/setuptools)
- setuptools/_vendor/autocommand/autoasync.py:110:35: error[invalid-argument-type] Argument to bound method `replace` is incorrect: Expected `Sequence[Parameter] | type[_void] | None`, found `GeneratorType[@Todo, @Todo, @Todo]`
+ setuptools/_vendor/autocommand/autoasync.py:110:35: error[invalid-argument-type] Argument to bound method `replace` is incorrect: Expected `Sequence[Parameter] | type[_void] | None`, found `GeneratorType[Parameter, None, None]`
+ setuptools/_vendor/typing_extensions.py:2889:53: error[unsupported-operator] Operator `-` is unsupported between objects of type `(Unknown & ~AlwaysFalsy) | (_Sentinel & ~AlwaysFalsy) | int` and `int`
+ setuptools/_vendor/typing_extensions.py:2906:21: error[unsupported-operator] Operator `-=` is unsupported between objects of type `_Sentinel & ~AlwaysFalsy` and `int`
+ setuptools/command/sdist.py:130:18: error[call-non-callable] Object of type `object` is not callable
- Found 1181 diagnostics
+ Found 1184 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- tests/test_settings_overrides.py:66:77: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 44 diagnostics
+ Found 43 diagnostics

AutoSplit (https://github.com/Toufool/AutoSplit)
+ src/user_profile.py:164:39: warning[redundant-cast] Value is already of type `Literal["split", "reset", "skip_split", "undo_split", "pause", "screenshot", "toggle_auto_reset_image"]`
- Found 70 diagnostics
+ Found 71 diagnostics

hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/auxs/calibtools.py:3492:9: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Any]`, found `Sequence[str] | None | tuple[@Todo, ...]`
+ hydpy/auxs/calibtools.py:3492:9: error[invalid-argument-type] Argument to function `__new__` is incorrect: Expected `Iterable[Any]`, found `Sequence[str] | None`
- hydpy/models/sw1d_network.py:1145:25: error[type-assertion-failure] Argument does not have asserted type `Never`
+ hydpy/models/sw1d_network.py:1173:74: error[invalid-argument-type] Argument to bound method `append_submodel` is incorrect: Expected `RoutingModel_V2 | RoutingModel_V3`, found `RoutingModel_V1 | RoutingModel_V2 | RoutingModel_V3`
- hydpy/models/sw1d_network.py:1176:29: error[type-assertion-failure] Argument does not have asserted type `Never`
- hydpy/models/sw1d_network.py:1217:29: error[type-assertion-failure] Argument does not have asserted type `Never`
- Found 660 diagnostics
+ Found 658 diagnostics

pywin32 (https://github.com/mhammond/pywin32)
- win32/Demos/security/setkernelobjectsecurity.py:77:12: error[invalid-argument-type] Argument to function `AdjustTokenPrivileges` is incorrect: Expected `PyTOKEN_PRIVILEGES`, found `tuple[@Todo, ...]`
+ win32/Demos/security/setkernelobjectsecurity.py:77:12: error[invalid-argument-type] Argument to function `AdjustTokenPrivileges` is incorrect: Expected `PyTOKEN_PRIVILEGES`, found `tuple[tuple[Unknown, Literal[2]], ...]`

pandas (https://github.com/pandas-dev/pandas)
+ pandas/io/pytables.py:2841:20: error[invalid-return-type] Return type does not match returned value: expected `tuple[int, int, int]`, found `tuple[int, ...]`
- Found 3357 diagnostics
+ Found 3358 diagnostics

bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/resources.py:114:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[str, ...]`, found `set[@Todo]`
+ src/bokeh/resources.py:114:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[str, ...]`, found `set[str]`
- src/bokeh/sphinxext/_internal/bokeh_example_metadata.py:110:5: error[invalid-assignment] Object of type `GeneratorType[@Todo, @Todo, @Todo]` is not assignable to `str | None`
+ src/bokeh/sphinxext/_internal/bokeh_example_metadata.py:110:5: error[invalid-assignment] Object of type `GeneratorType[str, None, None]` is not assignable to `str | None`

dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ tests/debugging/exploration/debugger.py:90:24: error[unresolved-attribute] Object of type `ModuleSpec | None` has no attribute `_initializing`
+ tests/internal/bytecode_injection/framework_injection/_bytecode_injection.py:103:24: error[unresolved-attribute] Object of type `ModuleSpec | None` has no attribute `_initializing`
- Found 8156 diagnostics
+ Found 8158 diagnostics

ibis (https://github.com/ibis-project/ibis)
+ ibis/backends/duckdb/__init__.py:1662:12: error[invalid-assignment] Object of type `str` is not assignable to `Mapping[str, Any] | None`
- ibis/examples/gen_registry.py:41:12: error[invalid-return-type] Return type does not match returned value: expected `dict[str, str]`, found `GeneratorType[@Todo, @Todo, @Todo]`
+ ibis/examples/gen_registry.py:41:12: error[invalid-return-type] Return type does not match returned value: expected `dict[str, str]`, found `GeneratorType[tuple[Unknown, Unknown], None, None]`
+ ibis/expr/types/generic.py:1767:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[SortKey, ...]`, found `tuple[Value | None | @Todo, ...]`
- ibis/expr/types/relations.py:674:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[Value, ...]`, found `GeneratorType[@Todo, @Todo, @Todo]`
+ ibis/expr/types/relations.py:674:16: error[invalid-return-type] Return type does not match returned value: expected `tuple[Value, ...]`, found `GeneratorType[Unknown, None, None]`
- ibis/expr/types/relations.py:1278:9: error[invalid-assignment] Object of type `GeneratorType[@Todo, @Todo, @Todo]` is not assignable to `tuple[Iterable[str] | Iterable[Value] | Iterable[Deferred], ...]`
+ ibis/expr/types/relations.py:1278:9: error[invalid-assignment] Object of type `GeneratorType[Iterable[str] | Iterable[Value] | Iterable[Deferred], None, None]` is not assignable to `tuple[Iterable[str] | Iterable[Value] | Iterable[Deferred], ...]`
- ibis/selectors.py:428:5: error[invalid-assignment] Object of type `frozenset[@Todo]` is not assignable to `tuple[str | Column, ...]`
+ ibis/selectors.py:428:5: error[invalid-assignment] Object of type `frozenset[str | Unknown]` is not assignable to `tuple[str | Column, ...]`
- Found 4236 diagnostics
+ Found 4238 diagnostics

jax (https://github.com/google/jax)
- jax/_src/numpy/ufunc_api.py:271:7: error[invalid-assignment] Object of type `tuple[@Todo, ...]` is not assignable to `int | None`
+ jax/_src/numpy/ufunc_api.py:271:7: error[invalid-assignment] Object of type `tuple[int, ...]` is not assignable to `int | None`
- jax/_src/pallas/core.py:1271:32: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ jax/_src/pallas/core.py:1306:3: error[invalid-assignment] Object of type `tuple[int | Array, ...] | tuple[int | None, ...]` is not assignable to attribute `grid` of type `tuple[int | Array, ...]`
+ jax/_src/pallas/hlo_interpreter.py:438:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
- jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2154:62: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2161:37: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2179:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
+ jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2285:15: error[invalid-argument-type] Argument is incorrect: Expected `tuple[int | Array | Slice, ...]`, found `tuple[slice[Any, Any, Any] | Slice | Unknown, ...]`
+ jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2389:15: error[invalid-argument-type] Argument is incorrect: Expected `tuple[int | Array | Slice, ...]`, found `tuple[slice[Any, Any, Any] | Slice | Unknown, ...]`
+ jax/_src/pallas/mosaic/lowering.py:469:5: error[invalid-assignment] Object of type `tuple[str, ...]` is not assignable to `Sequence[Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"] | GridDimensionSemantics] | None`
+ jax/_src/pallas/mosaic/lowering.py:472:30: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Sequence[Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"] | GridDimensionSemantics] | None`
+ jax/_src/pallas/mosaic/lowering.py:475:47: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Sequence[Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"] | GridDimensionSemantics] | None`
+ jax/_src/pallas/mosaic/lowering.py:477:41: error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `Sequence[Literal["parallel", "core_parallel", "subcore_parallel", "arbitrary"] | GridDimensionSemantics] | None`
+ jax/_src/pallas/mosaic/lowering.py:485:22: error[no-matching-overload] No overload of function `iter` matches arguments
+ jax/_src/pallas/mosaic/lowering.py:529:5: error[invalid-assignment] Object of type `tuple[Unknown | None, ...]` is not assignable to attribute `scratch_block_shapes` of type `tuple[tuple[int, ...], ...]`
+ jax/_src/pallas/pallas_call.py:1138:37: error[invalid-argument-type] Argument is incorrect: Expected `int`, found `int | DynamicGridDim | Unknown`
+ jax/_src/pallas/pallas_call.py:1893:27: error[unresolved-attribute] Object of type `AbstractValue` has no attribute `shape`
+ jax/_src/pallas/pallas_call.py:1893:62: error[unresolved-attribute] Object of type `AbstractValue` has no attribute `dtype`
- jax/_src/pjit.py:540:63: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/_src/state/indexing.py:286:42: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/_src/state/indexing.py:309:70: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/_src/test_util.py:1719:50: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/_src/test_util.py:1721:64: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- jax/experimental/jax2tf/jax2tf.py:654:3: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["module"]` and value of type `bytes` on object of type `dict[str, int | tuple[@Todo, ...] | list[Any]]`
+ jax/experimental/jax2tf/jax2tf.py:654:3: error[invalid-assignment] Invalid subscript assignment with key of type `Literal["module"]` and value of type `bytes` on object of type `dict[str, int | tuple[Unknown, ...] | tuple[tuple[Unknown | None, ...], ...] | list[Any]]`
- jax/experimental/sparse/bcoo.py:671:96: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 2645 diagnostics
+ Found 2650 diagnostics

static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/archive_npy.py:833:37: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/archive_npy.py:850:67: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/archive_npy.py:852:65: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/db_util.py:389:66: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/core/db_util.py:391:87: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/core/type_blocks.py:3345:17: error[invalid-assignment] Object of type `GeneratorType[(Iterable[Any] & ~TypeBlocks) | ndarray[Any, Any], None, None]` is not assignable to `Iterable[ndarray[Any, Any]]`
- static_frame/test/unit/test_protocol_dfi.py:382:46: error[invalid-argument-type] Argument to bound method `select_columns_by_name` is incorrect: Expected `Sequence[str]`, found `GeneratorType[@Todo, @Todo, @Todo]`
+ static_frame/test/unit/test_protocol_dfi.py:382:46: error[invalid-argument-type] Argument to bound method `select_columns_by_name` is incorrect: Expected `Sequence[str]`, found `GeneratorType[Literal["ztsv", "zkuW"], None, None]`
- Found 1912 diagnostics
+ Found 1908 diagnostics

rotki (https://github.com/rotki/rotki)
- rotkehlchen/chain/evm/decoding/extrafi/utils.py:73:8: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 2137 diagnostics
+ Found 2136 diagnostics

sympy (https://github.com/sympy/sympy)
+ sympy/integrals/prde.py:89:11: warning[possibly-missing-attribute] Attribute `as_poly` may be missing on object of type `Unknown | int`
+ sympy/integrals/prde.py:89:61: warning[possibly-missing-attribute] Attribute `as_poly` may be missing on object of type `Unknown | int`
+ sympy/integrals/prde.py:90:10: warning[possibly-missing-attribute] Attribute `as_poly` may be missing on object of type `Unknown | int`
- sympy/matrices/expressions/matpow.py:78:29: warning[possibly-missing-attribute] Attribute `rows` may be missing on object of type `(@Todo & ~MatPow & ~MatrixBase) | (Basic & ~MatPow & ~MatrixBase)`
+ sympy/matrices/expressions/matpow.py:78:29: warning[possibly-missing-attribute] Attribute `rows` may be missing on object of type `(Unknown & ~MatPow & ~MatrixBase) | (Basic & ~MatPow & ~MatrixBase)`
+ sympy/matrices/matrixbase.py:1592:20: error[invalid-return-type] Return type does not match returned value: expected `set[Basic] | set[Tbasic@atoms]`, found `set[(@Todo & type) | type[Basic] | type[@Todo]]`
+ sympy/printing/tests/test_fortran.py:659:9: error[no-matching-overload] No overload of bound method `subs` matches arguments
+ sympy/testing/runtests_pytest.py:453:42: error[invalid-argument-type] Argument to function `update_args_with_paths` is incorrect: Expected `tuple[str] | None`, found `tuple[str, ...]`
- Found 14443 diagnostics
+ Found 14449 diagnostics

pydantic (https://github.com/pydantic/pydantic)
- pydantic/v1/typing.py:237:63: warning[unused-ignore-comment] Unused blanket `type: ignore` directive
- Found 4818 diagnostics
+ Found 4817 diagnostics

core (https://github.com/home-assistant/core)
+ homeassistant/components/bluetooth/passive_update_coordinator.py:78:20: error[not-iterable] Object of type `GeneratorType[~None, None, None]` is not iterable
+ homeassistant/components/environment_canada/weather.py:250:13: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[Forecast]`, found `GeneratorType[dict[Unknown | str, Unknown | int], None, None]`
+ homeassistant/components/shelly/utils.py:284:13: error[invalid-argument-type] Argument to bound method `extend` is incorrect: Expected `Iterable[IPv4Address]`, found `GeneratorType[IPv4Address | IPv6Address, None, None]`
+ homeassistant/helpers/update_coordinator.py:218:20: error[not-iterable] Object of type `GeneratorType[~None, None, None]` is not iterable
- Found 14491 diagnostics
+ Found 14495 diagnostics

scipy (https://github.com/scipy/scipy)
+ scipy/interpolate/tests/test_bsplines.py:2404:20: error[unsupported-operator] Operator `>=` is not supported for types `str` and `int`, in comparing `Unknown | str` with `Unknown | int`
+ scipy/interpolate/tests/test_bsplines.py:2404:34: error[unsupported-operator] Operator `<` is not supported for types `str` and `int`, in comparing `Unknown | str` with `Unknown | int`
+ scipy/interpolate/tests/test_bsplines.py:2411:24: error[unsupported-operator] Operator `-` is unsupported between objects of type `Unknown | str` and `Unknown | int`
+ scipy/spatial/tests/test_distance.py:226:39: error[invalid-argument-type] Argument to bound method `any` is incorrect: Expected `Literal[0, -1] | tuple[()] | None`, found `tuple[int, ...]`
- Found 9429 diagnostics
+ Found 9433 diagnostics

No memory usage changes detected ✅

@astral-sh-bot
Copy link

astral-sh-bot bot commented Nov 13, 2025

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-argument-type 23 0 8
unused-ignore-comment 0 23 0
invalid-assignment 10 0 8
invalid-return-type 6 0 3
no-matching-overload 7 0 0
possibly-missing-attribute 4 1 2
unsupported-operator 6 0 1
unresolved-attribute 6 0 0
type-assertion-failure 0 3 0
not-iterable 2 0 0
call-non-callable 1 0 0
non-subscriptable 1 0 0
redundant-cast 1 0 0
Total 67 27 22

Full report with detailed diff (timing results)

@sharkdp sharkdp force-pushed the david/generator-expression-inference branch from 60aa369 to 820fa72 Compare November 14, 2025 10:57
@sharkdp sharkdp marked this pull request as ready for review November 14, 2025 11:14
@sharkdp sharkdp enabled auto-merge (squash) November 14, 2025 12:58
@sharkdp sharkdp merged commit 05cf53a into main Nov 14, 2025
40 checks passed
@sharkdp sharkdp deleted the david/generator-expression-inference branch November 14, 2025 13:04
dcreager added a commit that referenced this pull request Nov 14, 2025
* origin/main: (59 commits)
  [ty] Improve diagnostic range for `non-subscriptable` diagnostics (#21461)
  [ty] Improve literal promotion heuristics (#21439)
  [ty] Further improve details around which expressions should be deferred in stub files (#21456)
  [ty] Improve generic class constructor inference (#21442)
  [ty] Propagate type context through conditional expressions (#21443)
  [ty] Suppress completions when introducing names with `as`
  [ty] Add panic-by-default await methods to `TestServer` (#21451)
  [ty] name is parameter and global is a syntax error (#21312)
  [ty] Fixup a few details around version-specific dataclass features (#21453)
  [ty] Support attribute-expression `TYPE_CHECKING` conditionals (#21449)
  [ty] Support stringified annotations in value-position `Annotated` instances (#21447)
  [ty] Type inference for genererator expressions (#21437)
  [ty] Make `__getattr__` available for `ModuleType` instances (#21450)
  [ty] Increase default receive timeout in tests to 10s (#21448)
  [ty] Add synthetic members to completions on dataclasses (#21446)
  [ty] Support legacy `typing` special forms in implicit type aliases (#21433)
  Bump 0.14.5 (#21435)
  [ty] Support `type[…]` and `Type[…]` in implicit type aliases (#21421)
  [ty] Respect notebook cell boundaries when adding an auto import (#21322)
  Update PyCharm setup instructions (#21409)
  ...
dcreager added a commit that referenced this pull request Nov 14, 2025
* dcreager/deep-comparison: (64 commits)
  assuming
  SubtypingAssuming
  implies_subtype_of
  name tweak
  Apply suggestions from code review
  [ty] Improve diagnostic range for `non-subscriptable` diagnostics (#21461)
  [ty] Improve literal promotion heuristics (#21439)
  [ty] Further improve details around which expressions should be deferred in stub files (#21456)
  [ty] Improve generic class constructor inference (#21442)
  [ty] Propagate type context through conditional expressions (#21443)
  [ty] Suppress completions when introducing names with `as`
  [ty] Add panic-by-default await methods to `TestServer` (#21451)
  [ty] name is parameter and global is a syntax error (#21312)
  [ty] Fixup a few details around version-specific dataclass features (#21453)
  [ty] Support attribute-expression `TYPE_CHECKING` conditionals (#21449)
  [ty] Support stringified annotations in value-position `Annotated` instances (#21447)
  [ty] Type inference for genererator expressions (#21437)
  [ty] Make `__getattr__` available for `ModuleType` instances (#21450)
  [ty] Increase default receive timeout in tests to 10s (#21448)
  [ty] Add synthetic members to completions on dataclasses (#21446)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type inference for generator expressions

2 participants

Comments