[ty] Use peer context for collection literals#25848
Merged
Merged
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 94.36%. The percentage of expected errors that received a diagnostic held steady at 88.82%. The number of fully passing files held steady at 93/134. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdownsphinx
flake8
prefect
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
0 | 18 | 8 |
unresolved-attribute |
2 | 1 | 16 |
no-matching-overload |
0 | 9 | 0 |
invalid-assignment |
0 | 2 | 6 |
unsupported-operator |
1 | 6 | 1 |
invalid-return-type |
0 | 1 | 3 |
not-subscriptable |
0 | 1 | 0 |
redundant-cast |
1 | 0 | 0 |
| Total | 4 | 38 | 34 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Raw diff (76 changes)
apprise (https://github.com/caronc/apprise)
- apprise/utils/parse.py:734:12 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
- apprise/utils/parse.py:755:17 error[no-matching-overload] No overload of bound method `Pattern.search` matches arguments
- apprise/utils/parse.py:765:44 error[no-matching-overload] No overload of function `split` matches arguments
- apprise/utils/parse.py:771:52 error[no-matching-overload] No overload of function `split` matches arguments
- apprise/utils/parse.py:776:14 error[no-matching-overload] No overload of function `search` matches arguments
- apprise/utils/parse.py:790:13 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["port"]` and value of type `int` on object of type `dict[str, None | str | dict[Unknown, Unknown]]`
- apprise/utils/parse.py:832:9 error[unsupported-operator] Operator `+=` is not supported between objects of type `None` and `None | str | dict[Unknown, Unknown] | Unknown`
- apprise/utils/parse.py:832:9 error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown, Unknown]` and `None | str | dict[Unknown, Unknown] | Unknown`
- apprise/utils/parse.py:832:9 error[unsupported-operator] Operator `+=` is not supported between objects of type `str` and `None | str | dict[Unknown, Unknown] | Unknown`
- apprise/utils/parse.py:839:5 error[unsupported-operator] Operator `+=` is not supported between objects of type `None` and `None | str | dict[Unknown, Unknown] | Unknown`
- apprise/utils/parse.py:839:5 error[unsupported-operator] Operator `+=` is not supported between objects of type `dict[Unknown, Unknown]` and `None | str | dict[Unknown, Unknown] | Unknown`
- apprise/utils/parse.py:839:5 error[unsupported-operator] Operator `+=` is not supported between objects of type `str` and `None | str | dict[Unknown, Unknown] | Unknown`
+ apprise/utils/parse.py:756:26 error[unresolved-attribute] Attribute `group` is not defined on `None` in union `Match[str] | None`
+ apprise/utils/parse.py:757:27 error[unresolved-attribute] Attribute `group` is not defined on `None` in union `Match[str] | None`
+ apprise/utils/parse.py:849:9 error[unsupported-operator] Operator `+=` is not supported between objects of type `str` and `(str & ~AlwaysFalsy) | Unknown | None`
attrs (https://github.com/python-attrs/attrs)
- src/attr/_make.py:262:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `dict[Unknown, Unknown] | Mapping[str, object]`
+ src/attr/_make.py:262:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `Mapping[str, object]`
core (https://github.com/home-assistant/core)
- homeassistant/components/thread/diagnostics.py:209:21 error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[str]`, `list[Unknown]`, `None` in union `str | list[str] | list[Unknown] | dict[Unknown, Unknown] | None`
+ homeassistant/components/thread/diagnostics.py:209:21 error[unresolved-attribute] Attribute `update` is not defined on `str`, `list[str]`, `None` in union `str | list[str] | dict[Unknown, Unknown] | None`
- homeassistant/components/thread/diagnostics.py:212:21 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `Unknown` on object of type `list[Unknown]`
- homeassistant/components/thread/diagnostics.py:214:36 error[unresolved-attribute] Attribute `keys` is not defined on `str`, `list[str]`, `list[Unknown]`, `None` in union `str | list[str] | list[Unknown] | dict[Unknown, Unknown] | None`
+ homeassistant/components/thread/diagnostics.py:214:36 error[unresolved-attribute] Attribute `keys` is not defined on `str`, `list[str]`, `None` in union `str | list[str] | dict[Unknown, Unknown] | None`
- homeassistant/config_entries.py:1334:17 error[invalid-argument-type] Argument to bound method `ConfigEntriesFlowManager.async_init` is incorrect: Expected `ConfigFlowContext | None`, found `ConfigFlowContext | dict[str, object]`
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/llmobs/_experiment.py:2152:28 warning[redundant-cast] Value is already of type `int`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `Prompt | dict[str, str | dict[str, Any] | list[str] | list[dict[str, str]] | list[Message]] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `dict[str, Any] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `dict[str, str] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[Document] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[_SpanLink] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[str] | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/google_genai.py:106:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `str | None`, found `list[ToolDefinition] | Unknown`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `Prompt | dict[str, str | dict[str, Any] | list[str] | list[dict[str, str]] | list[Message]] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `dict[str, Any] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `dict[str, str] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[Message] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[ToolDefinition] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[_SpanLink] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `list[str] | None`, found `Unknown | list[Document]`
- ddtrace/llmobs/_integrations/langchain.py:701:13 error[invalid-argument-type] Argument to function `_annotate_llmobs_span_data` is incorrect: Expected `str | None`, found `Unknown | list[Document]`
dulwich (https://github.com/dulwich/dulwich)
- dulwich/client.py:5239:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["timeout"]` and value of type `int | float` on object of type `dict[str, dict[str | Unknown, str | Unknown] | bool]`
+ dulwich/client.py:5239:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["timeout"]` and value of type `int | float` on object of type `dict[str, dict[str, str | Unknown] | bool]`
- dulwich/client.py:5242:62 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `Sequence[tuple[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | RequestField] | Mapping[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | None`, found `dict[str | Unknown, str | Unknown] | bool`
+ dulwich/client.py:5242:62 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `Sequence[tuple[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | RequestField] | Mapping[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | None`, found `dict[str, str | Unknown] | bool`
- dulwich/client.py:5242:62 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `bytes | IO[Any] | Iterable[bytes | str] | None`, found `dict[str | Unknown, str | Unknown] | bool`
+ dulwich/client.py:5242:62 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `bytes | IO[Any] | Iterable[bytes | str] | None`, found `dict[str, str | Unknown] | bool`
- dulwich/client.py:5244:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["body"]` and value of type `bytes | Iterator[bytes]` on object of type `dict[str, dict[str | Unknown, str | Unknown] | bool]`
+ dulwich/client.py:5244:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["body"]` and value of type `bytes | Iterator[bytes]` on object of type `dict[str, dict[str, str | Unknown] | bool]`
- dulwich/client.py:5245:63 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `Sequence[tuple[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | RequestField] | Mapping[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | None`, found `dict[str | Unknown, str | Unknown] | bool`
+ dulwich/client.py:5245:63 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `Sequence[tuple[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | RequestField] | Mapping[str, str | bytes | tuple[str, str | bytes] | tuple[str, str | bytes, str]] | None`, found `dict[str, str | Unknown] | bool`
- dulwich/client.py:5245:63 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `bytes | IO[Any] | Iterable[bytes | str] | None`, found `dict[str | Unknown, str | Unknown] | bool`
+ dulwich/client.py:5245:63 error[invalid-argument-type] Argument to bound method `RequestMethods.request` is incorrect: Expected `bytes | IO[Any] | Iterable[bytes | str] | None`, found `dict[str, str | Unknown] | bool`
- dulwich/object_store.py:3182:12 error[unsupported-operator] Operator `in` is not supported between objects of type `ObjectID` and `(() -> dict[ObjectID, ObjectID]) | dict[ObjectID, ObjectID] | dict[Unknown, Unknown]`
+ dulwich/object_store.py:3182:12 error[unsupported-operator] Operator `in` is not supported between objects of type `ObjectID` and `(() -> dict[ObjectID, ObjectID]) | dict[ObjectID, ObjectID]`
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/modeltools.py:3039:13 error[no-matching-overload] No overload of bound method `MutableMapping.update` matches arguments
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- src/hydra_zen/wrapper/_implementations.py:446:13 error[invalid-argument-type] Argument is incorrect: Expected `[email protected]`, found `DictConfig | Unknown`
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/format.py:177:18 error[unresolved-attribute] Attribute `op` is not defined on `Node` in union `Node | Unknown`
+ ibis/expr/format.py:177:18 error[unresolved-attribute] Object of type `Node` has no attribute `op`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/msubprojects.py:332:36 error[unresolved-attribute] Attribute `upper` is not defined on `None` in union `str | None | Unknown`
+ mesonbuild/msubprojects.py:332:36 error[unresolved-attribute] Attribute `upper` is not defined on `None` in union `str | None`
- mesonbuild/wrap/wrap.py:694:28 error[invalid-assignment] Object of type `list[str | None | Unknown]` is not assignable to `list[str]`
+ mesonbuild/wrap/wrap.py:694:28 error[invalid-assignment] Object of type `list[str | None]` is not assignable to `list[str]`
mypy (https://github.com/python/mypy)
- mypy/checker.py:6371:20 error[invalid-return-type] Return type does not match returned value: expected `tuple[list[Type], list[Type]]`, found `tuple[list[Type], list[TypeVarType] | list[Unknown]]`
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/plugins/worksearch/code.py:344:13 error[invalid-argument-type] Argument to bound method `SearchScheme.q_to_solr_params` is incorrect: Expected `list[tuple[str, str]]`, found `list[tuple[str, str] | tuple[str, Unknown | int]] | Unknown`
+ openlibrary/plugins/worksearch/code.py:344:13 error[invalid-argument-type] Argument to bound method `SearchScheme.q_to_solr_params` is incorrect: Expected `list[tuple[str, str]]`, found `list[tuple[str, str] | tuple[str, Unknown | int]]`
paasta (https://github.com/yelp/paasta)
- paasta_tools/instance/kubernetes.py:949:12 error[invalid-return-type] Return type does not match returned value: expected `KubernetesVersionDict`, found `dict[str, Unknown | str | int | ... omitted 3 union elements]`
+ paasta_tools/instance/kubernetes.py:949:12 error[invalid-return-type] Return type does not match returned value: expected `KubernetesVersionDict`, found `dict[str, Unknown | str | int | list[dict[str, Any]] | None]`
pip (https://github.com/pypa/pip)
- src/pip/_vendor/urllib3/connectionpool.py:749:23 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[Unknown, Unknown]`
+ src/pip/_vendor/urllib3/connectionpool.py:749:23 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[str, Unknown]`
- src/pip/_vendor/urllib3/connectionpool.py:906:31 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[Unknown, Unknown]`
+ src/pip/_vendor/urllib3/connectionpool.py:906:31 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[str, Unknown]`
- src/pip/_vendor/urllib3/poolmanager.py:483:27 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Any | Mapping[str, str] | dict[Unknown, Unknown]`
+ src/pip/_vendor/urllib3/poolmanager.py:483:27 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Any | Mapping[str, str] | dict[str, Unknown]`
prefect (https://github.com/PrefectHQ/prefect)
- src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:824:38 error[invalid-argument-type] Argument to function `create_async_engine` is incorrect: Expected `str | URL`, found `URL | dict[str, Any] | dict[Unknown, Unknown] | Any`
+ src/integrations/prefect-sqlalchemy/prefect_sqlalchemy/database.py:824:38 error[invalid-argument-type] Argument to function `create_async_engine` is incorrect: Expected `str | URL`, found `URL | dict[str, Any] | Any`
- src/prefect/tasks.py:956:17 error[invalid-assignment] Invalid subscript assignment with key of type `str | Unknown` and value of type `set[RunInput]` on object of type `dict[str, set[TaskRunResult | FlowRunResult]]`
+ src/prefect/tasks.py:956:17 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `set[RunInput]` on object of type `dict[str, set[TaskRunResult | FlowRunResult]]`
- src/prefect/tasks.py:1061:17 error[invalid-assignment] Invalid subscript assignment with key of type `str | Unknown` and value of type `set[RunInput]` on object of type `dict[str, set[TaskRunResult | FlowRunResult]]`
+ src/prefect/tasks.py:1061:17 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `set[RunInput]` on object of type `dict[str, set[TaskRunResult | FlowRunResult]]`
pyodide (https://github.com/pyodide/pyodide)
- pyodide-build/pyodide_build/recipe/graph_builder.py:169:13 error[no-matching-overload] No overload of function `run` matches arguments
rotki (https://github.com/rotki/rotki)
- rotkehlchen/data_import/utils.py:75:21 error[unresolved-attribute] Attribute `append` is not defined on `bool` in union `Unknown | list[Unknown] | bool`
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/generation/metrics.py:75:31 error[unresolved-attribute] Attribute `__name__` is not defined on `(MetricContext, /) -> int | float` in union `((MetricContext, /) -> int | float) | Unknown`
+ src/schemathesis/generation/metrics.py:75:31 error[unresolved-attribute] Object of type `(MetricContext, /) -> int | float` has no attribute `__name__`
- src/schemathesis/generation/metrics.py:82:31 error[unresolved-attribute] Attribute `__name__` is not defined on `(MetricContext, /) -> int | float` in union `((MetricContext, /) -> int | float) | Unknown`
+ src/schemathesis/generation/metrics.py:82:31 error[unresolved-attribute] Object of type `(MetricContext, /) -> int | float` has no attribute `__name__`
- src/schemathesis/generation/metrics.py:95:43 error[unresolved-attribute] Attribute `__name__` is not defined on `(MetricContext, /) -> int | float` in union `((MetricContext, /) -> int | float) | Unknown`
+ src/schemathesis/generation/metrics.py:95:43 error[unresolved-attribute] Object of type `(MetricContext, /) -> int | float` has no attribute `__name__`
- src/schemathesis/generation/metrics.py:96:44 error[unresolved-attribute] Attribute `__name__` is not defined on `(MetricContext, /) -> int | float` in union `((MetricContext, /) -> int | float) | Unknown`
+ src/schemathesis/generation/metrics.py:96:44 error[unresolved-attribute] Object of type `(MetricContext, /) -> int | float` has no attribute `__name__`
scipy (https://github.com/scipy/scipy)
- scipy/stats/tests/common_tests.py:72:9 error[no-matching-overload] No overload of function `assert_allclose` matches arguments
setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/build_ext.py:435:13 error[invalid-assignment] Object of type `object` is not assignable to attribute `runtime_library_dirs` of type `list[str] | list[Unknown]`
+ setuptools/_distutils/command/build_ext.py:435:13 error[invalid-assignment] Object of type `object` is not assignable to attribute `runtime_library_dirs` of type `list[str]`
- setuptools/_distutils/compilers/C/base.py:446:16 error[invalid-return-type] Return type does not match returned value: expected `tuple[str, list[tuple[str] | tuple[str, str | None]], list[str]]`, found `tuple[str | None, list[tuple[str] | tuple[str, str | None]] | Unknown, list[str] | Unknown]`
+ setuptools/_distutils/compilers/C/base.py:446:16 error[invalid-return-type] Return type does not match returned value: expected `tuple[str, list[tuple[str] | tuple[str, str | None]], list[str]]`, found `tuple[str | None, list[tuple[str] | tuple[str, str | None]], list[str]]`
strawberry (https://github.com/strawberry-graphql/strawberry)
- strawberry/schema/schema.py:858:33 error[invalid-argument-type] Argument to function `subscribe` is incorrect: Expected `((...) -> Any) | None`, found `Unknown | MiddlewareManager | type[ExecutionContext] | None | dict[str, Any]`
+ strawberry/schema/schema.py:858:33 error[invalid-argument-type] Argument to function `subscribe` is incorrect: Expected `((...) -> Any) | None`, found `MiddlewareManager | type[ExecutionContext] | None | dict[str, Any]`
- strawberry/schema/schema.py:858:33 error[invalid-argument-type] Argument to function `subscribe` is incorrect: Expected `((...) -> Any) | None`, found `Unknown | MiddlewareManager | type[ExecutionContext] | None | dict[str, Any]`
+ strawberry/schema/schema.py:858:33 error[invalid-argument-type] Argument to function `subscribe` is incorrect: Expected `int`, found `MiddlewareManager | type[ExecutionContext] | None | dict[str, Any]`
- strawberry/schema/schema.py:858:33 error[invalid-argument-type] Argument to function `subscribe` is incorrect: Expected `int`, found `Unknown | MiddlewareManager | type[ExecutionContext] | None | dict[str, Any]`
urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/connectionpool.py:749:23 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[Unknown, Unknown]`
+ src/urllib3/connectionpool.py:749:23 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[str, Unknown]`
- src/urllib3/connectionpool.py:905:31 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[Unknown, Unknown]`
+ src/urllib3/connectionpool.py:905:31 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Mapping[str, str] | dict[str, Unknown]`
- src/urllib3/poolmanager.py:483:27 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Any | Mapping[str, str] | dict[Unknown, Unknown]`
+ src/urllib3/poolmanager.py:483:27 error[unresolved-attribute] Attribute `copy` is not defined on `Mapping[str, str]` in union `Any | Mapping[str, str] | dict[str, Unknown]`
vision (https://github.com/pytorch/vision)
- setup.py:285:20 error[unresolved-attribute] Attribute `copy` is not defined on `str` in union `str | list[str] | list[Unknown]`
+ setup.py:285:20 error[unresolved-attribute] Attribute `copy` is not defined on `str` in union `str | list[str]`
- setup.py:286:20 error[unresolved-attribute] Attribute `copy` is not defined on `str` in union `str | list[str] | list[Unknown]`
+ setup.py:286:20 error[unresolved-attribute] Attribute `copy` is not defined on `str` in union `str | list[str]`
xarray (https://github.com/pydata/xarray)
- xarray/tests/test_concat.py:292:16 error[no-matching-overload] No overload of function `concat` matches arguments
- xarray/tests/test_concat.py:305:14 error[no-matching-overload] No overload of function `concat` matches arguments| let db = self.db(); | ||
|
|
||
| let elements = operations | ||
| .into_iter() | ||
| .with_position() | ||
| .map(|(position, item)| { | ||
| let (ty, range) = infer_ty(self, item); | ||
| let peer_ty = if done || !track_peer_types || !needs_peer_type(&item) { |
Member
There was a problem hiding this comment.
Do we need both needs_peer_type and track_peer_types? Could needs_peer_type just always return false, to implement the same behavior? Or even, make it optional?
charliermarsh
approved these changes
Jun 11, 2026
AlexWaygood
reviewed
Jun 11, 2026
Comment on lines
+10550
to
+10551
| tcx.annotation | ||
| .is_none_or(|annotation| annotation == Type::Dynamic(DynamicType::UnspecializedTypeVar)) |
Member
There was a problem hiding this comment.
you can also write this as a simple matches! FWIW
Suggested change
| tcx.annotation | |
| .is_none_or(|annotation| annotation == Type::Dynamic(DynamicType::UnspecializedTypeVar)) | |
| matches!( | |
| tcx.annotation, | |
| Some(Type::Dynamic(DynamicType::UnspecializedTypeVar)) | None | |
| ) |
Contributor
Author
There was a problem hiding this comment.
Fair, but IMO not worth a follow-up PR; I think it's kind of a toss-up which is more readable tbh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use the type of peer operands as context when inferring fresh list, set, and dict literals in boolean and conditional expressions. This prevents empty literals from introducing
Unknownand preserves literal key types in fallback expressions such asvalues or []andbuild_sort_spec(params) or {"name": -1}.Peer context is applied speculatively and discarded if it introduces diagnostics, so it remains an inference hint rather than a new constraint. The implementation also preserves generic specialization by accumulating unguarded peer types before truthiness refinement, while retaining existing structured generic context when it is already useful.
Fixes astral-sh/ty#3574.
Fixes astral-sh/ty#3693.
Test Plan
Added/updated mdtests.
Ecosystem report is all good news. The new Apprise diagnostic is just a result of us not narrowing the place
result["fullpath"]to truthy based on a check ofresult.get("fullpath"). This is orthogonal, just exposed by our better inference forresultin the first place.