fix Infer input type of lambda based on 2nd argument to map() #438#4215
Draft
asukaminato0721 wants to merge 1 commit into
Draft
fix Infer input type of lambda based on 2nd argument to map() #438#4215asukaminato0721 wants to merge 1 commit into
asukaminato0721 wants to merge 1 commit into
Conversation
|
Diff from mypy_primer, showing the effect of this PR on open source code: egglog-python (https://github.com/egraphs-good/egglog-python)
- ERROR python/egglog/declarations.py:172:65-174:6: `dict[Ident, RulesetDecl]` is not assignable to `dict[Ident, CombinedRulesetDecl | RulesetDecl]` [bad-assignment]
cki-lib (https://gitlab.com/cki-project/cki-lib)
+ ERROR cki_lib/misc.py:536:41-59: `+` is not supported between `Literal['-']` and `bytes` [unsupported-operation]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ ERROR mitmproxy/utils/strutils.py:103:54-78: `+` is not supported between `bytes` and `Literal['\'']` [unsupported-operation]
+ ERROR mitmproxy/utils/strutils.py:107:23-84: `+` is not supported between `bytes` and `str` [unsupported-operation]
+ ERROR mitmproxy/utils/strutils.py:107:73-83: Invalid key for dict, got `bytes` [bad-index]
dulwich (https://github.com/dulwich/dulwich)
- ERROR dulwich/diff_tree.py:395:61-397:6: `defaultdict[Unknown, list[None]]` is not assignable to `dict[bytes, list[TreeChange | None]]` [bad-assignment]
rotki (https://github.com/rotki/rotki)
+ ERROR rotkehlchen/accounting/structures/processed_event.py:158:41-56: Argument `Match[bytes]` is not assignable to parameter `matched_address` with type `Match[str]` in function `ProcessedAccountingEvent._maybe_add_label_with_address` [bad-argument-type]
- ERROR rotkehlchen/mcp/registry.py:48:18-51:6: No matching overload found for function `sorted` called with arguments: (list[(...) -> Any], key=(tool: Unknown) -> Any | None) [no-matching-overload]
spark (https://github.com/apache/spark)
+ ERROR python/pyspark/pandas/tests/diff_frames_ops/test_groupby_apply.py:47:51-56: Object of class `Iterable` has no attribute `min` [missing-attribute]
+ ERROR python/pyspark/pandas/tests/diff_frames_ops/test_groupby_apply.py:55:58-63: Object of class `Iterable` has no attribute `min` [missing-attribute]
+ ERROR python/pyspark/pandas/tests/diff_frames_ops/test_groupby_apply.py:59:58-63: Object of class `Iterable` has no attribute `min` [missing-attribute]
+ ERROR python/pyspark/pandas/tests/groupby/test_apply_func.py:294:54-69: Cannot index into `Iterable[Any]` [bad-index]
+ ERROR python/pyspark/pandas/tests/groupby/test_apply_func.py:317:54-69: Cannot index into `Iterable[Any]` [bad-index]
+ ERROR python/pyspark/pandas/tests/series/test_series.py:511:32-39: Object of class `NAType` has no attribute `upper` [missing-attribute]
+ ERROR python/pyspark/pandas/tests/test_categorical.py:318:47-56: Cannot index into `Iterable[Any]` [bad-index]
+ ERROR python/pyspark/pandas/tests/test_categorical.py:326:47-51: Object of class `Iterable` has no attribute `b` [missing-attribute]
+ ERROR python/pyspark/sql/connect/plan.py:1150:68-75: `&` is not supported between `str` and `str` [unsupported-operation]
+ ERROR python/pyspark/sql/connect/plan.py:1235:68-75: `&` is not supported between `str` and `str` [unsupported-operation]
+ ERROR python/pyspark/sql/conversion.py:1987:38-48: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/sql/conversion.py:1987:50-63: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/sql/conversion.py:1992:45-53: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/sql/conversion.py:1992:55-64: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/sql/conversion.py:1997:44-52: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/sql/conversion.py:1997:54-63: Cannot index into `NAType` [bad-index]
+ ERROR python/pyspark/streaming/dstream.py:167:43-69: Object of class `datetime` has no attribute `mapPartitionsWithIndex` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:215:43-58: Object of class `datetime` has no attribute `partitionBy` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:339:43-57: Object of class `datetime` has no attribute `groupByKey` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:469:43-58: Object of class `datetime` has no attribute `repartition` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:490:48-55: Object of class `datetime` has no attribute `union` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:506:26-35: Object of class `datetime` has no attribute `cogroup` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:524:48-54: Object of class `datetime` has no attribute `join` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:540:48-63: Object of class `datetime` has no attribute `leftOuterJoin` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:556:48-64: Object of class `datetime` has no attribute `rightOuterJoin` [missing-attribute]
+ ERROR python/pyspark/streaming/dstream.py:572:48-63: Object of class `datetime` has no attribute `fullOuterJoin` [missing-attribute]
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/cli/artifact.py:96:45-63: Object of class `Artifact` has no attribute `latest_id` [missing-attribute]
+ ERROR src/prefect/cli/artifact.py:93:31-63: No matching overload found for function `sorted` called with arguments: (list[Artifact] | list[ArtifactCollection], key=(x: Unknown) -> Unknown) [no-matching-overload]
+ ERROR src/prefect/cli/flow_run.py:265:31-81: No matching overload found for function `sorted` called with arguments: (list[FlowRun], key=(d: Unknown) -> Unknown, reverse=Literal[True]) [no-matching-overload]
- ERROR src/prefect/cli/flow_run.py:268:17-45: Object of class `NoneType` has no attribute `state_details` [missing-attribute]
- ERROR src/prefect/cli/flow_run.py:269:20-47: Object of class `NoneType` has no attribute `is_scheduled` [missing-attribute]
- ERROR src/prefect/cli/flow_run.py:270:22-46: Object of class `NoneType` has no attribute `timestamp` [missing-attribute]
- ERROR src/prefect/cli/flow_run.py:276:21-40: Object of class `NoneType` has no attribute `type` [missing-attribute]
+ ERROR src/prefect/server/services/task_run_recorder.py:225:39-69: Object of class `NoneType` has no attribute `timestamp` [missing-attribute]
materialize (https://github.com/MaterializeInc/materialize)
+ ERROR test/doc-examples/mzcompose.py:83:77-80: Argument `Literal['/']` is not assignable to parameter `bytes` with type `Buffer | None` in function `bytes.lstrip` [bad-argument-type]
freqtrade (https://github.com/freqtrade/freqtrade)
+ ERROR freqtrade/data/btanalysis/trade_parallelism.py:124:51-78: Cannot index into `int` [bad-index]
+ ERROR freqtrade/data/btanalysis/trade_parallelism.py:124:51-78: Cannot index into `str` [bad-index]
+ ERROR freqtrade/plugins/pairlist/PercentChangePairList.py:233:32-237:10: No matching overload found for function `sorted` called with arguments: (list[SymbolWithPercentage], reverse=bool, key=(t: Unknown) -> Unknown) [no-matching-overload]
pwndbg (https://github.com/pwndbg/pwndbg)
+ ERROR pwndbg/aglib/disasm/aarch64.py:331:75-86: Expected 0 positional arguments, got 2 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/aarch64.py:535:17-23: Expected 0 positional arguments, got 3 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/arm.py:267:75-86: Expected 0 positional arguments, got 2 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/arm.py:435:17-23: Expected 0 positional arguments, got 3 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/assistant.py:345:78-89: Expected 0 positional arguments, got 3 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/assistant.py:380:21-32: Expected 0 positional arguments, got 3 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/assistant.py:392:66-77: Expected 0 positional arguments, got 2 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/mips.py:233:75-86: Expected 0 positional arguments, got 2 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/riscv.py:199:75-86: Expected 0 positional arguments, got 2 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/sparc.py:103:80-83: Expected 0 positional arguments, got 1 [bad-argument-count]
+ ERROR pwndbg/aglib/disasm/x86.py:153:75-86: Expected 0 positional arguments, got 2 [bad-argument-count]
apprise (https://github.com/caronc/apprise)
+ ERROR apprise/asset.py:411:46-55: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/asset.py:443:46-55: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/aprs.py:611:40-49: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/custom_xml.py:390:49-58: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/matrix/base.py:701:53-62: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/matrix/base.py:706:53-62: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/ryver.py:205:51-60: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/ryver.py:209:51-60: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/slack.py:1044:55-64: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/plugins/slack.py:1093:51-60: Invalid key for dict, got `bytes` [bad-index]
+ ERROR apprise/utils/templates.py:85:43-66: Cannot index into `dict[str, Unknown]` [bad-index]
schemathesis (https://github.com/schemathesis/schemathesis)
- ERROR src/schemathesis/cli/commands/run/handlers/output.py:535:70-537:6: `dict[PhaseName, tuple[Status, None]]` is not assignable to `dict[PhaseName, tuple[Status, PhaseSkipReason | None]]` [bad-assignment]
aiohttp (https://github.com/aio-libs/aiohttp)
+ ERROR aiohttp/helpers.py:413:39-56: `+` is not supported between `Literal['\\']` and `bytes` [unsupported-operation]
+ ERROR aiohttp/helpers.py:781:61-79: No matching overload found for function `re.Pattern.sub` called with arguments: (Literal['\\1'], bytes) [no-matching-overload]
ibis (https://github.com/ibis-project/ibis)
+ ERROR ibis/backends/conftest.py:268:66-68: Missing argument `backend` [missing-argument]
strawberry (https://github.com/strawberry-graphql/strawberry)
+ ERROR strawberry/federation/schema.py:415:55-82: Generic attribute `__strawberry_definition__` of class `WithStrawberryDefinition` is not visible on the class
+ Object of class `StrawberryType` has no attribute `__strawberry_definition__` [missing-attribute]
zulip (https://github.com/zulip/zulip)
+ ERROR zerver/lib/export.py:3209:18-84: No matching overload found for function `sorted` called with arguments: (dict_values[int, dict[str, bool | int | str | None]], key=(export_dict: Unknown) -> Unknown) [no-matching-overload]
+ ERROR zerver/lib/topic.py:266:42-54: Unary `-` is not supported on `str` [unsupported-operation]
+ ERROR zerver/lib/topic_link_util.py:33:41-73: No matching overload found for function `dict.get` called with arguments: (bytes, bytes) [no-matching-overload]
sockeye (https://github.com/awslabs/sockeye)
- ERROR sockeye_contrib/plot_metrics.py:24:19-33:3: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[str, ((s: Unknown) -> float) | type[float] | type[int]]) [no-matching-overload]
static-frame (https://github.com/static-frame/static-frame)
+ ERROR static_frame/test/unit/test_frame.py:6736:35-63: No matching overload found for function `collections.defaultdict.__init__` called with arguments: (() -> None, dict[str, bool]) [no-matching-overload]
meson (https://github.com/mesonbuild/meson)
+ ERROR docs/refman/loaderbase.py:130:39-96: `VarArgs | None` is not assignable to upper bound `ArgBase | list[PosArg]` of type variable `_T` [bad-specialization]
- ERROR mesonbuild/cargo/interpreter.py:99:57-101:6: `PerMachine[None]` is not assignable to `PerMachine[PackageConfiguration | None]` [bad-assignment]
- ERROR mesonbuild/cargo/manifest.py:375:38-88: `list[str]` is not assignable to `list[CRATE_TYPE]` [bad-assignment]
+ ERROR mesonbuild/dependencies/cuda.py:127:75-79: Argument `str | None` is not assignable to parameter `s` with type `str` in function `mesonbuild.utils.universal.Version.__init__` [bad-argument-type]
werkzeug (https://github.com/pallets/werkzeug)
+ ERROR tests/test_exceptions.py:142:11-145:6: No matching overload found for function `sorted` called with arguments: (Generator[type[HTTPException]], key=(e: Unknown) -> Unknown) [no-matching-overload]
+ ERROR tests/test_exceptions.py:162:11-165:6: No matching overload found for function `sorted` called with arguments: (Generator[type[HTTPException]], key=(e: Unknown) -> Unknown) [no-matching-overload]
+ ERROR src/werkzeug/http.py:1437:41-50: Cannot index into `dict[bytes, bytes]` [bad-index]
mypy (https://github.com/python/mypy)
+ ERROR mypy/strconv.py:382:52-69: `+` is not supported between `Literal['\\']` and `bytes` [unsupported-operation]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/conversation/chat_log.py:339:30-88: `list[SystemContent]` is not assignable to `list[Content]` [bad-assignment]
- ERROR homeassistant/components/freebox/entity.py:105:16-26: Returning implicit Any from function declared to return "int | None" [no-any-return-implicit]
+ ERROR homeassistant/util/__init__.py:106:56-76: `+` is not supported between `bytes` and `Literal['_']` [unsupported-operation]
+ ERROR homeassistant/util/__init__.py:109:59-79: `+` is not supported between `Literal['_']` and `bytes` [unsupported-operation]
paasta (https://github.com/yelp/paasta)
+ ERROR paasta_tools/contrib/render_template.py:111:37-113:14: No matching overload found for function `os._Environ.get` called with arguments: (bytes, bytes) [no-matching-overload]
+ ERROR paasta_tools/contrib/render_template.py:112:36-40: Argument `Literal['$(']` is not assignable to parameter `old` with type `Buffer` in function `bytes.replace` [bad-argument-type]
+ ERROR paasta_tools/contrib/render_template.py:112:42-44: Argument `Literal['']` is not assignable to parameter `new` with type `Buffer` in function `bytes.replace` [bad-argument-type]
+ ERROR paasta_tools/contrib/render_template.py:112:54-57: Argument `Literal[')']` is not assignable to parameter `old` with type `Buffer` in function `bytes.replace` [bad-argument-type]
+ ERROR paasta_tools/contrib/render_template.py:112:59-61: Argument `Literal['']` is not assignable to parameter `new` with type `Buffer` in function `bytes.replace` [bad-argument-type]
spack (https://github.com/spack/spack)
+ ERROR lib/spack/spack/repo_migrate.py:150:57-67: Cannot index into `dict[str, str]` [bad-index]
+ ERROR lib/spack/spack/user_environment.py:79:69-79: Cannot index into `dict[str, Unknown]` [bad-index]
pydantic (https://github.com/pydantic/pydantic)
- ERROR pydantic/_internal/_mock_val_ser.py:137:25-142:6: `MockValSer[PluggableSchemaValidator | SchemaValidator]` is not assignable to attribute `validator` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:137:25-142:6: `MockValSer[Unknown]` is not assignable to attribute `validator` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
- ERROR pydantic/_internal/_mock_val_ser.py:143:26-148:6: `MockValSer[SchemaSerializer]` is not assignable to attribute `serializer` with type `SchemaSerializer` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:143:26-148:6: `MockValSer[Unknown]` is not assignable to attribute `serializer` with type `SchemaSerializer` [bad-assignment]
- ERROR pydantic/_internal/_mock_val_ser.py:178:34-183:6: `MockValSer[PluggableSchemaValidator | SchemaValidator]` is not assignable to attribute `__pydantic_validator__` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:178:34-183:6: `MockValSer[Unknown]` is not assignable to attribute `__pydantic_validator__` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
- ERROR pydantic/_internal/_mock_val_ser.py:184:35-189:6: `MockValSer[SchemaSerializer]` is not assignable to attribute `__pydantic_serializer__` with type `SchemaSerializer` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:184:35-189:6: `MockValSer[Unknown]` is not assignable to attribute `__pydantic_serializer__` with type `SchemaSerializer` [bad-assignment]
- ERROR pydantic/_internal/_mock_val_ser.py:221:34-226:6: `MockValSer[PluggableSchemaValidator | SchemaValidator]` is not assignable to attribute `__pydantic_validator__` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:221:34-226:6: `MockValSer[Unknown]` is not assignable to attribute `__pydantic_validator__` with type `PluggableSchemaValidator | SchemaValidator` [bad-assignment]
- ERROR pydantic/_internal/_mock_val_ser.py:227:35-232:6: `MockValSer[SchemaSerializer]` is not assignable to attribute `__pydantic_serializer__` with type `SchemaSerializer` [bad-assignment]
+ ERROR pydantic/_internal/_mock_val_ser.py:227:35-232:6: `MockValSer[Unknown]` is not assignable to attribute `__pydantic_serializer__` with type `SchemaSerializer` [bad-assignment]
optuna (https://github.com/optuna/optuna)
+ ERROR tutorial/20_recipes/002_multi_objective.py:148:68-79: `None` is not subscriptable [unsupported-operation]
+ ERROR optuna/samplers/nsgaii/_elite_population_selection_strategy.py:85:39-50: `None` is not subscriptable [unsupported-operation]
kopf (https://github.com/nolar/kopf)
+ ERROR kopf/_core/engines/admission.py:481:43-60: Object of class `bytes` has no attribute `encode` [missing-attribute]
|
asukaminato0721
marked this pull request as draft
July 20, 2026 16:06
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
Fixes #438
Lambdas remain unevaluated during overload preparation, and lambda checking is deferred until later arguments contribute generic bounds.
Test Plan
add test