[ty] Narrow TypedDicts through isinstance(..., dict)#23946
[ty] Narrow TypedDicts through isinstance(..., dict)#23946charliermarsh wants to merge 7 commits intomainfrom
isinstance(..., dict)#23946Conversation
c93ef08 to
931ca14
Compare
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 89.34%. The percentage of expected errors that received a diagnostic held steady at 85.30%. The number of fully passing files held steady at 87/134. |
|
Memory usage reportSummary
Significant changesClick to expand detailed breakdownprefect
sphinx
trio
flake8
|
AlexWaygood
left a comment
There was a problem hiding this comment.
Exciting! 😃
I know this is still in draft, just a couple of things I noticed
| if class.is_known(db, KnownClass::Dict) { | ||
| UnionType::from_two_elements(db, instance_constraint, Type::TypedDictTop) | ||
| } else { | ||
| instance_constraint | ||
| } |
There was a problem hiding this comment.
you also want to do the same here if class.is_known(db, KnownClass::MutableMapping)
18db004 to
3baa343
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
0be1f1e to
bb52eee
Compare
|
I think these changes have the behavior we want, but it's more complex than I wanted. |
AlexWaygood
left a comment
There was a problem hiding this comment.
Haven't looked through the whole patch yet because it's in draft (LMK if you want me to) -- but there are more changes to narrow.rs now than I'd have expected
37bdc9b to
3db3377
Compare
| def f(x: dict[str, int] | list[str], y: object): | ||
| if isinstance(x, t.Dict): | ||
| reveal_type(x) # revealed: dict[str, int] | ||
| reveal_type(x) # revealed: (dict[str, int] & dict[Any, Any]) | (dict[str, int] & Top[TypedDict]) |
There was a problem hiding this comment.
this should still be dict[str, int], and this will fall out naturally if you implement what I said in #23943 (comment):
isinstance(x, dict)(orisinstance(x, typing.Dict)should add a narrowing constraint ofTop[dict[Unknown, Unknown]] | TypedDictTop- that means that the narrowed type of
xhere would be(dict[str, int] | list[str]) & (Top[dict[Unknown, Unknown]] | TypedDictTop - Due to de Morgan's rules, that simplifies to
(dict[str, int] & Top[dict[Unknown, Unknown]]) | (dict[str, int] & TypedDictTop) | (list[str] & Top[dict[Unknown, Unknown]]) | (list[str] & TypedDictTop) - And that should in turn simplify to
dict[str, int] | Never | Never | Never:dict[str, int]is a subtype ofTop[dict[Unknown, Unknown]], sodict[str, int] & Top[dict[Unknown, Unknown]]simplifies todict[str, int]TypedDictTop, and allTypedDicttypes, should be implemented as being disjoint from any non-structural type that is not a supertype ofTypedDictTop: they should be disjoint from bothdicst[str, int]andlist[str]. If you do that, then bothdict[str, int] & TypedDictTopandlist[str] & TypedDictTopwill naturally simplify toNeverin our intersection builder.dict[str, int]is already understood by ty as being disjoint fromlist[str], so that part should already naturally be simplified toNeverin our intersection builder
dict[str, int] | Never | Never | Neverwill naturally be simplified todict[str, int]by our union builder
There was a problem hiding this comment.
"Structural types" are TypedDict types (including TypedDictTop itself), Callable types and Protocol types. The only non-structural supertypes of TypedDictTop are Mapping[str, object] and all nominal supertypes of Mapping[str, object].
There was a problem hiding this comment.
When I make this change, I see the following regression:
from typing import Any, TypedDict
class TD(TypedDict):
x: int
def f(dt: dict[str, Any], key: str):
reveal_type(dt.get(key, {"x": 0})) # revealed: Any
x: TD = dt.get(key, {"x": 0})
reveal_type(x) # current: Any; after the change: UnknownTrying to figure that out.
There was a problem hiding this comment.
hmm, interesting... I can't immediately say I know why that would be. There might be an unrelated pre-existing bug somewhere? not sure
3dc84c5 to
a840e56
Compare
|
| Project | Old Status | New Status | Old Return Code | New Return Code |
|---|---|---|---|---|
pywin32 |
abnormal exit | abnormal exit | 2 |
2 |
Diagnostic changes:
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
22 | 286 | 31 |
no-matching-overload |
1 | 34 | 1 |
invalid-assignment |
14 | 17 | 4 |
invalid-return-type |
8 | 7 | 18 |
unresolved-attribute |
15 | 12 | 6 |
invalid-key |
0 | 8 | 6 |
not-subscriptable |
0 | 13 | 0 |
unsupported-operator |
0 | 8 | 0 |
not-iterable |
1 | 2 | 1 |
unused-ignore-comment |
3 | 0 | 0 |
invalid-type-form |
0 | 0 | 2 |
invalid-yield |
0 | 1 | 0 |
redundant-cast |
1 | 0 | 0 |
too-many-positional-arguments |
0 | 1 | 0 |
unused-type-ignore-comment |
1 | 0 | 0 |
| Total | 66 | 389 | 69 |
Showing a random sample of 249 of 524 changes. See the HTML report for the full diff.
Raw diff sample (249 of 524 changes)
PyGithub (https://github.com/PyGithub/PyGithub)
- github/AdvisoryCredit.py:97:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["login"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryCredit.py:98:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryCredit.py:98:53 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryCredit.py:115:25 error[invalid-argument-type] Invalid argument to key "type" with declared type `str` on TypedDict `SimpleCredit`: value of type `object`
- github/AdvisoryCredit.py:115:25 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:129:59 error[invalid-assignment] Object of type `object` is not assignable to `SimpleAdvisoryVulnerabilityPackage`
- github/AdvisoryVulnerability.py:136:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["patched_versions"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:146:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["vulnerable_version_range"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:164:37 error[invalid-argument-type] Invalid argument to key "patched_versions" with declared type `str | None` on TypedDict `SimpleAdvisoryVulnerability`: value of type `object`
- github/AdvisoryVulnerability.py:165:41 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["vulnerable_functions"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:166:45 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["vulnerable_version_range"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:170:30 error[unresolved-attribute] Attribute `package` is not defined on `SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]` in union `(SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]) | (AdvisoryVulnerability & ~Top[dict[Unknown, Unknown]])`
- github/AdvisoryVulnerability.py:171:25 error[unresolved-attribute] Attribute `package` is not defined on `SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]` in union `(SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]) | (AdvisoryVulnerability & ~Top[dict[Unknown, Unknown]])`
- github/AdvisoryVulnerability.py:173:33 error[unresolved-attribute] Attribute `patched_versions` is not defined on `SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]` in union `(SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]) | (AdvisoryVulnerability & ~Top[dict[Unknown, Unknown]])`
- github/AdvisoryVulnerability.py:174:37 error[unresolved-attribute] Attribute `vulnerable_functions` is not defined on `SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]` in union `(SimpleAdvisoryVulnerability & ~Top[dict[Unknown, Unknown]]) | (AdvisoryVulnerability & ~Top[dict[Unknown, Unknown]])`
altair (https://github.com/vega/altair)
- altair/utils/data.py:161:13 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `object`
- altair/utils/data.py:193:22 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:193:22 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:193:22 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:199:36 error[invalid-argument-type] Argument to bound method `Random.sample` is incorrect: Expected `Sequence[Unknown] | AbstractSet[Unknown]`, found `object`
- altair/utils/data.py:378:27 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:378:27 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:378:27 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/utils/data.py:210:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~None & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
+ altair/utils/data.py:210:39 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `(NativeDataFrame & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~None & ~DataFrame & ~Top[dict[Unknown, Unknown]] & ~TypedDictTop) | (SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
- altair/utils/data.py:416:12 error[unresolved-attribute] Attribute `write_csv` is not defined on `NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]` in union `(NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (altair.utils.core.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
+ altair/utils/data.py:416:12 error[unresolved-attribute] Attribute `write_csv` is not defined on `NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]`, `DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]` in union `(NativeDataFrame & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (narwhals.stable.v1.typing.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]]) | (Unknown & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]] & ~TypedDictTop) | (altair.utils.core.DataFrameLike & ~SupportsGeoInterface & ~DataFrame & ~Top[dict[Unknown, Unknown]])`
- altair/vegalite/v6/api.py:255:18 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/vegalite/v6/api.py:255:18 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/vegalite/v6/api.py:255:18 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- altair/vegalite/v6/api.py:255:18 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
+ altair/vegalite/v6/api.py:908:22 error[invalid-argument-type] Argument to bound method `TypedDictFallback.update` is incorrect: Argument type `dict[str, Any]` does not satisfy upper bound `TypedDictTop` of type variable `Self`
+ altair/vegalite/v6/api.py:908:22 error[invalid-argument-type] Argument to bound method `TypedDictFallback.update` is incorrect: Expected `TypedDictTop`, found `dict[str, Any]`
- altair/vegalite/v6/api.py:909:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `(Mapping[str, Any] & Top[dict[Unknown, Unknown]] & ~SchemaBase) | dict[str, Any]`
+ altair/vegalite/v6/api.py:909:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `(Mapping[str, Any] & Top[dict[Unknown, Unknown]] & ~SchemaBase) | (Mapping[str, Any] & TypedDictTop) | dict[str, Any]`
apprise (https://github.com/caronc/apprise)
- apprise/config/base.py:1118:31 error[no-matching-overload] No overload of bound method `Pattern.match` matches arguments
- apprise/config/base.py:1172:37 error[invalid-argument-type] Method `__delitem__` of type `bound method Top[dict[Unknown, Unknown]].__delitem__(key: Never, /) -> None` cannot be called with key of type `Literal["schema"]` on object of type `Top[dict[Unknown, Unknown]]`
- apprise/config/base.py:1198:21 error[no-matching-overload] No overload of bound method `MutableMapping.update` matches arguments
artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/type_hints.py:161:41 error[invalid-type-form] Variable of type `type` is not allowed in a type expression
+ src/arti/internal/type_hints.py:161:41 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/core/property/bases.py:264:41 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `object` on object of type `Top[dict[Unknown, Unknown]]`
- src/bokeh/core/property/bases.py:264:49 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `object` on object of type `Top[dict[Unknown, Unknown]]`
- src/bokeh/embed/standalone.py:262:18 error[invalid-assignment] Object of type `list[object]` is not assignable to `Model | Sequence[Model] | dict[str, Model]`
- src/bokeh/embed/standalone.py:265:28 error[invalid-argument-type] Argument is incorrect: Expected `Sequence[Model]`, found `Model | Sequence[Model] | dict[str, Model]`
+ src/bokeh/embed/standalone.py:265:28 error[invalid-argument-type] Argument is incorrect: Expected `Sequence[Model]`, found `(Model & ~Top[dict[Unknown, Unknown]]) | (Sequence[Model] & ~Top[dict[Unknown, Unknown]]) | list[Unknown | Model]`
cloud-init (https://github.com/canonical/cloud-init)
- cloudinit/config/cc_ubuntu_pro.py:129:16 error[no-matching-overload] No overload of function `search` matches arguments
- cloudinit/config/cc_ubuntu_pro.py:130:48 error[invalid-argument-type] Argument to function `escape` is incorrect: Argument type `~None` does not satisfy constraints (`str`, `bytes`) of type variable `AnyStr`
- cloudinit/config/cc_ubuntu_pro.py:136:23 error[invalid-argument-type] Argument to function `subp` is incorrect: Expected `str | bytes | list[str] | list[bytes]`, found `list[object] | list[str]`
- cloudinit/config/cc_ubuntu_pro.py:140:27 error[no-matching-overload] No overload of bound method `str.replace` matches arguments
core (https://github.com/home-assistant/core)
- homeassistant/auth/permissions/merge.py:61:43 error[invalid-argument-type] Argument to function `_merge_policies` is incorrect: Expected `list[CategoryType]`, found `list[SubCategoryType | None]`
+ homeassistant/auth/permissions/merge.py:61:43 error[invalid-argument-type] Argument to function `_merge_policies` is incorrect: Expected `list[CategoryType]`, found `list[Mapping[str, ValueType] | bool | None]`
- homeassistant/auth/permissions/util.py:111:12 error[invalid-return-type] Return type does not match returned value: expected `bool`, found `ValueType`
+ homeassistant/auth/permissions/util.py:111:12 error[invalid-return-type] Return type does not match returned value: expected `bool`, found `Mapping[str, bool] | bool | None`
- homeassistant/components/asuswrt/helpers.py:42:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[Unknown, object]`
+ homeassistant/components/asuswrt/helpers.py:42:16 error[invalid-return-type] Return type does not match returned value: expected `T@translate_to_legacy`, found `dict[Unknown, Unknown]`
- homeassistant/components/asuswrt/helpers.py:42:17 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/load_tool.py:233:32 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `(int & Top[MutableMapping[Unknown, Unknown]]) | (str & Top[MutableMapping[Unknown, Unknown]]) | (float & Top[MutableMapping[Unknown, Unknown]]) | ... omitted 5 union elements`)
+ cwltool/load_tool.py:233:32 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `(int & Top[MutableMapping[Unknown, Unknown]]) | (str & Top[MutableMapping[Unknown, Unknown]]) | (float & Top[MutableMapping[Unknown, Unknown]]) | ... omitted 6 union elements`)
- cwltool/main.py:1344:58 error[invalid-argument-type] Argument to function `remove_at_id` is incorrect: Expected `MutableMapping[str, int | str | float | ... omitted 5 union elements]`, found `Top[MutableMapping[Unknown, Unknown]]`
+ cwltool/main.py:1344:58 error[invalid-argument-type] Argument to function `remove_at_id` is incorrect: Expected `MutableMapping[str, int | str | float | ... omitted 5 union elements]`, found `Top[MutableMapping[Unknown, Unknown]] | TypedDictTop`
+ cwltool/pack.py:97:25 error[unresolved-attribute] Attribute `clear` is not defined on `CWLFileType`, `CWLDirectoryType` in union `(MutableMapping[str, int | str | float | ... omitted 5 union elements] & ~Top[MutableSequence[Unknown]]) | (int & Top[MutableMapping[Unknown, Unknown]] & ~Top[MutableSequence[Unknown]]) | (str & Top[MutableMapping[Unknown, Unknown]] & ~Top[MutableSequence[Unknown]]) | ... omitted 4 union elements`
- cwltool/process.py:1226:30 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `(CWLFileType & Top[MutableMapping[Unknown, Unknown]]) | (CWLDirectoryType & Top[MutableMapping[Unknown, Unknown]]) | MutableMapping[str, int | str | float | ... omitted 5 union elements] | (Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]] & Top[MutableMapping[Unknown, Unknown]])`)
+ cwltool/process.py:1226:30 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `MutableMapping[str, int | str | float | ... omitted 5 union elements] | (Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]] & Top[MutableMapping[Unknown, Unknown]]) | CWLFileType | CWLDirectoryType`)
- tests/test_examples.py:348:12 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
- tests/test_examples.py:348:12 error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- tests/test_examples.py:348:12 error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_examples.py:348:12 error[invalid-argument-type] Method `__getitem__` of type `bound method MutableMapping[str, Divergent].__getitem__(key: str, /) -> Divergent` cannot be called with key of type `Literal[0]` on object of type `MutableMapping[str, Divergent]`
- tests/test_examples.py:348:26 error[invalid-key] TypedDict `CWLDirectoryType` can only be subscripted with a string literal key, got key of type `Literal[0]`
- tests/test_examples.py:348:26 error[invalid-key] TypedDict `CWLFileType` can only be subscripted with a string literal key, got key of type `Literal[0]`
- tests/test_examples.py:349:12 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
- tests/test_examples.py:349:12 error[not-subscriptable] Cannot subscript object of type `float` with no `__getitem__` method
- tests/test_examples.py:349:12 error[invalid-argument-type] Method `__getitem__` of type `bound method MutableMapping[str, Divergent].__getitem__(key: str, /) -> Divergent` cannot be called with key of type `Literal[1]` on object of type `MutableMapping[str, Divergent]`
- tests/test_examples.py:349:26 error[invalid-key] TypedDict `CWLFileType` can only be subscripted with a string literal key, got key of type `Literal[1]`
- tests/test_examples.py:350:12 error[not-subscriptable] Cannot subscript object of type `None` with no `__getitem__` method
- tests/test_examples.py:350:26 error[invalid-key] TypedDict `CWLDirectoryType` can only be subscripted with a string literal key, got key of type `Literal[2]`
- tests/test_examples.py:363:12 error[not-subscriptable] Cannot subscript object of type `int` with no `__getitem__` method
- tests/test_examples.py:1720:63 error[not-iterable] Object of type `int | str | float | ... omitted 5 union elements` may not be iterable
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/internal/remoteconfig/__init__.py:35:44 error[invalid-argument-type] Argument expression after ** must be a mapping with `str` key type: Found `object`
- ddtrace/appsec/_asm_request_context.py:241:32 error[invalid-argument-type] Argument to `Block_config.__init__` is incorrect: Expected `int`, found `Any | str | int | None`
- ddtrace/appsec/_asm_request_context.py:241:32 error[invalid-argument-type] Argument to `Block_config.__init__` is incorrect: Expected `int`, found `Any | str | int | None`
- ddtrace/appsec/_asm_request_context.py:241:32 error[invalid-argument-type] Argument to `Block_config.__init__` is incorrect: Expected `str`, found `Any | str | int | None`
- ddtrace/contrib/internal/botocore/services/stepfunctions.py:37:58 error[invalid-argument-type] Argument to function `dispatch` is incorrect: Expected `tuple[Any, ...]`, found `list[ExecutionContext[Unknown] | None | (Any & Top[dict[Unknown, Unknown]])]`
+ ddtrace/contrib/internal/botocore/services/stepfunctions.py:37:58 error[invalid-argument-type] Argument to function `dispatch` is incorrect: Expected `tuple[Any, ...]`, found `list[ExecutionContext[Unknown] | None | (Any & Top[dict[Unknown, Unknown]]) | (Any & TypedDictTop)]`
- ddtrace/contrib/internal/pymongo/utils.py:147:26 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
+ ddtrace/contrib/internal/pymongo/utils.py:152:28 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `object`
- ddtrace/llmobs/_experiment.py:2176:68 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["message"]`
- ddtrace/llmobs/_experiment.py:2177:97 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Divergent, (index: slice[int | None, int | None, int | None], /) -> Sequence[Divergent]]` cannot be called with key of type `Literal["message"]` on object of type `Sequence[Divergent]`
- ddtrace/llmobs/_integrations/bedrock_agents.py:114:31 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["traceId"]`
- scripts/view_trace_snapshot.py:153:38 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/util/rich_tables.py:32:21 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[dict[Unknown, Unknown]]`
- freqtrade/util/rich_tables.py:32:47 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> str | Unknown, (index: slice[int | None, int | None, int | None], /) -> Sequence[str | Unknown]]` cannot be called with key of type `str` on object of type `Sequence[str | Unknown]`
- freqtrade/util/rich_tables.py:32:75 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> str | Unknown, (index: slice[int | None, int | None, int | None], /) -> Sequence[str | Unknown]]` cannot be called with key of type `str` on object of type `Sequence[str | Unknown]`
graphql-core (https://github.com/graphql-python/graphql-core)
- src/graphql/error/graphql_error.py:213:77 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `~Literal["original_error"]`
- src/graphql/execution/types.py:107:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["errors"]`
- src/graphql/execution/types.py:108:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["extensions"]`
- src/graphql/execution/types.py:295:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["pending"]`
- src/graphql/execution/types.py:412:31 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["id"]`
- src/graphql/execution/types.py:413:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["subPath"]`
- src/graphql/execution/types.py:415:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["extensions"]`
- src/graphql/execution/types.py:521:22 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- src/graphql/execution/types.py:618:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["path"]`
- src/graphql/execution/types.py:669:30 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["id"]`
ibis (https://github.com/ibis-project/ibis)
- ibis/backends/sql/ddl.py:82:54 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[dict[Unknown, Unknown]]`
ignite (https://github.com/pytorch/ignite)
- tests/ignite/test_utils.py:49:28 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Unknown, (index: slice[int | None, int | None, int | None], /) -> Sequence[Unknown]]` cannot be called with key of type `Literal["a"]` on object of type `Sequence[Unknown]`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/build.py:447:24 error[invalid-return-type] Return type does not match returned value: expected `_T@copy_value`, found `list[Never] | dict[Never, Never] | set[Never]`
+ mesonbuild/build.py:447:24 error[invalid-return-type] Return type does not match returned value: expected `_T@copy_value`, found `list[Never] | dict[Never, Never] | TypedDictTop | set[Never]`
- mesonbuild/interpreterbase/helpers.py:41:20 error[invalid-return-type] Return type does not match returned value: expected `Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements`, found `dict[object, Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements]`
- mesonbuild/interpreterbase/helpers.py:41:33 error[invalid-argument-type] Argument to function `resolver` is incorrect: Expected `Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements`, found `object`
- mesonbuild/interpreterbase/helpers.py:63:54 error[invalid-argument-type] Argument to function `stringifyUserArguments` is incorrect: Expected `Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements`, found `object`
- mesonbuild/interpreterbase/interpreterbase.py:615:13 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `InterpreterObject` on object of type `dict[str, InterpreterObject | None]`
- mesonbuild/interpreterbase/interpreterbase.py:615:41 error[invalid-argument-type] Argument to bound method `InterpreterBase._holderify` is incorrect: Expected `Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements`, found `object`
- mesonbuild/modules/sourceset.py:243:29 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- mesonbuild/modules/sourceset.py:243:50 error[too-many-positional-arguments] Too many positional arguments to bound method `ConfigurationData.get`: expected 2, got 3
mitmproxy (https://github.com/mitmproxy/mitmproxy)
- mitmproxy/http.py:601:21 error[no-matching-overload] No overload of function `always_bytes` matches arguments
mkdocs (https://github.com/mkdocs/mkdocs)
- mkdocs/config/config_options.py:834:12 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[dict[Unknown, Unknown]]`
- mkdocs/config/config_options.py:834:49 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[dict[Unknown, Unknown]]`
- mkdocs/config/config_options.py:836:46 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[dict[Unknown, Unknown]]`
+ mkdocs/config/config_options.py:142:33 error[no-matching-overload] No overload of bound method `MutableMapping.setdefault` matches arguments
+ mkdocs/config/config_options.py:139:56 error[invalid-argument-type] Argument to bound method `TypedDictFallback.setdefault` is incorrect: Expected `Never`, found `str`
- mkdocs/config/config_options.py:846:67 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["custom_dir"]` on object of type `Top[dict[Unknown, Unknown]]`
+ mkdocs/config/config_options.py:846:13 error[invalid-assignment] Cannot assign to a subscript on an object of type `TypedDictTop`
- mkdocs/config/config_options.py:848:63 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["custom_dir"]` on object of type `Top[dict[Unknown, Unknown]]`
- mkdocs/config/config_options.py:858:28 error[invalid-argument-type] Argument expression after ** must be a mapping with `str` key type: Found `object`
+ mkdocs/config/config_options.py:858:28 error[invalid-argument-type] Argument to `Theme.__init__` is incorrect: Expected `Collection[str]`, found `object`
+ mkdocs/config/config_options.py:858:28 error[invalid-argument-type] Argument to `Theme.__init__` is incorrect: Expected `str | None`, found `object`
+ mkdocs/config/config_options.py:858:28 error[invalid-argument-type] Argument to `Theme.__init__` is incorrect: Expected `str | None`, found `object`
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/asynchronous/topology.py:859:57 error[invalid-argument-type] Argument to function `_is_stale_error_topology_version` is incorrect: Expected `Mapping[str, Any] | None`, found `object`
- pymongo/synchronous/topology.py:855:46 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["topologyVersion"]`
+ pymongo/synchronous/topology.py:857:57 error[invalid-argument-type] Argument to function `_is_stale_error_topology_version` is incorrect: Expected `Mapping[str, Any] | None`, found `object`
mypy (https://github.com/python/mypy)
- mypy/test/test_diff_cache.py:126:56 error[unresolved-attribute] Object of type `object` has no attribute `startswith`
- mypy/test/test_diff_cache.py:128:42 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["/a."]` and `object`
- mypy/test/test_diff_cache.py:128:56 error[unresolved-attribute] Object of type `object` has no attribute `startswith`
- mypy/server/astdiff.py:157:78 error[invalid-argument-type] Argument to function `compare_symbol_table_snapshots` is incorrect: Expected `dict[str, tuple[object, ...]]`, found `Top[dict[Unknown, Unknown]]`
+ mypy/server/astdiff.py:157:78 error[invalid-argument-type] Argument to function `compare_symbol_table_snapshots` is incorrect: Expected `dict[str, tuple[object, ...]]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/core/lists/model.py:410:24 error[unresolved-attribute] Attribute `key` is not defined on `AnnotatedSeed & ~Top[dict[Unknown, Unknown]]` in union `(Thing & ~str & ~Top[dict[Unknown, Unknown]]) | (AnnotatedSeed & ~Top[dict[Unknown, Unknown]])`
- openlibrary/core/lists/model.py:411:13 error[invalid-assignment] Object of type `(Thing & ~str & ~Top[dict[Unknown, Unknown]]) | (AnnotatedSeed & ~Top[dict[Unknown, Unknown]])` is not assignable to attribute `value` of type `Thing | str`
- openlibrary/core/lists/model.py:458:27 error[invalid-argument-type] Argument to `Seed.__init__` is incorrect: Expected `Thing | str | AnnotatedSeed`, found `str | (ThingReferenceDict & ~Top[dict[Unknown, Unknown]]) | (AnnotatedSeedDict & ~Top[dict[Unknown, Unknown]])`
+ openlibrary/core/lists/model.py:450:29 warning[redundant-cast] Value is already of type `ThingReferenceDict`
- openlibrary/plugins/openlibrary/lists.py:125:23 error[invalid-yield] Yield type `dict[str, dict[str, ThingReferenceDict | str | AnnotatedSeedDict]]` does not match annotated yield type `AnnotatedSeedDict`
- openlibrary/plugins/openlibrary/lists.py:125:41 error[invalid-argument-type] Invalid argument to key "key" with declared type `str` on TypedDict `ThingReferenceDict`: value of type `(ThingReferenceDict & ~Top[dict[Unknown, Unknown]]) | str | (AnnotatedSeedDict & ~Top[dict[Unknown, Unknown]])`
packaging (https://github.com/pypa/packaging)
- src/packaging/_parser.py:55:33 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["value"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/packaging/specifiers.py:1485:21 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- src/packaging/specifiers.py:1486:37 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_prereleases"]`
- src/packaging/version.py:808:36 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_version"]`
+ src/packaging/version.py:811:33 error[unresolved-attribute] Object of type `~None` has no attribute `release`
+ src/packaging/version.py:812:29 error[unresolved-attribute] Object of type `~None` has no attribute `pre`
+ src/packaging/version.py:813:30 error[unresolved-attribute] Object of type `~None` has no attribute `post`
- src/packaging/version.py:800:47 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_pre"]`
+ src/packaging/version.py:801:21 error[invalid-assignment] Object of type `object` is not assignable to attribute `_post` of type `tuple[Literal["post"], int] | None`
- src/packaging/version.py:802:47 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_dev"]`
- src/packaging/version.py:803:49 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_local"]`
+ src/packaging/version.py:803:21 error[invalid-assignment] Object of type `object` is not assignable to attribute `_local` of type `tuple[int | str, ...] | None`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/frame.py:18680:21 error[invalid-argument-type] Argument to function `isin` is incorrect: Expected `ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | ... omitted 3 union elements`, found `(Sequence[Unknown] & ~Top[dict[Unknown, Unknown]] & ~Series & ~DataFrame) | (Mapping[Unknown, Unknown] & ~Top[dict[Unknown, Unknown]] & ~Series & ~DataFrame)`
+ pandas/core/frame.py:18680:21 error[invalid-argument-type] Argument to function `isin` is incorrect: Expected `ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Index | ... omitted 3 union elements`, found `(Sequence[Unknown] & ~Top[dict[Unknown, Unknown]] & ~Series & ~DataFrame) | (Mapping[Unknown, Unknown] & ~Top[dict[Unknown, Unknown]] & ~TypedDictTop & ~Series & ~DataFrame)`
- pandas/io/_util.py:166:35 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `object` on object of type `Top[dict[Unknown, Unknown]]`
- pandas/io/parsers/arrow_parser_wrapper.py:202:28 error[unresolved-attribute] Attribute `get` is not defined on `dtype[Any]`, `ExtensionDtype` in union `dict[object, dtype[Any] | ExtensionDtype] | dtype[Any] | ExtensionDtype | (Unknown & ~None)`
+ pandas/io/parsers/arrow_parser_wrapper.py:202:28 error[unresolved-attribute] Attribute `get` is not defined on `dtype[Any]`, `ExtensionDtype` in union `dict[Divergent, dtype[Any] | ExtensionDtype] | dtype[Any] | ExtensionDtype | (Unknown & ~None)`
- pandas/io/parsers/arrow_parser_wrapper.py:203:52 error[unresolved-attribute] Attribute `get` is not defined on `dtype[Any]`, `ExtensionDtype` in union `dict[object, dtype[Any] | ExtensionDtype] | dtype[Any] | ExtensionDtype | (Unknown & ~None)`
+ pandas/io/parsers/arrow_parser_wrapper.py:203:52 error[unresolved-attribute] Attribute `get` is not defined on `dtype[Any]`, `ExtensionDtype` in union `dict[Divergent, dtype[Any] | ExtensionDtype] | dtype[Any] | ExtensionDtype | (Unknown & ~None)`
pandera (https://github.com/pandera-dev/pandera)
- pandera/io/_minimal.py:145:34 error[invalid-argument-type] Argument to function `prune_component_dict` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
- pandera/io/_minimal.py:196:38 error[invalid-argument-type] Argument to function `prune_component_dict` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
- pandera/io/_minimal.py:245:49 error[invalid-argument-type] Argument to function `apply_minimal_nested_data_array` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
- pandera/io/_minimal.py:247:38 error[invalid-argument-type] Argument to function `prune_component_dict` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
- pandera/io/_minimal.py:257:38 error[invalid-argument-type] Argument to function `prune_component_dict` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
pip (https://github.com/pypa/pip)
- src/pip/_vendor/packaging/markers.py:417:27 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["_markers"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/pip/_vendor/packaging/requirements.py:106:13 error[no-matching-overload] No overload of bound method `MutableMapping.update` matches arguments
- src/pip/_vendor/packaging/specifiers.py:796:27 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- src/pip/_vendor/packaging/specifiers.py:1486:21 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- src/pip/_vendor/packaging/specifiers.py:1487:37 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_prereleases"]`
+ src/pip/_vendor/packaging/version.py:811:31 error[unresolved-attribute] Object of type `~None` has no attribute `epoch`
+ src/pip/_vendor/packaging/version.py:812:33 error[unresolved-attribute] Object of type `~None` has no attribute `release`
+ src/pip/_vendor/packaging/version.py:813:29 error[unresolved-attribute] Object of type `~None` has no attribute `pre`
+ src/pip/_vendor/packaging/version.py:816:31 error[unresolved-attribute] Object of type `~None` has no attribute `local`
- src/pip/_vendor/packaging/version.py:800:37 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["_release"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/pip/_vendor/packaging/version.py:801:47 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_pre"]`
+ src/pip/_vendor/packaging/version.py:801:21 error[invalid-assignment] Object of type `object` is not assignable to attribute `_pre` of type `tuple[Literal["a", "b", "rc"], int] | None`
- src/pip/_vendor/packaging/version.py:803:47 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["_dev"]`
+ src/pip/_vendor/packaging/version.py:803:21 error[invalid-assignment] Object of type `object` is not assignable to attribute `_dev` of type `tuple[Literal["dev"], int] | None`
- src/pip/_vendor/urllib3/fields.py:281:24 error[invalid-assignment] Object of type `dict_items[object, object]` is not assignable to `Iterable[tuple[str, str | bytes | None]]`
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/runner/storage.py:586:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["credentials"]` and value of type `dict[str, Unknown | str]` on object of type `dict[str, str | None]`
+ src/prefect/runner/storage.py:586:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["credentials"]` and value of type `dict[str, Any | str]` on object of type `dict[str, str | None]`
- src/prefect/utilities/templating/__init__.py:92:47 error[invalid-argument-type] Argument to function `find_placeholders` is incorrect: Argument type `object` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating/__init__.py:378:29 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
- src/prefect/utilities/templating/__init__.py:385:17 error[invalid-argument-type] Argument is incorrect: Argument type `object` does not satisfy constraints (`str`, `int`, `int | float`, `bool`, `dict[Any, Any]`, `list[Any]`, `None`) of type variable `T`
- src/prefect/utilities/templating/__init__.py:387:13 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `Unknown | dict[str, Any]` on object of type `dict[str, Any]`
psycopg (https://github.com/psycopg/psycopg)
- psycopg/psycopg/errors.py:514:38 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `DiagnosticField`
pydantic (https://github.com/pydantic/pydantic)
- pydantic/fields.py:1600:13 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`, found `dict[str, Divergent] | dict[Never, Never] | (((dict[str, Divergent], /) -> None) & ~Top[dict[Unknown, Unknown]]) | None`
+ pydantic/fields.py:1600:13 error[invalid-argument-type] Argument is incorrect: Expected `dict[str, Divergent] | ((dict[str, Divergent], /) -> None) | None`, found `dict[str, Divergent] | dict[Never, Never] | TypedDictTop | (((dict[str, Divergent], /) -> None) & ~Top[dict[Unknown, Unknown]] & ~TypedDictTop) | None`
- pydantic/json_schema.py:1688:13 error[no-matching-overload] No overload of bound method `MutableMapping.update` matches arguments
pyproject-metadata (https://github.com/pypa/pyproject-metadata)
- pyproject_metadata/project_table.py:276:16 error[no-matching-overload] No overload of bound method `Pattern.fullmatch` matches arguments
- pyproject_metadata/project_table.py:311:21 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[dict[Unknown, Unknown]]`
- pyproject_metadata/pyproject.py:90:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, str] | None`, found `Top[dict[Unknown, Unknown]]`
+ pyproject_metadata/pyproject.py:90:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, str] | None`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
pywin32 (https://github.com/mhammond/pywin32)
- FAILED old=abnormal exit(2) new=abnormal exit(2)
schema_salad (https://github.com/common-workflow-language/schema_salad)
- src/schema_salad/avro/schema.py:802:34 error[invalid-argument-type] Argument to function `is_subtype` is incorrect: Expected `None | str | int | ... omitted 6 union elements`, found `object`
- src/schema_salad/avro/schema.py:804:44 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["names"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/avro/schema.py:806:33 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["extends"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/avro/schema.py:808:25 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["type"]`
- src/schema_salad/avro/schema.py:808:56 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["type"]`
- src/schema_salad/avro/schema.py:811:38 error[invalid-argument-type] Argument to function `is_subtype` is incorrect: Expected `None | str | int | ... omitted 6 union elements`, found `object`
- src/schema_salad/avro/schema.py:811:58 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/avro/schema.py:813:38 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["symbols"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/avro/schema.py:813:59 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["symbols"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/avro/schema.py:815:57 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["fields"]` on object of type `Top[dict[Unknown, Unknown]]`
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/core/error_feedback/parsers/confluent.py:52:27 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["error_code"]`
- src/schemathesis/core/error_feedback/parsers/confluent.py:57:24 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["message"]`
- src/schemathesis/core/error_feedback/parsers/drf.py:172:59 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["detail"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schemathesis/core/error_feedback/parsers/rails.py:215:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["message"]`
+ src/schemathesis/core/error_feedback/parsers/jackson.py:181:41 error[invalid-argument-type] Argument to function `_carrier_strings` is incorrect: Expected `dict[Unknown, Unknown]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
- src/schemathesis/config/_diff_base.py:44:49 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `object` on object of type `Top[dict[Unknown, Unknown]]`
- src/schemathesis/config/_diff_base.py:64:33 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `object`
- src/schemathesis/core/error_feedback/parsers/ajv.py:187:34 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["keyword"]`
- src/schemathesis/core/error_feedback/parsers/ajv.py:195:26 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["errors"]`
+ src/schemathesis/core/error_feedback/parsers/ajv.py:198:12 error[invalid-return-type] Return type does not match returned value: expected `list[dict[Unknown, Unknown]] | None`, found `Top[list[Unknown]] & ~AlwaysFalsy`
- src/schemathesis/core/error_feedback/parsers/ajv.py:331:48 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["message"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schemathesis/core/error_feedback/parsers/aspnet.py:162:23 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["errors"]`
+ src/schemathesis/core/error_feedback/parsers/aspnet.py:170:12 error[invalid-return-type] Return type does not match returned value: expected `Mapping[str, Sequence[object]] | None`, found `(Top[dict[Unknown, Unknown]] & ~AlwaysFalsy) | (TypedDictTop & ~AlwaysFalsy)`
- src/schemathesis/core/error_feedback/parsers/go_validator.py:178:24 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["error"]`
- src/schemathesis/core/error_feedback/parsers/laravel.py:133:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["message"]`
- src/schemathesis/core/error_feedback/parsers/pydantic.py:147:27 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["detail"]`
- src/schemathesis/core/error_feedback/parsers/pydantic.py:162:27 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["detail"]`
+ src/schemathesis/core/error_feedback/parsers/pydantic.py:181:37 error[invalid-argument-type] Argument is incorrect: Expected `dict[Unknown, Unknown]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
+ src/schemathesis/core/error_feedback/parsers/spring.py:268:72 error[invalid-argument-type] Argument to function `SpringParser._extract_top_level_message` is incorrect: Expected `dict[Unknown, Unknown]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
+ src/schemathesis/core/error_feedback/parsers/spring.py:269:76 error[invalid-argument-type] Argument to function `SpringParser._extract_unexpected_properties` is incorrect: Expected `dict[Unknown, Unknown]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
- src/schemathesis/core/error_feedback/parsers/spring.py:231:32 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["detail"]`
- src/schemathesis/core/error_feedback/parsers/symfony.py:193:59 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["propertyPath"]`
- src/schemathesis/core/error_feedback/parsers/symfony.py:203:31 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["violations"]`
- src/schemathesis/core/error_feedback/parsers/zod.py:46:30 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["issues", "errors"]`
+ src/schemathesis/core/error_feedback/parsers/zod.py:48:20 error[invalid-return-type] Return type does not match returned value: expected `list[dict[Unknown, Unknown]] | None`, found `object`
- src/schemathesis/generation/hypothesis/_response_matching.py:23:70 error[unresolved-attribute] Object of type `object` has no attribute `lower`
- src/schemathesis/openapi/checks.py:151:31 error[invalid-argument-type] Argument to function `unbundle` is incorrect: Expected `dict[str, Any] | bool | list[dict[str, Any] | bool]`, found `dict[Unknown, Unknown] | (Unresolvable & Top[dict[Unknown, Unknown]]) | bool | dict[str, Any] | dict[object, object]`
+ src/schemathesis/openapi/checks.py:151:31 error[invalid-argument-type] Argument to function `unbundle` is incorrect: Expected `dict[str, Any] | bool | list[dict[str, Any] | bool]`, found `dict[Unknown, Unknown] | (Unresolvable & Top[dict[Unknown, Unknown]]) | bool | dict[str, Any] | dict[Unknown | str, Unknown]`
- src/schemathesis/openapi/checks.py:173:13 error[invalid-argument-type] Argument to `JsonSchemaError.__init__` is incorrect: Expected `dict[str, Any] | bool`, found `dict[Unknown, Unknown] | (Unresolvable & Top[dict[Unknown, Unknown]]) | dict[str, Any] | dict[object, object]`
+ src/schemathesis/openapi/checks.py:173:13 error[invalid-argument-type] Argument to `JsonSchemaError.__init__` is incorrect: Expected `dict[str, Any] | bool`, found `dict[Unknown, Unknown] | (Unresolvable & Top[dict[Unknown, Unknown]]) | dict[str, Any] | dict[Unknown | str, Unknown]`
- src/schemathesis/resources/repository.py:279:25 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `str`
- src/schemathesis/specs/openapi/adapter/responses.py:418:16 error[invalid-return-type] Return type does not match returned value: expected `str | None`, found `object`
- src/schemathesis/specs/openapi/adapter/responses.py:431:16 error[invalid-return-type] Return type does not match returned value: expected `str | None`, found `object`
- src/schemathesis/specs/openapi/converter.py:233:28 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["$ref"]`
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/_vendor/pyproject_metadata/pyproject.py:90:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, str] | None`, found `Top[dict[Unknown, Unknown]]`
+ src/scikit_build_core/_vendor/pyproject_metadata/pyproject.py:90:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, str] | None`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
- src/scikit_build_core/metadata/__init__.py:108:51 error[unresolved-attribute] Object of type `object` has no attribute `items`
- src/scikit_build_core/metadata/__init__.py:89:24 error[invalid-argument-type] Argument is incorrect: Expected `str`, found `object`
scipy (https://github.com/scipy/scipy)
- scipy/_lib/_util.py:1022:13 error[unsupported-operator] Operator `+` is not supported between objects of type `_S@map` and `Unknown | Literal[1]`
- scipy/_lib/_util.py:1022:21 error[invalid-argument-type] Argument to constructor `map.__new__` is incorrect: Expected `(object, /) -> int`, found `def len(obj: Sized, /) -> int`
setuptools (https://github.com/pypa/setuptools)
- setuptools/_distutils/command/build_ext.py:430:38 error[invalid-argument-type] Argument to bound method `dict.get` is incorrect: Expected `Never`, found `Literal["include_dirs", "library_dirs", "libraries", "extra_objects", "extra_compile_args", "extra_link_args"]`
- setuptools/_distutils/command/build_ext.py:418:39 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["sources"]` on object of type `Top[dict[Unknown, 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] | list[Unknown]`
sockeye (https://github.com/awslabs/sockeye)
- sockeye/inference.py:410:32 error[invalid-argument-type] Argument is incorrect: Expected `RestrictLexicon | None`, found `object`
spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/jinja2/filters.py:219:50 error[invalid-assignment] Object of type `dict_items[object, object]` is not assignable to `Iterable[tuple[str, Any]]`
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/components/v2/bidi_component/main.py:508:44 warning[unused-ignore-comment] Unused `ty: ignore` directive
sympy (https://github.com/sympy/sympy)
- sympy/ntheory/tests/test_factor_.py:62:13 error[unsupported-operator] Operator `*=` is not supported between objects of type `Literal[1]` and `object`
- sympy/ntheory/tests/test_factor_.py:64:16 error[unsupported-operator] Operator `%` is not supported between objects of type `~AlwaysFalsy & ~Literal[1]` and `Literal[2]`
- sympy/ntheory/tests/test_factor_.py:65:17 error[unsupported-operator] Operator `*=` is not supported between objects of type `Literal[1]` and `object`
- sympy/ntheory/tests/test_factor_.py:66:33 error[unsupported-operator] Operator `//` is not supported between objects of type `~AlwaysFalsy & ~Literal[1]` and `Literal[2]`
+ sympy/series/order.py:306:20 error[unresolved-attribute] Attribute `expr` is not defined on `Expr` in union `Unknown | Expr`
typeshed-stats (https://github.com/AlexWaygood/typeshed-stats)
+ src/typeshed_stats/gather.py:433:12 error[invalid-return-type] Return type does not match returned value: expected `Mapping[str, object]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
werkzeug (https://github.com/pallets/werkzeug)
- src/werkzeug/http.py:365:18 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- src/werkzeug/_internal.py:42:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `(Any & Top[dict[Unknown, Unknown]]) | dict[str, Any] | (Request & Top[dict[Unknown, Unknown]])`
+ src/werkzeug/_internal.py:42:12 error[invalid-return-type] Return type does not match returned value: expected `dict[str, Any]`, found `(Any & Top[dict[Unknown, Unknown]]) | dict[str, Any] | (Request & Top[dict[Unknown, Unknown]]) | (Any & TypedDictTop)`
xarray (https://github.com/pydata/xarray)
- xarray/core/common.py:1707:17 error[no-matching-overload] No overload of bound method `dict.get` matches arguments
+ xarray/core/common.py:1707:17 error[no-matching-overload] No overload of bound method `Mapping.get` matches arguments
- xarray/core/dataarray.py:474:9 error[invalid-assignment] Object of type `(Sequence[Sequence[Unknown] | Index[Any] | DataArray | Variable | ndarray[tuple[Any, ...], dtype[Any]]] & Top[dict[Unknown, Unknown]]) | (Mapping[Unknown, Unknown] & Top[dict[Unknown, Unknown]]) | dict[Unknown, Variable]` is not assignable to attribute `_coords` of type `dict[Any, Variable]`
+ xarray/core/dataarray.py:474:9 error[invalid-assignment] Object of type `(Sequence[Sequence[Unknown] | Index[Any] | DataArray | Variable | ndarray[tuple[Any, ...], dtype[Any]]] & Top[dict[Unknown, Unknown]]) | (Mapping[Unknown, Unknown] & Top[dict[Unknown, Unknown]]) | (Mapping[Unknown, Unknown] & TypedDictTop) | dict[Unknown, Variable]` is not assignable to attribute `_coords` of type `dict[Any, Variable]`
xarray-dataclasses (https://github.com/astropenguin/xarray-dataclasses)
- xarray_dataclasses/dataarray.py:187:27 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[dict[Unknown, Unknown]]`
zulip (https://github.com/zulip/zulip)
- zerver/lib/push_notifications.py:608:23 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["apple_devices"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/push_notifications.py:650:33 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["expected_end_timestamp"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:264:34 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:440:19 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["widget_type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:450:12 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:500:8 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:513:8 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:524:58 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:532:8 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:545:8 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[dict[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/openapi/openapi.py:50:38 error[invalid-argument-type] Argument to function `naively_merge` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]]`
+ zerver/openapi/openapi.py:50:38 error[invalid-argument-type] Argument to function `naively_merge` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
- zerver/openapi/openapi.py:50:47 error[invalid-argument-type] Argument to function `naively_merge` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]]`
+ zerver/openapi/openapi.py:50:47 error[invalid-argument-type] Argument to function `naively_merge` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`
- zerver/openapi/openapi.py:56:41 error[invalid-argument-type] Argument to function `naively_merge_allOf_dict` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]]`
+ zerver/openapi/openapi.py:56:41 error[invalid-argument-type] Argument to function `naively_merge_allOf_dict` is incorrect: Expected `dict[str, object]`, found `Top[dict[Unknown, Unknown]] | TypedDictTop`6490850 to
f2f91f3
Compare
3fa7514 to
cbe8a82
Compare
aa5ab5e to
0f94f5a
Compare
14747c4 to
ce6654d
Compare
|
|
||
| /// Top-materialized `dict`s can project read-only members through `Mapping` so lookups | ||
| /// preserve observer signatures without also loosening mutation APIs. | ||
| fn dict_top_readonly_projection( |
There was a problem hiding this comment.
I would like to avoid this, it feels a bit off...
| /// `Mapping` is intentionally excluded: `TypedDict` is already statically compatible with | ||
| /// `Mapping[str, object]`, so the extra `TypedDictTop` arm would simplify away during | ||
| /// intersection and is not needed. | ||
| fn class_literal_matches_typed_dict_runtime_supertype<'db>( |
There was a problem hiding this comment.
Also feels a bit off...
isinstance(..., dict)
d3bc10b to
e8e8b2b
Compare
AlexWaygood
left a comment
There was a problem hiding this comment.
just a partial review of tests so far, but I need to go and I figured I may as well send you what I have so far!
9a152a7 to
78a5cb8
Compare
AlexWaygood
left a comment
There was a problem hiding this comment.
A couple more nits from skimming. I still haven't properly dug into the changes in narrow.rs yet
| if isinstance(value, dict): | ||
| pass | ||
| else: | ||
| reveal_type(value) # revealed: Vulnerability & ~Top[dict[Unknown, Unknown]] |
There was a problem hiding this comment.
shouldn't this be
| reveal_type(value) # revealed: Vulnerability & ~Top[dict[Unknown, Unknown]] | |
| reveal_type(value) # revealed: Vulnerability & ~Top[dict[Unknown, Unknown]] & ~TypedDictTop |
? the fact that we know it's not an instance of dict at runtime means that we can also exclude all TypedDict types in the else branch here as well as excluding all dict types
There was a problem hiding this comment.
I think Vulnerability is disjoint from TypedDictTop...? Because it's a regular nominal class?
| def narrow_dict_items(value: dict[str, Any] | Iterable[tuple[str, Any]]) -> None: | ||
| if isinstance(value, dict): | ||
| value.clear() |
There was a problem hiding this comment.
the narrowed type of value in this branch could just as well be a TypedDict instance as a dict instance, so surely we should emit an error on the .clear() call here?
There was a problem hiding this comment.
This seems like it would cause a lot of problems in practice though, right...? I feel like this came up in a conversation once before...
There was a problem hiding this comment.
Okay yeah -- and it seems like we agreed this did need an error: https://discord.com/channels/1039017663004942429/1228460843033821285/1483302983830601839
There was a problem hiding this comment.
it might do... it also might not... I'd be curious to see the ecosystem report both ways!
I do think the principled thing to do here would be to be consistent about this, and have the type of value be dict[str, Any] | TypedDictTop in this branch, and therefore disallow the .clear() call. But I am struggling to think right now of any concrete problems that would arise from the way you're currently doing it, so maybe it's okay
I feel like this came up in a conversation once before...
yeah, and I thought the consensus from that was that it might be unpopular with users, but that I was right 😆
Summary
This PR implements a
TypedDictToptype that is a supertype of allTypedDicttypes, and treated as assignable toMapping[str, object].With this type,
isinstance(x, dict)andisinstance(x, MutableMapping)now generate a constraint that includesTypedDictTop, e.g.,Top[dict[Unknown, Unknown]] | TypedDictTop.Closes astral-sh/ty#1130.
Closes astral-sh/ty#2374.