[ty] Infer lambda parameter types with Callable type context#24317
[ty] Infer lambda parameter types with Callable type context#24317ibraheemdev merged 2 commits intomainfrom
Callable type context#24317Conversation
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 reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
flake8
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
77 | 0 | 11 |
invalid-await |
1 | 40 | 0 |
unresolved-attribute |
32 | 0 | 2 |
unused-type-ignore-comment |
2 | 15 | 0 |
unsupported-operator |
14 | 0 | 0 |
not-subscriptable |
13 | 0 | 0 |
invalid-assignment |
4 | 2 | 4 |
invalid-return-type |
0 | 6 | 0 |
not-iterable |
1 | 0 | 4 |
missing-argument |
1 | 0 | 0 |
unknown-argument |
1 | 0 | 0 |
| Total | 146 | 63 | 21 |
Raw diff (230 changes)
Expression (https://github.com/cognitedata/Expression)
+ expression/extra/parser.py:160:56 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Parser[_A@choice]`
- tests/test_result.py:535:26 error[invalid-argument-type] Argument to bound method `Result.or_else_with` is incorrect: Expected `(Literal["original error"], /) -> Result[Any, Literal["original error"]]`, found `(error: Literal["original error"]) -> Result[Any, str]`
+ tests/test_result.py:535:26 error[invalid-argument-type] Argument to bound method `Result.or_else_with` is incorrect: Expected `(Literal["original error"], /) -> Result[Any, Literal["original error"]]`, found `(error: Literal["original error"]) -> Result[Any, Literal["new error from original error"]]`
PyWinCtl (https://github.com/Kalmat/PyWinCtl)
- src/pywinctl/_main.py:831:49 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:832:60 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:833:56 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:835:56 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:836:67 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:837:63 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:838:57 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:839:66 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:840:71 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- src/pywinctl/_main.py:841:98 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
attrs (https://github.com/python-attrs/attrs)
- tests/test_cmp.py:364:23 error[invalid-argument-type] Argument to function `cmp_using` is incorrect: Expected `((Any, Any, /) -> bool) | None`, found `(a: Any, b: Any) -> _NotImplementedType | (bool & Unknown)`
+ tests/test_cmp.py:364:23 error[invalid-argument-type] Argument to function `cmp_using` is incorrect: Expected `((Any, Any, /) -> bool) | None`, found `(a: Any, b: Any) -> _NotImplementedType | (bool & Any)`
cki-lib (https://gitlab.com/cki-project/cki-lib)
- cki_lib/owners.py:319:16 error[invalid-return-type] Return type does not match returned value: expected `None`, found `str`
core (https://github.com/home-assistant/core)
+ homeassistant/bootstrap.py:631:9 error[invalid-argument-type] Argument to bound method `Logger.exception` is incorrect: Expected `None | bool | tuple[type[BaseException], BaseException, TracebackType | None] | tuple[None, None, None] | BaseException`, found `tuple[type[BaseException], BaseException | None, TracebackType | None]`
+ homeassistant/components/fronius/sensor.py:611:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:611:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:620:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/fronius/sensor.py:637:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:637:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:646:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/fronius/sensor.py:663:36 error[invalid-argument-type] Argument to function `max` is incorrect: Argument type `str | int | float | None` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ homeassistant/components/fronius/sensor.py:663:36 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[0]`, found `StateType`
+ homeassistant/components/fronius/sensor.py:673:36 error[unsupported-operator] Operator `-` is not supported between objects of type `Literal[0]` and `StateType`
+ homeassistant/components/gardena_bluetooth/sensor.py:62:48 error[invalid-assignment] Object of type `(x: T@GardenaBluetoothSensorEntityDescription | None) -> T@GardenaBluetoothSensorEntityDescription | None` is not assignable to `(T@GardenaBluetoothSensorEntityDescription | None, /) -> SensorRawType`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/settings/symbol_db.py:25:83 error[unresolved-attribute] Object of type `Env` has no attribute `includes`
+ tests/debugging/exploration/_config.py:81:19 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/debugging/exploration/_config.py:81:46 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/debugging/exploration/_config.py:87:28 error[unresolved-attribute] Object of type `Env` has no attribute `conservative`
+ tests/debugging/exploration/_config.py:89:26 error[unresolved-attribute] Object of type `Env` has no attribute `conservative`
+ tests/internal/bytecode_injection/framework_injection/_config.py:59:19 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ tests/internal/bytecode_injection/framework_injection/_config.py:59:46 error[unresolved-attribute] Object of type `Env` has no attribute `output_file`
+ ddtrace/internal/settings/dynamic_instrumentation.py:123:97 error[unresolved-attribute] Object of type `Env` has no attribute `redacted_types`
+ ddtrace/internal/settings/dynamic_instrumentation.py:124:12 error[unresolved-attribute] Object of type `Env` has no attribute `redacted_types`
egglog-python (https://github.com/egraphs-good/egglog-python)
- python/egglog/exp/array_api.py:2031:71 error[invalid-argument-type] Argument to bound method `NDArray.if_` is incorrect: Expected `() -> NDArray`, found `() -> Value | Unknown | Int`
+ python/egglog/exp/array_api.py:2031:71 error[invalid-argument-type] Argument to bound method `NDArray.if_` is incorrect: Expected `() -> NDArray`, found `() -> Value | Int | i64 | ... omitted 5 union elements`
+ python/egglog/exp/array_api.py:2031:79 error[invalid-argument-type] Method `__getitem__` of type `bound method Vec[Int].__getitem__(index: i64 | int) -> Int` cannot be called with key of type `Int` on object of type `Vec[Int]`
+ python/egglog/exp/array_api.py:2031:79 error[invalid-argument-type] Method `__getitem__` of type `bound method Vec[Value].__getitem__(index: i64 | int) -> Value` cannot be called with key of type `Int` on object of type `Vec[Value]`
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:1735:52 error[invalid-assignment] Object of type `((x: str | None) -> object) | (((str | None, /) -> str | None) & ~Top[Mapping[Unknown, object]])` is not assignable to `(str | None, /) -> str | None`
- src/hydra_zen/wrapper/_implementations.py:1736:59 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
ignite (https://github.com/pytorch/ignite)
+ tests/ignite/handlers/test_checkpoint.py:272:92 error[unresolved-attribute] Object of type `State` has no attribute `score`
+ tests/ignite/handlers/test_checkpoint.py:348:89 error[unresolved-attribute] Object of type `State` has no attribute `score`
jax (https://github.com/google/jax)
- jax/_src/interpreters/mlir.py:1904:42 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Unknown]` is not iterable
+ jax/_src/interpreters/mlir.py:1904:42 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Any]` is not iterable
- jax/_src/interpreters/mlir.py:1907:37 error[invalid-argument-type] Argument to function `safe_zip` is incorrect: Expected `Iterable[Unknown]`, found `WeakrefCachedFunc[(...), Unknown]`
+ jax/_src/interpreters/mlir.py:1907:37 error[invalid-argument-type] Argument to function `safe_zip` is incorrect: Expected `Iterable[Unknown]`, found `WeakrefCachedFunc[(...), Any]`
- jax/_src/interpreters/mlir.py:2628:41 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Unknown]`
+ jax/_src/interpreters/mlir.py:2628:41 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Any]`
- jax/_src/interpreters/mlir.py:2630:38 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Unknown]` is not iterable
+ jax/_src/interpreters/mlir.py:2630:38 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Any]` is not iterable
- jax/_src/interpreters/pxla.py:862:7 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Unknown]`
+ jax/_src/interpreters/pxla.py:862:7 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Any]`
- jax/_src/lax/lax.py:1911:41 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Unknown]`
+ jax/_src/lax/lax.py:1911:41 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Any]`
- jax/_src/lax/lax.py:1914:22 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Unknown]` is not iterable
+ jax/_src/lax/lax.py:1914:22 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Any]` is not iterable
- jax/_src/pjit.py:1371:45 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Unknown]`
+ jax/_src/pjit.py:1371:45 error[invalid-argument-type] Argument to function `unzip2` is incorrect: Expected `Iterable[tuple[Unknown, Unknown]]`, found `WeakrefCachedFunc[(...), Any]`
- jax/_src/pjit.py:1385:22 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Unknown]` is not iterable
+ jax/_src/pjit.py:1385:22 error[not-iterable] Object of type `WeakrefCachedFunc[(...), Any]` is not iterable
jinja (https://github.com/pallets/jinja)
+ examples/basic/translate.py:5:43 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[str, str].__getitem__(key: str, /) -> str` cannot be called with key of type `int` on object of type `dict[str, str]`
+ tests/test_async.py:655:60 error[not-iterable] Object of type `int` is not iterable
+ tests/test_ext.py:291:44 error[unresolved-attribute] Object of type `int` has no attribute `upper`
meson (https://github.com/mesonbuild/meson)
+ mesonbuild/backend/ninjabackend.py:1949:81 error[unresolved-attribute] Attribute `startswith` is not defined on `None` in union `str | None`
mypy (https://github.com/python/mypy)
+ mypy/semanal.py:7188:50 error[invalid-argument-type] Argument to function `isinstance` is incorrect: Expected `type | UnionType | tuple[Divergent, ...]`, found `object`
+ mypy/semanal.py:7189:44 error[unresolved-attribute] Object of type `object` has no attribute `type`
+ mypy/semanal.py:7201:23 error[unresolved-attribute] Object of type `object` has no attribute `type`
optuna (https://github.com/optuna/optuna)
+ optuna/samplers/_tpe/_erf.py:117:72 error[invalid-assignment] Object of type `list[((ndarray[Unknown, dtype[Any]], /) -> ndarray[Unknown, dtype[Any]]) | ((x: ndarray[Unknown, dtype[Any]]) -> float64 | Any)]` is not assignable to `list[(ndarray[Unknown, dtype[Any]], /) -> ndarray[Unknown, dtype[Any]]]`
+ tests/visualization_tests/test_contour.py:523:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_edf.py:172:33 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_parallel_coordinate.py:780:33 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_param_importances.py:273:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_param_importances.py:295:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:333:13 error[invalid-argument-type] Argument to function `_get_pareto_front_info` is incorrect: Expected `((FrozenTrial, /) -> Sequence[int | float]) | None`, found `(t: FrozenTrial) -> int | float | Unknown`
+ tests/visualization_tests/test_pareto_front.py:333:31 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:32 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:45 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_pareto_front.py:351:58 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_rank.py:615:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
+ tests/visualization_tests/test_slice.py:403:26 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
paasta (https://github.com/yelp/paasta)
- paasta_tools/setup_prometheus_adapter_config.py:983:12 error[invalid-return-type] Return type does not match returned value: expected `PrometheusAdapterConfig`, found `dict[str, list[PrometheusAdapterRule | UnspecializedTypeVar]]`
pandas (https://github.com/pandas-dev/pandas)
+ pandas/tests/extension/base/methods.py:445:48 error[unsupported-operator] Operator `<=` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:458:49 error[unsupported-operator] Operator `<=` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:494:47 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:498:48 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/base/methods.py:502:49 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:12:46 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:16:51 error[invalid-argument-type] Argument to function `min` is incorrect: Argument type `Hashable` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ pandas/tests/series/methods/test_combine.py:16:54 error[invalid-argument-type] Argument to function `min` is incorrect: Argument type `Hashable` does not satisfy upper bound `SupportsDunderLT[Any] | SupportsDunderGT[Any]` of type variable `SupportsRichComparisonT`
+ pandas/tests/series/methods/test_combine.py:24:44 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/series/methods/test_combine.py:35:46 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/test_categorical.py:127:48 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
+ pandas/tests/extension/test_categorical.py:134:49 error[unsupported-operator] Operator `+` is not supported between two objects of type `Hashable`
- pandas/tests/frame/methods/test_map.py:101:46 error[invalid-argument-type] Argument to bound method `DataFrame.map` is incorrect: Expected `(Any, /) -> Any`, found `(x: Any, y) -> Unknown`
+ pandas/tests/frame/methods/test_map.py:101:46 error[invalid-argument-type] Argument to bound method `DataFrame.map` is incorrect: Expected `(Any, /) -> Any`, found `(x: Any, y) -> Any`
- pandas/tseries/holiday.py:412:20 error[invalid-return-type] Return type does not match returned value: expected `DatetimeIndex`, found `Index`
prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-docker/tests/test_containers.py:26:31 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_containers.py:41:26 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_containers.py:54:31 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_containers.py:67:31 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_containers.py:80:31 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `bool | None`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, str] | list[str] | None`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `str | list[str] | None`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:27:47 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool | dict[str, int] | None`
+ src/integrations/prefect-docker/tests/test_containers.py:42:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:55:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:68:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_containers.py:81:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
- src/integrations/prefect-docker/tests/test_images.py:28:27 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_images.py:48:27 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-docker/tests/test_images.py:63:28 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-docker/tests/test_images.py:29:47 error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:29:47 error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:29:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:31:16 error[unresolved-attribute] Attribute `id` is not defined on `list[Unknown]` in union `Unknown | list[Unknown]`
+ src/integrations/prefect-docker/tests/test_images.py:51:17 error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:51:17 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
+ src/integrations/prefect-docker/tests/test_images.py:53:16 error[unresolved-attribute] Attribute `id` is not defined on `list[Unknown]` in union `Unknown | list[Unknown]`
+ src/integrations/prefect-docker/tests/test_images.py:64:47 error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47 error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47 error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:64:47 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool`
- src/integrations/prefect-docker/tests/test_images.py:16:23 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `DockerHost | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `DockerRegistryCredentials | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `bool`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `str | None`, found `str | bool`
+ src/integrations/prefect-docker/tests/test_images.py:16:44 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `str | bool`
- src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:425:33 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-kubernetes/prefect_kubernetes/jobs.py:428:17 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `str`
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:16:15 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:24:15 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:33:15 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:46:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:98:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:144:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:190:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:236:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:274:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_custom_objects.py:332:11 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:20:13 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:29:13 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:38:13 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `None`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:57:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:103:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:149:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:195:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:240:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:286:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_custom_objects.py:344:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
- src/integrations/prefect-kubernetes/tests/test_deployments.py:16:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_deployments.py:34:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_deployments.py:68:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_deployments.py:88:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_deployments.py:110:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_deployments.py:137:11 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:18:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:38:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:70:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:92:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:113:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_deployments.py:141:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
- src/integrations/prefect-kubernetes/tests/test_jobs.py:34:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:50:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:66:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:84:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:104:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:127:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_jobs.py:156:11 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:36:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:52:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:68:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:87:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:107:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:131:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_jobs.py:159:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
- src/integrations/prefect-kubernetes/tests/test_pods.py:27:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:42:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:76:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:92:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:112:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:133:11 error[invalid-await] `object` is not awaitable
- src/integrations/prefect-kubernetes/tests/test_pods.py:163:11 error[invalid-await] `object` is not awaitable
+ src/integrations/prefect-kubernetes/tests/test_pods.py:29:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:46:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:78:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:96:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:115:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:137:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
+ src/integrations/prefect-kubernetes/tests/test_pods.py:167:9 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Any]`, found `Literal["test"]`
- src/prefect/cache_policies.py:311:25 error[unresolved-attribute] Object of type `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` has no attribute `__code__`
+ src/prefect/cache_policies.py:311:25 error[unresolved-attribute] Object of type `(...) -> Any` has no attribute `__code__`
+ src/prefect/cli/_transfer_utils.py:96:53 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_work_pool`
+ src/prefect/cli/_transfer_utils.py:97:55 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_work_queue`
+ src/prefect/cli/_transfer_utils.py:98:55 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_deployment`
+ src/prefect/cli/_transfer_utils.py:99:43 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_flow`
+ src/prefect/cli/_transfer_utils.py:102:41 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_block_document`
+ src/prefect/cli/_transfer_utils.py:104:55 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_block_type`
+ src/prefect/cli/_transfer_utils.py:107:43 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_block_schema`
+ src/prefect/cli/_transfer_utils.py:109:51 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_variable`
+ src/prefect/cli/_transfer_utils.py:110:55 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_automation`
+ src/prefect/cli/_transfer_utils.py:113:44 error[unresolved-attribute] Object of type `MigratableProtocol` has no attribute `source_global_concurrency_limit`
+ src/prefect/task_engine.py:1642:28 error[invalid-await] `R@AsyncTaskRunEngine | Coroutine[Any, Any, R@AsyncTaskRunEngine]` is not awaitable
- src/prefect/tasks.py:2250:16 error[invalid-return-type] Return type does not match returned value: expected `MaterializingTask[P@MaterializingTask, R@MaterializingTask]`, found `MaterializingTask[(*args: object, **kwargs: object), object]`
- src/prefect/tasks.py:185:9 error[unresolved-attribute] Object of type `((...) -> Any) & ((*args: object, **kwargs: object) -> object)` has no attribute `__code__`
+ src/prefect/tasks.py:185:9 error[unresolved-attribute] Object of type `(...) -> Any` has no attribute `__code__`
- src/prefect/tasks.py:663:13 error[invalid-assignment] Object of type `Any & ~AlwaysFalsy` is not assignable to attribute `__prefect_self__` on type `((**P@Task) -> R@Task) & ((*args: object, **kwargs: object) -> object)`
+ src/prefect/tasks.py:663:13 error[unresolved-attribute] Unresolved attribute `__prefect_self__` on type `(**P@Task) -> R@Task`
- src/prefect/tasks.py:799:13 error[invalid-argument-type] Argument to `Task.__init__` is incorrect: Expected `(() -> str) | TaskRunNameCallbackWithParameters | str | None`, found `((() -> str) & ~<class 'NotSet'>) | TaskRunNameCallbackWithParameters | str | ... omitted 3 union elements`
+ src/prefect/tasks.py:799:13 error[invalid-argument-type] Argument to `Task.__init__` is incorrect: Expected `(() -> str) | TaskRunNameCallbackWithParameters | str | None`, found `(() -> str) | TaskRunNameCallbackWithParameters | str | (type[NotSet] & ~<class 'NotSet'>) | None`
- src/prefect/utilities/_engine.py:85:12 error[invalid-return-type] Return type does not match returned value: expected `str`, found `object`
- src/prefect/utilities/_engine.py:64:13 error[invalid-argument-type] Argument to bound method `TaskRunNameCallbackWithParameters.is_callback_with_parameters` is incorrect: Expected `(...) -> str`, found `(str & Top[(...) -> object]) | ((() -> str) & ((*args: object, **kwargs: object) -> object)) | (TaskRunNameCallbackWithParameters & ((*args: object, **kwargs: object) -> object))`
+ src/prefect/utilities/_engine.py:64:13 error[invalid-argument-type] Argument to bound method `TaskRunNameCallbackWithParameters.is_callback_with_parameters` is incorrect: Expected `(...) -> str`, found `(str & Top[(...) -> object]) | (() -> str) | TaskRunNameCallbackWithParameters`
+ src/prefect/utilities/_engine.py:66:48 error[unknown-argument] Argument `parameters` does not match any known parameter
+ src/prefect/utilities/_engine.py:69:29 error[missing-argument] No argument provided for required parameter `parameters` of bound method `TaskRunNameCallbackWithParameters.__call__`
pycryptodome (https://github.com/Legrandin/pycryptodome)
+ lib/Crypto/SelfTest/Protocol/test_KDF.py:141:52 error[invalid-argument-type] Argument to function `new` is incorrect: Expected `bytes | bytearray | memoryview[int]`, found `int`
pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_mock_val_ser.py:137:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `validator` of type `SchemaValidator | PluggableSchemaValidator`
+ pydantic/_internal/_mock_val_ser.py:137:5 error[invalid-assignment] Object of type `MockValSer[SchemaValidator | PluggableSchemaValidator]` is not assignable to attribute `validator` of type `SchemaValidator | PluggableSchemaValidator`
- pydantic/_internal/_mock_val_ser.py:143:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `serializer` of type `SchemaSerializer`
+ pydantic/_internal/_mock_val_ser.py:143:5 error[invalid-assignment] Object of type `MockValSer[SchemaSerializer]` is not assignable to attribute `serializer` of type `SchemaSerializer`
- pydantic/_internal/_mock_val_ser.py:178:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `__pydantic_validator__` of type `SchemaValidator | PluggableSchemaValidator`
+ pydantic/_internal/_mock_val_ser.py:178:5 error[invalid-assignment] Object of type `MockValSer[SchemaValidator | PluggableSchemaValidator]` is not assignable to attribute `__pydantic_validator__` of type `SchemaValidator | PluggableSchemaValidator`
- pydantic/_internal/_mock_val_ser.py:184:5 error[invalid-assignment] Object of type `MockValSer[Unknown]` is not assignable to attribute `__pydantic_serializer__` of type `SchemaSerializer`
+ pydantic/_internal/_mock_val_ser.py:184:5 error[invalid-assignment] Object of type `MockValSer[SchemaSerializer]` is not assignable to attribute `__pydantic_serializer__` of type `SchemaSerializer`
+ pydantic/main.py:110:81 error[invalid-assignment] Object of type `dict[str, ((model: BaseModel, name: str, val: Any) -> None) | ((model: BaseModel, name: str, val: Any) -> dict[str, Any] | tuple[dict[str, Any], dict[str, Any] | None, set[str]] | Any)]` is not assignable to `Mapping[str, (BaseModel, str, Any, /) -> None]`
rotki (https://github.com/rotki/rotki)
+ rotkehlchen/chain/evm/node_inquirer.py:1395:21 error[invalid-argument-type] Argument to bound method `EtherscanLikeApi.get_l1_fee` is incorrect: Expected `Literal[ChainID.OPTIMISM, ChainID.BASE, ChainID.SCROLL]`, found `Literal[ChainID.ETHEREUM, ChainID.OPTIMISM, ChainID.POLYGON_POS, ChainID.ARBITRUM_ONE, ChainID.BASE, ... omitted 5 literals]`
schema_salad (https://github.com/common-workflow-language/schema_salad)
+ schema_salad/dlang_codegen.py:440:50 error[unsupported-operator] Operator `&` is not supported between two objects of type `Sized`
static-frame (https://github.com/static-frame/static-frame)
- static_frame/test/unit/test_series.py:2682:65 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- static_frame/test/unit/test_store_zip.py:187:61 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ static_frame/test/unit/test_yarn.py:1676:53 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1691:41 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1696:37 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `Any | tuple[Any, Any]`
+ static_frame/test/unit/test_yarn.py:1712:53 error[unresolved-attribute] Attribute `size` is not defined on `tuple[Any, Any]` in union `@Todo | tuple[Any, Any]`
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/watcher/local_sources_watcher.py:259:72 error[invalid-assignment] Object of type `list[((ModuleType, /) -> list[str | None]) | ((m: ModuleType) -> list[Never] | list[str | None])]` is not assignable to `list[(ModuleType, /) -> list[str | None]]`
+ lib/streamlit/watcher/local_sources_watcher.py:284:18 error[invalid-argument-type] Argument to `list.__init__` is incorrect: Expected `Iterable[str | None]`, found `object`
sympy (https://github.com/sympy/sympy)
+ sympy/core/basic.py:787:33 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/matrices/matrixbase.py:2644:72 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/matrices/matrixbase.py:2736:71 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
+ sympy/plotting/plot.py:104:28 error[not-subscriptable] Cannot subscript object of type `Basic` with no `__getitem__` method
+ sympy/plotting/plot.py:104:52 error[not-subscriptable] Cannot subscript object of type `Basic` with no `__getitem__` method
+ sympy/tensor/array/array_derivatives.py:52:52 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
vision (https://github.com/pytorch/vision)
+ test/builtin_dataset_mocks.py:644:21 error[invalid-argument-type] Argument to function `create_image_folder` is incorrect: Expected `(int, /) -> str`, found `(idx: int) -> str | int | Unknown`
+ test/builtin_dataset_mocks.py:646:21 error[invalid-argument-type] Argument to function `create_image_folder` is incorrect: Expected `Sequence[int] | int | ((int, /) -> Sequence[int] | int) | None`, found `(idx: int) -> tuple[Literal[3], str | int | Unknown, str | int | Unknown]`
zulip (https://github.com/zulip/zulip)
- zerver/lib/display_recipient.py:77:12 error[invalid-return-type] Return type does not match returned value: expected `dict[int, UserDisplayRecipient]`, found `dict[int, dict[str, Any] | UserDisplayRecipient]`2583e1a to
7eda4ee
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
0026c70 to
8804a2c
Compare
37b6769 to
3b5d296
Compare
|
I haven't looked too closely at the ecosystem report but those diagnostics look expected, as this PR increases our type inference coverage quite significantly where we would previously infer |
d846470 to
61ab8ef
Compare
dcreager
left a comment
There was a problem hiding this comment.
Awesome! 👍 to the new statement-level inference region
| } | ||
| } | ||
| ast::Expr::Lambda(lambda) => { | ||
| if let Some(current_statement) = self.current_statement_mut() { |
There was a problem hiding this comment.
Are there places where we could encounter a lambda that's not in some statement?
| use rustc_hash::{FxHashMap, FxHashSet}; | ||
| use salsa; | ||
| use salsa::plumbing::AsId; | ||
| use ty_python_core::statement::StatementInner; |
There was a problem hiding this comment.
very nit: should this be down in the next section, near the other ty_python_core imports?
fb4c442 to
959bd84
Compare
959bd84 to
3aaf9ed
Compare
Improves #22633 to infer the use of lambda parameters in a lambda body with type context, e.g.,
Unlike other definitions, lambda parameter types cannot be determined purely syntactically in semantic indexing. Instead, they depend on the inferred type of the lambda to access its parameter types. Unfortunately, this makes lambda inference cyclic, as the body of the lambda depends on the outer lambda type, and there is no obvious way of splitting out inference of the lambda parameter types from its return type.
To avoid initiating cycles on the entire scope containing the lambda, this PR introduces a new inference query — statement-level inference. Statements are a minimal unit of code that encapsulate any internal type context. This makes them very useful to infer a given sub-expression "naturally" without having to provide any external type context. There are other places where we currently rely on scope-level inference for this purpose (e.g., see
infer_complete_scope_types, the current implementation of #23761, and the discussion in astral-sh/ty#3124). Note that statement-level inference is not perfectly fine-grained, e.g., the test expression of anifstatement does not require external type context and is independent from its body, so statement-level inference may lead to unnecessarily large cycles, but having the unit of code being generalized to an AST structure allows us to avoid the need for such special cases, but this can always change in the future.Additionally, many statements are simply wrappers around definitions or standalone expressions, so we can avoid extra salsa allocations in the common case.