Repository navigation
fix in check does not narrow TypedDict Union #3079 - #3082
asukaminato0721 wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Fixes TypedDict-union narrowing when guarding with a string-literal key membership check (e.g., if "a" in foo:), addressing #3079.
Changes:
- Added a regression test asserting that
"a" in (Foo | Bar)narrows the subject toFoo(and the else branch toBar). - Updated the narrowing solver to narrow union members for
HasKey/NotHasKeyby filtering TypedDict union members based on key presence/requiredness, while preserving dict-like facet behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pyrefly/lib/test/typed_dict.rs | Adds regression test coverage for subject-type narrowing on TypedDict unions via "key" in obj. |
| pyrefly/lib/alt/narrow.rs | Implements key-membership-based narrowing across union members (esp. TypedDict) and extends dict-like detection to unions for facet handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment has been minimized.
This comment has been minimized.
|
There's some discussion about how to fix this in #2199. In particularly, we can't naively narrow the TypedDict union because a non-closed TypedDict can have extra keys we can't see via subtyping. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: openlibrary (https://github.com/internetarchive/openlibrary)
- ERROR openlibrary/plugins/openlibrary/lists.py:105:25-30: TypedDict `AnnotatedSeedDict` does not have key `key` [bad-typed-dict-key]
- ERROR openlibrary/plugins/openlibrary/lists.py:108:21-26: TypedDict `AnnotatedSeedDict` does not have key `key` [bad-typed-dict-key]
cwltool (https://github.com/common-workflow-language/cwltool)
- ERROR cwltool/command_line_tool.py:687:30-37: TypedDict `CWLDirectoryType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:687:30-37: TypedDict `CWLFileType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:688:27-38: TypedDict `CWLDirectoryType` does not have key `entryname` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:688:27-38: TypedDict `CWLFileType` does not have key `entryname` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:717:71-78: TypedDict `CWLDirectoryType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:717:71-78: TypedDict `CWLFileType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:719:50-61: TypedDict `CWLDirectoryType` does not have key `entryname` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:719:50-61: TypedDict `CWLFileType` does not have key `entryname` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:721:20-27: TypedDict `CWLDirectoryType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/command_line_tool.py:721:20-27: TypedDict `CWLFileType` does not have key `entry` [bad-typed-dict-key]
- ERROR cwltool/main.py:239:32-41: TypedDict `CWLDirectoryType` does not have key `default` [bad-typed-dict-key]
- ERROR cwltool/main.py:239:32-41: TypedDict `CWLFileType` does not have key `default` [bad-typed-dict-key]
- ERROR cwltool/main.py:248:59-65: TypedDict `CWLDirectoryType` does not have key `name` [bad-typed-dict-key]
- ERROR cwltool/main.py:248:59-65: TypedDict `CWLFileType` does not have key `name` [bad-typed-dict-key]
pwndbg (https://github.com/pwndbg/pwndbg)
- ERROR pwndbg/emu/emulator.py:481:51-63: Object of class `NoneType` has no attribute `objfile` [missing-attribute]
+ ERROR pwndbg/emu/emulator.py:481:40-63: `in` is not supported between `Literal['[heap']` and `object` [not-iterable]
- ERROR pwndbg/emu/emulator.py:525:34-46: Object of class `NoneType` has no attribute `objfile` [missing-attribute]
+ ERROR pwndbg/emu/emulator.py:525:22-46: `in` is not supported between `Literal['[stack']` and `object` [not-iterable]
- ERROR pwndbg/enhance.py:91:47-59: Object of class `NoneType` has no attribute `objfile` [missing-attribute]
+ ERROR pwndbg/enhance.py:91:36-59: `in` is not supported between `Literal['[heap']` and `object` [not-iterable]
- ERROR pwndbg/enhance.py:124:30-42: Object of class `NoneType` has no attribute `objfile` [missing-attribute]
+ ERROR pwndbg/enhance.py:124:18-42: `in` is not supported between `Literal['[stack']` and `object` [not-iterable]
apprise (https://github.com/caronc/apprise)
- ERROR apprise/plugins/dbus.py:436:49-63: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:438:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:440:48-62: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:441:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:444:42-56: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:445:52-66: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:447:42-56: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/dbus.py:448:52-66: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:396:49-63: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:398:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:400:48-62: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:401:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:404:42-56: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:405:52-66: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:407:42-56: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/glib.py:408:52-66: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/gnome.py:267:49-63: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/gnome.py:270:17-31: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/gnome.py:273:48-62: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/gnome.py:274:54-68: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/macosx.py:245:46-60: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/macosx.py:246:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/macosx.py:249:46-60: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/macosx.py:250:53-67: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1169:48-62: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1170:34-48: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1174:43-57: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1176:17-31: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1183:44-58: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1184:30-44: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1187:46-60: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1188:32-46: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1190:49-63: `None` is not subscriptable [unsupported-operation]
- ERROR apprise/plugins/telegram.py:1191:32-46: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_config.py:1290:25-38: Object of class `object` has no attribute `tags` [missing-attribute]
- ERROR tests/test_apprise_config.py:1291:27-40: Object of class `object` has no attribute `tags` [missing-attribute]
+ ERROR tests/test_apprise_config.py:1290:12-38: `in` is not supported between `Literal['company']` and `object` [not-iterable]
+ ERROR tests/test_apprise_config.py:1291:12-40: `in` is not supported between `Literal['co-worker']` and `object` [not-iterable]
- ERROR tests/test_apprise_utils.py:383:20-33: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:385:20-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:401:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:417:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:434:22-35: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:435:24-37: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:437:21-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:439:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:441:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:442:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:443:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:443:37-51: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:444:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:444:37-51: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:460:22-35: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:461:24-37: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:463:21-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:465:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:467:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:468:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:469:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:469:37-51: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:470:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:470:37-51: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1030:20-33: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1040:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1050:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1063:22-35: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1064:24-37: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1065:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1066:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1067:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_apprise_utils.py:1068:12-25: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_config_base.py:972:28-38: Object of class `object` has no attribute `tags` [missing-attribute]
+ ERROR tests/test_config_base.py:972:16-38: `in` is not supported between `Literal['devops']` and `object` [not-iterable]
- ERROR tests/test_config_base.py:997:28-38: Object of class `object` has no attribute `tags` [missing-attribute]
+ ERROR tests/test_config_base.py:997:16-38: `in` is not supported between `Literal['devops']` and `object` [not-iterable]
- ERROR tests/test_config_base.py:1180:28-38: Object of class `object` has no attribute `tags` [missing-attribute]
+ ERROR tests/test_config_base.py:1180:16-38: `in` is not supported between `Literal['devops']` and `object` [not-iterable]
- ERROR tests/test_notify_base.py:296:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:300:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:305:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:312:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:319:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:326:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:334:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:341:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:344:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:347:12-29: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:353:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:356:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:359:12-31: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:366:12-27: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_notify_base.py:371:12-27: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_matrix.py:3632:12-26: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_pushplus.py:811:22-39: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:335:12-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:337:12-36: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:339:12-40: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:359:12-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:361:12-36: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_ses.py:363:12-40: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:219:12-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:221:12-36: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:223:12-40: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:242:12-34: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:244:12-36: `None` is not subscriptable [unsupported-operation]
- ERROR tests/test_plugin_sns.py:246:12-40: `None` is not subscriptable [unsupported-operation]
speedrun.com_global_scoreboard_webapp (https://github.com/Avasam/speedrun.com_global_scoreboard_webapp)
- ERROR backend/services/utils.py:71:16-25: Returned type `SrcErrorResultDto` is not assignable to declared return type `dict[Literal['data'], Any] | None` [bad-return]
bandersnatch (https://github.com/pypa/bandersnatch)
- ERROR src/bandersnatch/filter.py:46:25-54: `type[Any]` is not subscriptable [unsupported-operation]
meson (https://github.com/mesonbuild/meson)
- ERROR mesonbuild/compilers/rust.py:293:40-54: Object of class `NoneType` has no attribute `id` [missing-attribute]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/tts/__init__.py:290:53-72: Unpacked keyword argument `object` is not assignable to parameter `engine` with type `str` in function `SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/__init__.py:290:53-72: Unpacked keyword argument `object` is not assignable to parameter `use_file_cache` with type `bool | None` in function `SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/__init__.py:290:53-72: Unpacked keyword argument `object` is not assignable to parameter `language` with type `str | None` in function `SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/__init__.py:290:53-72: Unpacked keyword argument `object` is not assignable to parameter `options` with type `dict[Unknown, Unknown] | None` in function `SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/__init__.py:290:62-71: TypedDict `ParsedMediaSourceStreamId` does not have key `options` [bad-typed-dict-key]
- ERROR homeassistant/components/tts/__init__.py:291:41-50: TypedDict `ParsedMediaSourceStreamId` does not have key `message` [bad-typed-dict-key]
- ERROR homeassistant/components/tts/media_source.py:143:61-80: Unpacked keyword argument `object` is not assignable to parameter `engine` with type `str` in function `homeassistant.components.tts.SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/media_source.py:143:61-80: Unpacked keyword argument `object` is not assignable to parameter `use_file_cache` with type `bool | None` in function `homeassistant.components.tts.SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/media_source.py:143:61-80: Unpacked keyword argument `object` is not assignable to parameter `language` with type `str | None` in function `homeassistant.components.tts.SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/media_source.py:143:61-80: Unpacked keyword argument `object` is not assignable to parameter `options` with type `dict[Unknown, Unknown] | None` in function `homeassistant.components.tts.SpeechManager.async_create_result_stream` [bad-argument-type]
- ERROR homeassistant/components/tts/media_source.py:143:70-79: TypedDict `ParsedMediaSourceStreamId` does not have key `options` [bad-typed-dict-key]
- ERROR homeassistant/components/tts/media_source.py:144:49-58: TypedDict `ParsedMediaSourceStreamId` does not have key `message` [bad-typed-dict-key]
+ ERROR homeassistant/config_entries.py:484:17-34: Unpacked keyword argument `object | str` is not assignable to parameter `subentry_id` with type `str` in function `ConfigSubentry.__init__` [bad-argument-type]
- ERROR homeassistant/helpers/storage.py:432:17-38: Cannot index into `bool` [bad-index]
- ERROR homeassistant/helpers/storage.py:432:17-38: Cannot index into `float` [bad-index]
- ERROR homeassistant/helpers/storage.py:432:17-38: Cannot index into `int` [bad-index]
- ERROR homeassistant/helpers/storage.py:432:17-38: Cannot index into `list[JsonValueType]` [bad-index]
- ERROR homeassistant/helpers/storage.py:432:17-38: Cannot index into `str` [bad-index]
- ERROR homeassistant/helpers/storage.py:432:17-38: `None` is not subscriptable [unsupported-operation]
- ERROR homeassistant/helpers/storage.py:444:17-38: Cannot index into `bool` [bad-index]
- ERROR homeassistant/helpers/storage.py:444:17-38: Cannot index into `float` [bad-index]
- ERROR homeassistant/helpers/storage.py:444:17-38: Cannot index into `int` [bad-index]
- ERROR homeassistant/helpers/storage.py:444:17-38: Cannot index into `list[JsonValueType]` [bad-index]
- ERROR homeassistant/helpers/storage.py:444:17-38: Cannot index into `str` [bad-index]
- ERROR homeassistant/helpers/storage.py:444:17-38: `None` is not subscriptable [unsupported-operation]
- ERROR homeassistant/helpers/storage.py:453:42-63: Cannot index into `bool` [bad-index]
- ERROR homeassistant/helpers/storage.py:453:42-63: Cannot index into `float` [bad-index]
- ERROR homeassistant/helpers/storage.py:453:42-63: Cannot index into `int` [bad-index]
- ERROR homeassistant/helpers/storage.py:453:42-63: Cannot index into `list[JsonValueType]` [bad-index]
- ERROR homeassistant/helpers/storage.py:453:42-63: Cannot index into `str` [bad-index]
- ERROR homeassistant/helpers/storage.py:453:42-63: `None` is not subscriptable [unsupported-operation]
paasta (https://github.com/yelp/paasta)
- ERROR paasta_tools/kubernetes/application/controller_wrappers.py:186:47-74: Object of class `NoneType` has no attribute `config_dict` [missing-attribute]
+ ERROR paasta_tools/kubernetes/application/controller_wrappers.py:186:12-74: `in` is not supported between `Literal['unhealthy_pod_eviction_policy']` and `object` [not-iterable]
parso (https://github.com/davidhalter/parso)
- ERROR parso/python/pep8.py:657:41-67: Object of class `NoneType` has no attribute `prefix` [missing-attribute]
+ ERROR parso/python/pep8.py:657:29-67: `not in` is not supported between `Literal['\r']` and `object` [not-iterable]
pydantic (https://github.com/pydantic/pydantic)
- ERROR pydantic/_internal/_schema_gather.py:111:29-51: Argument `list[CoreSchema] | AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainValidatorFunctionSchema | SetSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapValidatorFunctionSchema | Unknown` is not assignable to parameter `schema` with type `AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | ComputedField | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FormatSerSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | ModelSerSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainSerializerFunctionSerSchema | PlainValidatorFunctionSchema | SetSchema | SimpleSerSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | ToStringSerSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapSerializerFunctionSerSchema | WrapValidatorFunctionSchema` in function `traverse_schema` [bad-argument-type]
+ ERROR pydantic/_internal/_schema_gather.py:111:29-51: Argument `list[CoreSchema] | object | AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainValidatorFunctionSchema | SetSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapValidatorFunctionSchema` is not assignable to parameter `schema` with type `AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | ComputedField | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FormatSerSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | ModelSerSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainSerializerFunctionSerSchema | PlainValidatorFunctionSchema | SetSchema | SimpleSerSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | ToStringSerSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapSerializerFunctionSerSchema | WrapValidatorFunctionSchema` in function `traverse_schema` [bad-argument-type]
+ ERROR pydantic/_internal/_schema_gather.py:114:22-44: Type `object` is not iterable [not-iterable]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `AfterValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `AnySchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ArgumentsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ArgumentsV3Schema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `BeforeValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `BoolSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `BytesSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `CallSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `CallableSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ChainSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ComplexSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ComputedField` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `CustomErrorSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DataclassArgsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DataclassSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DateSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DatetimeSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DecimalSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DefinitionReferenceSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DefinitionsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `DictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `EnumSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `FloatSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `FormatSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `IntSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `InvalidSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `IsInstanceSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `IsSubclassSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `JsonOrPythonSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `JsonSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `LaxOrStrictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `LiteralSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `MissingSentinelSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ModelFieldsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ModelSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ModelSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `MultiHostUrlSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `NoneSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `NullableSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `PlainSerializerFunctionSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `PlainValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `SimpleSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `StringSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `TaggedUnionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `TimeSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `TimedeltaSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `ToStringSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `TypedDictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `UnionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `UrlSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `UuidSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `WithDefaultSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `WrapSerializerFunctionSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:111:36-50: TypedDict `WrapValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `AfterValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `AnySchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ArgumentsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ArgumentsV3Schema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `BeforeValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `BoolSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `BytesSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `CallSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `CallableSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ChainSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ComplexSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ComputedField` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `CustomErrorSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DataclassArgsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DataclassSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DateSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DatetimeSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DecimalSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DefinitionReferenceSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DefinitionsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `DictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `EnumSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `FloatSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `FormatSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `IntSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `InvalidSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `IsInstanceSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `IsSubclassSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `JsonOrPythonSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `JsonSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `LaxOrStrictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `LiteralSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `MissingSentinelSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ModelFieldsSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ModelSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ModelSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `MultiHostUrlSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `NoneSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `NullableSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `PlainSerializerFunctionSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `PlainValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `SimpleSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `StringSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `TaggedUnionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `TimeSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `TimedeltaSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `ToStringSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `TypedDictSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `UnionSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `UrlSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `UuidSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `WithDefaultSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `WrapSerializerFunctionSerSchema` does not have key `items_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:114:29-43: TypedDict `WrapValidatorFunctionSchema` does not have key `items_schema` [bad-typed-dict-key]
+ ERROR pydantic/_internal/_schema_gather.py:118:29-50: Argument `object | AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainValidatorFunctionSchema | SetSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapValidatorFunctionSchema` is not assignable to parameter `schema` with type `AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | ComputedField | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FormatSerSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | ModelSerSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainSerializerFunctionSerSchema | PlainValidatorFunctionSchema | SetSchema | SimpleSerSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | ToStringSerSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapSerializerFunctionSerSchema | WrapValidatorFunctionSchema` in function `traverse_schema` [bad-argument-type]
+ ERROR pydantic/_internal/_schema_gather.py:120:29-52: Argument `object | AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainValidatorFunctionSchema | SetSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapValidatorFunctionSchema` is not assignable to parameter `schema` with type `AfterValidatorFunctionSchema | AnySchema | ArgumentsSchema | ArgumentsV3Schema | BeforeValidatorFunctionSchema | BoolSchema | BytesSchema | CallSchema | CallableSchema | ChainSchema | ComplexSchema | ComputedField | CustomErrorSchema | DataclassArgsSchema | DataclassSchema | DateSchema | DatetimeSchema | DecimalSchema | DefinitionReferenceSchema | DefinitionsSchema | DictSchema | EnumSchema | FloatSchema | FormatSerSchema | FrozenSetSchema | GeneratorSchema | IntSchema | InvalidSchema | IsInstanceSchema | IsSubclassSchema | JsonOrPythonSchema | JsonSchema | LaxOrStrictSchema | ListSchema | LiteralSchema | MissingSentinelSchema | ModelFieldsSchema | ModelSchema | ModelSerSchema | MultiHostUrlSchema | NoneSchema | NullableSchema | PlainSerializerFunctionSerSchema | PlainValidatorFunctionSchema | SetSchema | SimpleSerSchema | StringSchema | TaggedUnionSchema | TimeSchema | TimedeltaSchema | ToStringSerSchema | TupleSchema | TypedDictSchema | UnionSchema | UrlSchema | UuidSchema | WithDefaultSchema | WrapSerializerFunctionSerSchema | WrapValidatorFunctionSchema` in function `traverse_schema` [bad-argument-type]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `AfterValidatorFunctionSchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `AnySchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `ArgumentsSchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `ArgumentsV3Schema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `BeforeValidatorFunctionSchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `BoolSchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `BytesSchema` does not have key `keys_schema` [bad-typed-dict-key]
- ERROR pydantic/_internal/_schema_gather.py:118:36-49: TypedDict `CallSchema` does not have key `keys_schema` [bad-typed-dict-key]
... (truncated 892 lines) ...
PyGithub (https://github.com/PyGithub/PyGithub)
- ERROR github/AdvisoryVulnerability.py:141:51-88: Type `NoneType` is not iterable [not-iterable]
spark (https://github.com/apache/spark)
- ERROR python/pyspark/tests/test_util.py:37:27-45: Object of class `Wrapped` has no attribute `_input_kwargs` [missing-attribute]
- ERROR python/pyspark/tests/test_util.py:38:23-41: Object of class `Wrapped` has no attribute `_input_kwargs` [missing-attribute]
- ERROR python/pyspark/tests/test_util.py:39:27-45: Object of class `Wrapped` has no attribute `_input_kwargs` [missing-attribute]
+ ERROR python/pyspark/tests/test_util.py:37:27-50: Cannot index into `object` [bad-index]
+ ERROR python/pyspark/tests/test_util.py:38:16-41: `in` is not supported between `Literal['y']` and `object` [not-iterable]
+ ERROR python/pyspark/tests/test_util.py:39:27-50: Cannot index into `object` [bad-index]
- ERROR python/pyspark/tests/test_util.py:60:21-39: Object of class `Setter` has no attribute `_input_kwargs` [missing-attribute]
- ERROR python/pyspark/tests/test_util.py:60:55-73: Object of class `Setter` has no attribute `_input_kwargs` [missing-attribute]
- ERROR python/pyspark/tests/test_util.py:61:27-45: Object of class `Setter` has no attribute `_input_kwargs` [missing-attribute]
+ ERROR python/pyspark/tests/test_util.py:60:21-48: Cannot index into `object` [bad-index]
+ ERROR python/pyspark/tests/test_util.py:60:55-84: Cannot index into `object` [bad-index]
+ ERROR python/pyspark/tests/test_util.py:61:27-50: Cannot index into `object` [bad-index]
|
Primer Diff Classification➖ 1 neutral | ❓ 12 needs review | 13 project(s) total | +39, -159 errors
Detailed analysis➖ Neutral (1)pydantic (+21, -21)
Per-category reasoning:
❓ Needs Review (12)openlibrary (-2)
cwltool (-7)
pwndbg (+4, -4)
apprise (+5, -101)
speedrun.com_global_scoreboard_webapp (-1)
bandersnatch (-1)
meson (-1)
core (+1, -12)
paasta (+1, -1)
parso (+1, -1)
PyGithub (-1)
spark (+6, -6)
Suggested fixesSummary: The PR is a net improvement across most projects, but introduces false positives in pydantic (and potentially other projects) when open TypedDicts with ExtraItems::Default are narrowed via key membership, causing 1. In
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (12 heuristic, 1 LLM) |
|
@rchen152 has imported this pull request. If you are a Meta employee, you can view this in D107787837. |
|
Thanks for this PR! I kept your narrow_key_membership pruning logic and tests, but reworked how we mark the key accessible. Caching the key's value as a facet narrow masks errors on mixed unions: e.g. was wrongly accepted even though a list can't be indexed by a str. I instead added a No action needed on your end - I made these changes to the imported copy of the PR. |
Summary: For #3079. #3082 attempts to fix the issue of erroring on a TypedDict key access after a `key in some_dict` check by overwriting `some_dict[key]` with the value type after the check. This is too coarse-grained; if `some_dict`'s type is a union with a mix of TypedDicts and non-TypedDicts, we accidentally stop type-checking subscript access on the non-TypedDict members. The approach this stack takes is to instead add a `present` bit to `NarrowedFacet`, use it to store when a key is present without needing to write a narrowed value for it, and suppress key access errors accordingly. This diff: adds the `present` bit. Reviewed By: yangdanny97 Differential Revision: D107801899 fbshipit-source-id: ce7c1b96a89b2d451828b361c196e4c833673887
Summary
Fixes #3079
The solver now narrows the subject type itself for
"key" in x/"key" not in xwhen x is a TypedDict union, instead of only recording a key facet, soFoo | Barnow becomes Foo in the positive branch and Bar in the negative branch.Test Plan
add test