[ty] Relaxed isinstance/issubclass narrowing#26472
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 94.47%. The percentage of expected errors that received a diagnostic held steady at 89.19%. The number of fully passing files held steady at 95/134. |
Memory usage reportSummary
Significant changesClick to expand detailed breakdowntrio
prefect
flake8
sphinx
|
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
4 | 1,006 | 81 |
invalid-assignment |
5 | 222 | 35 |
unresolved-attribute |
0 | 130 | 34 |
invalid-return-type |
4 | 119 | 27 |
no-matching-overload |
0 | 104 | 0 |
invalid-key |
0 | 62 | 0 |
not-subscriptable |
2 | 49 | 3 |
unsupported-operator |
0 | 42 | 3 |
call-non-callable |
2 | 24 | 1 |
not-iterable |
0 | 20 | 3 |
invalid-yield |
0 | 15 | 1 |
index-out-of-bounds |
0 | 14 | 0 |
redundant-cast |
0 | 9 | 0 |
unused-type-ignore-comment |
7 | 2 | 0 |
unused-ignore-comment |
8 | 0 | 0 |
invalid-type-form |
0 | 2 | 2 |
invalid-raise |
0 | 2 | 0 |
possibly-unresolved-reference |
0 | 2 | 0 |
call-top-callable |
0 | 1 | 0 |
| Total | 32 | 1,825 | 190 |
Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.
Showing a random sample of 228 of 2047 changes. See the HTML report for the full diff.
Raw diff sample (228 of 2047 changes)
Expression (https://github.com/cognitedata/Expression)
- expression/collections/maptree.py:116:28 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Never, Never]]`
- expression/collections/maptree.py:121:24 error[invalid-return-type] Return type does not match returned value: expected `Option[MapTreeLeaf[Key@rebalance, Value@rebalance]]`, found `Option[MapTreeLeaf[Key@rebalance, object]]`
- expression/collections/maptree.py:133:62 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Never, Never]]`
- expression/collections/maptree.py:141:31 error[invalid-argument-type] Argument to function `mk` is incorrect: Expected `Option[MapTreeLeaf[Key@rebalance, object]]`, found `Option[MapTreeLeaf[Never, Never]]`
PyGithub (https://github.com/PyGithub/PyGithub)
- github/RepositoryAdvisory.py:291:71 error[invalid-argument-type] Argument to function `AdvisoryCredit._validate_credit` is incorrect: Expected `SimpleCredit | AdvisoryCredit`, found `object`
- github/RepositoryAdvisory.py:307:84 error[invalid-argument-type] Argument to function `AdvisoryVulnerability._to_github_dict` is incorrect: Expected `SimpleAdvisoryVulnerability | AdvisoryVulnerability`, found `object`
- github/AdvisoryVulnerability.py:129: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["package"]` on object of type `Top[dict[Unknown, Unknown]]`
- github/AdvisoryVulnerability.py:165:41 error[invalid-argument-type] Invalid argument to key "vulnerable_functions" with declared type `list[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]]`
Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/commands/slash.py:2078:97 error[invalid-assignment] Object of type `None | Mapping[str, str] | (Sequence[str] & Top[Mapping[Unknown, object]]) | (Sequence[tuple[str, str]] & Top[Mapping[Unknown, object]]) | (Sequence[CommandChoice] & Top[Mapping[Unknown, object]])` is not assignable to `Mapping[str, str] | list[CommandChoice] | None`
aiohttp (https://github.com/aio-libs/aiohttp)
- aiohttp/client.py:1207:37 error[invalid-argument-type] Argument to bound method `MultiDict.add` is incorrect: Expected `str`, found `object`
- aiohttp/cookiejar.py:332:23 error[invalid-assignment] Object of type `ItemsView[object, object]` is not assignable to `Mapping[str, str | BaseCookie[str] | Morsel[Any]] | Iterable[tuple[str, str | BaseCookie[str] | Morsel[Any]]] | BaseCookie[str]`
- aiohttp/web.py:349:25 error[invalid-argument-type] Argument to `UnixSite.__init__` is incorrect: Expected `str | PathLike[str]`, found `str | (Iterable[str | PathLike[str]] & PathLike[object]) | PathLike[str]`
aioredis (https://github.com/aio-libs/aioredis)
- aioredis/client.py:3430:34 error[invalid-assignment] Object of type `ValuesView[object]` is not assignable to `ValuesView[int | float] | None`
altair (https://github.com/vega/altair)
+ altair/vegalite/v6/api.py:2767:63 warning[unused-ignore-comment] Unused blanket `ty: ignore` directive
anyio (https://github.com/agronholm/anyio)
- src/anyio/_core/_sockets.py:994:38 error[invalid-argument-type] Argument is incorrect: Expected `str | IPv4Address | IPv6Address`, found `object`
- src/anyio/streams/stapled.py:125:21 error[not-subscriptable] Cannot delete subscript on object of type `Sequence[Listener[object]]` with no `__delitem__` method
+ src/anyio/streams/stapled.py:125:21 error[not-subscriptable] Cannot delete subscript on object of type `Sequence[Listener[Unknown]]` with no `__delitem__` method
apprise (https://github.com/caronc/apprise)
- tests/test_config_base.py:254:16 error[unresolved-attribute] Object of type `object` has no attribute `tags`
archinstall (https://github.com/archlinux/archinstall)
- archinstall/lib/profile/profiles_handler.py:132:19 error[unresolved-attribute] Object of type `object` has no attribute `name`
artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/type_hints.py:161:25 error[invalid-type-form] Variable of type `type` is not allowed in a type expression
+ src/arti/internal/type_hints.py:161:25 error[invalid-type-form] Variable of type `type[Unknown]` is not allowed in a type expression
beartype (https://github.com/beartype/beartype)
- beartype/vale/_is/_valeis.py:327:24 error[invalid-assignment] Object of type `object` is not assignable to `((Any, /) -> bool) | tuple[(Any, /) -> bool]`
black (https://github.com/psf/black)
- src/black/trans.py:301:20 error[invalid-raise] Cannot use object of type `object` as an exception cause
- src/black/trans.py:497:13 error[unresolved-attribute] Unresolved attribute `__cause__` on type `object`
- src/black/trans.py:502:19 error[invalid-yield] Yield type `Ok[object]` does not match annotated yield type `Ok[Line] | Err[CannotTransform]`
bokeh (https://github.com/bokeh/bokeh)
- src/bokeh/io/showing.py:165:33 error[invalid-argument-type] Argument to function `_show_with_state` is incorrect: Expected `Showable`, found `UIElement | DOMNode | Sequence[UIElement | DOMNode] | (Application & Sequence[object]) | (((Document, /) -> None) & Sequence[object])`
- src/bokeh/plotting/_plot.py:93:45 error[invalid-argument-type] Argument to `Range1d.__init__` is incorrect: Expected `Value`, found `int | float | (Unknown & ~None) | str | IntrinsicType`
+ src/bokeh/plotting/_plot.py:93:45 error[invalid-argument-type] Argument to `Range1d.__init__` is incorrect: Expected `Value`, found `(Unknown & ~None) | IntrinsicType`
build (https://github.com/pypa/build)
- src/build/_builder.py:165:38 error[no-matching-overload] No overload of bound method `str.join` matches arguments
core (https://github.com/home-assistant/core)
- 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[str, Any]`
+ 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, Any]`
- homeassistant/components/imap/__init__.py:262:20 error[invalid-return-type] Return type does not match returned value: expected `Message[str, str]`, found `object`
+ homeassistant/components/imap/__init__.py:262:20 error[invalid-return-type] Return type does not match returned value: expected `Message[str, str]`, found `Message[str, str] | Any | str`
- homeassistant/components/onvif/device.py:440:17 error[unresolved-attribute] Object of type `object` has no attribute `Name`
- homeassistant/components/onvif/device.py:445:25 error[unresolved-attribute] Object of type `object` has no attribute `VideoEncoderConfiguration`
- homeassistant/components/onvif/device.py:455:21 error[unresolved-attribute] Object of type `object` has no attribute `PTZConfiguration`
- homeassistant/components/rest/data.py:51:44 error[invalid-argument-type] Argument to constructor `BasicAuth.__new__` is incorrect: Expected `str`, found `object`
- homeassistant/components/ring/binary_sensor.py:170:9 error[invalid-assignment] Cannot assign to a subscript on an object of type `Mapping[str, Any]`
cwltool (https://github.com/common-workflow-language/cwltool)
- cwltool/builder.py:276:17 error[invalid-assignment] Cannot assign to a subscript on an object of type `float`
- cwltool/builder.py:279:21 error[invalid-assignment] Cannot assign to a subscript on an object of type `float`
- cwltool/builder.py:279:24 error[invalid-key] Unknown key "streamable" for TypedDict `CWLDirectoryType` (subscripted object has type `(int & Top[MutableMapping[Unknown, Unknown]] & ~Top[MutableSequence[Unknown]]) | (str & Top[MutableMapping[Unknown, Unknown]] & ~Top[MutableSequence[Unknown]]) | (float & Top[MutableMapping[Unknown, Unknown]] & ~Top[MutableSequence[Unknown]]) | ... omitted 3 union elements`)
- cwltool/checker.py:117:61 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["items"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:118:61 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["items"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:121:12 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Divergent, (index: slice[int | None, int | None, int | None], /) -> MutableSequence[Divergent]]` cannot be called with key of type `Literal["type"]` on object of type `MutableSequence[Divergent]`
- cwltool/checker.py:121:12 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/checker.py:121:40 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:123:38 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:123:38 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:133:39 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/checker.py:133:39 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/checker.py:133:52 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/command_line_tool.py:605:33 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["writable"]` and value of type `object` on object of type `MutableMapping[str, int | str | float | ... omitted 5 union elements]`
- cwltool/command_line_tool.py:1531:17 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/load_tool.py:233:13 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["id"]` and value of type `str` on object of type `MutableSequence[Divergent]`
- cwltool/load_tool.py:233:13 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["run"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- 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/main.py:283:58 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/main.py:296:27 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/main.py:297:17 error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- cwltool/main.py:309:16 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/main.py:310:58 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["items"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/main.py:318:16 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["type"]` on object of type `str`
- cwltool/pack.py:33:40 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["run"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:47:38 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:47:40 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `(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/pack.py:47:40 error[invalid-key] Unknown key "name" for TypedDict `CWLDirectoryType` (subscripted object has type `(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/pack.py:93:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["id"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:93:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["id"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:94:39 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["id"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:94:39 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:94:41 error[invalid-key] Unknown key "id" for TypedDict `CWLDirectoryType` (subscripted object has type `(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/pack.py:98:27 error[invalid-key] Unknown key "$import" for TypedDict `CWLDirectoryType` (subscripted object has type `(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/pack.py:142:29 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["id"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/pack.py:147:20 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- cwltool/pack.py:237:13 error[invalid-argument-type] Argument to function `update` is incorrect: Expected `CommentedSeq | CommentedMap`, found `(int & Top[MutableMapping[Unknown, Unknown]]) | (float & Top[MutableMapping[Unknown, Unknown]]) | (str & Top[MutableMapping[Unknown, Unknown]]) | (CommentedMap & Top[MutableMapping[Unknown, Unknown]])`
+ cwltool/pack.py:237:13 error[invalid-argument-type] Argument to function `update` is incorrect: Expected `CommentedSeq | CommentedMap`, found `(int & MutableMapping[Unknown, Unknown]) | (float & MutableMapping[Unknown, Unknown]) | (str & MutableMapping[Unknown, Unknown]) | (CommentedMap & MutableMapping[Unknown, Unknown])`
- cwltool/process.py:1069:58 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Divergent, (index: slice[int | None, int | None, int | None], /) -> MutableSequence[Divergent]]` cannot be called with key of type `Literal["requirements"]` on object of type `MutableSequence[Divergent]`
- cwltool/process.py:1069:58 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["requirements"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/process.py:1071:37 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Divergent, (index: slice[int | None, int | None, int | None], /) -> MutableSequence[Divergent]]` cannot be called with key of type `Literal["requirements"]` on object of type `MutableSequence[Divergent]`
- cwltool/process.py:1071:37 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["requirements"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- cwltool/process.py:1226:26 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements], (index: slice[int | None, int | None, int | None], /) -> Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]]]` cannot be called with key of type `Literal["id"]` on object of type `Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]]`
- cwltool/process.py:1227:58 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements], (index: slice[int | None, int | None, int | None], /) -> Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]]]` cannot be called with key of type `Literal["id"]` on object of type `Sequence[CWLFileType | CWLDirectoryType | MutableMapping[str, int | str | float | ... omitted 5 union elements]]`
- 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: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:363:27 error[invalid-key] Unknown key "checksum" for TypedDict `CWLDirectoryType` (subscripted object has type `int | str | float | ... omitted 5 union elements`)
dd-trace-py (https://github.com/DataDog/dd-trace-py)
- ddtrace/contrib/internal/pymongo/utils.py:152:85 error[unsupported-operator] Operator `in` is not supported between objects of type `Literal["Batch"]` and `object`
- ddtrace/llmobs/_evaluators/llm_judge.py:702:59 error[invalid-argument-type] Argument to bound method `LLMClient.__call__` is incorrect: Expected `dict[str, Any] | None`, found `None | (BooleanStructuredOutput & Top[dict[Unknown, Unknown]] & ~AlwaysFalsy) | (ScoreStructuredOutput & Top[dict[Unknown, Unknown]] & ~AlwaysFalsy) | ... omitted 3 union elements`
discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/cog.py:527:13 error[unresolved-attribute] Unresolved attribute `__cog_listener__` on type `(...) -> Coroutine[Any, Any, Any]`
freqtrade (https://github.com/freqtrade/freqtrade)
- freqtrade/strategy/parameters.py:283:27 error[invalid-argument-type] Argument to `SKDecimal.__init__` is incorrect: Expected `int | float`, found `object`
graphql-core (https://github.com/graphql-python/graphql-core)
- tests/execution/test_hooks.py:355:16 error[unresolved-attribute] Object of type `object` has no attribute `errors`
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/types/relations.py:3223:28 error[unresolved-attribute] Object of type `Expr` has no attribute `type`
jax (https://github.com/google/jax)
- jax/_src/numpy/reductions.py:803:7 error[invalid-assignment] Object of type `object` is not assignable to `Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | ... omitted 4 union elements`
- jax/_src/numpy/lax_numpy.py:3134:20 error[not-iterable] Object of type `(Sequence[int] & tuple[object, ...]) | Array | ndarray[tuple[Any, ...], dtype[Any]] | ... omitted 11 union elements` may not be iterable
- jax/_src/pallas/mosaic_gpu/core.py:378:11 error[invalid-argument-type] Argument expression after ** must be a mapping with `str` key type: Found `object`
koda-validate (https://github.com/keithasaurus/koda-validate)
- koda_validate/serialization/json_schema.py:356:17 error[invalid-return-type] Return type does not match returned value: expected `dict[str, None | int | str | ... omitted 4 union elements]`, found `dict[str, object]`
- koda_validate/serialization/json_schema.py:386:22 error[unresolved-attribute] Object of type `object` has no attribute `decode`
meson (https://github.com/mesonbuild/meson)
- mesonbuild/cargo/manifest.py:766: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["path"]` on object of type `Top[dict[Unknown, Unknown]]`
- mesonbuild/compilers/d.py:503:29 error[invalid-argument-type] Argument to bound method `list.extend` is incorrect: Expected `Iterable[str]`, found `list[str] | (((CompileCheckMode, /) -> list[str]) & Top[list[Unknown]])`
- mesonbuild/interpreterbase/helpers.py:43: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:43:33 error[invalid-argument-type] Argument to function `resolver` is incorrect: Expected `Sequence[Divergent] | int | dict[str, Divergent] | ... omitted 5 union elements`, found `object`
mkdocs (https://github.com/mkdocs/mkdocs)
- mkdocs/config/config_options.py:139:39 error[no-matching-overload] No overload of bound method `MutableMapping.setdefault` matches arguments
- 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:846:42 error[no-matching-overload] No overload of function `join` matches arguments
- mkdocs/config/config_options.py:851:26 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]]`
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
- pymongo/asynchronous/collection.py:961:25 error[invalid-assignment] Cannot assign to a subscript on an object of type `_DocumentType@AsyncCollection`
- pymongo/helpers_shared.py:191:13 error[invalid-assignment] Invalid subscript assignment with key of type `str | tuple[str, int | str | Mapping[str, Any]]` and value of type `Unknown` on object of type `dict[str, Any]`
- pymongo/helpers_shared.py:158:20 error[invalid-return-type] Return type does not match returned value: expected `Sequence[tuple[str, int | str | Mapping[str, Any]]]`, found `list[str | tuple[object, object]]`
+ pymongo/helpers_shared.py:158:20 error[invalid-return-type] Return type does not match returned value: expected `Sequence[tuple[str, int | str | Mapping[str, Any]]]`, found `list[str | tuple[str, int | str | Mapping[str, Any]] | tuple[Unknown, Unknown]]`
- 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/server/astdiff.py:157:67 error[invalid-argument-type] Argument to function `compare_symbol_table_snapshots` is incorrect: Expected `dict[str, tuple[object, ...]]`, found `Top[dict[Unknown, Unknown]]`
openlibrary (https://github.com/internetarchive/openlibrary)
- openlibrary/plugins/upstream/utils.py:337:49 error[no-matching-overload] No overload of function `sorted` matches arguments
packaging (https://github.com/pypa/packaging)
- src/packaging/specifiers.py:890:25 error[unresolved-attribute] Object of type `object` has no attribute `get`
- src/packaging/specifiers.py:900:21 error[invalid-assignment] Object of type `tuple[object, ...]` is not assignable to attribute `_specs` of type `tuple[Specifier, ...]`
- src/packaging/tags.py:210:35 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- src/packaging/version.py:790:21 error[invalid-assignment] Object of type `object` is not assignable to attribute `_dev` of type `tuple[Literal["dev"], int] | None`
- src/packaging/version.py:798: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 `Literal["_epoch"]` on object of type `Top[dict[Unknown, Unknown]]`
- 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`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/ops/mask_ops.py:189:12 error[invalid-return-type] Return type does not match returned value: expected `tuple[ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]], ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]]]`, found `tuple[(NAType & ndarray[tuple[object, ...], dtype[object]]) | ndarray[tuple[Any, ...], dtype[Any]] | Unknown, Any | ndarray[tuple[Any, ...], dtype[Any]]]`
- pandas/core/common.py:467:38 error[invalid-argument-type] Argument to `RandomState.__init__` is incorrect: Expected `_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | integer[Any]]]] | int | ... omitted 3 union elements`, found `int | integer[Any] | ndarray[tuple[Any, ...], dtype[Any]] | ... omitted 3 union elements`
- pandas/core/construction.py:353:28 error[invalid-argument-type] Argument to bound method `MaskedArray.filled` is incorrect: Argument type `ExtensionArray & MaskedArray[tuple[object, ...], dtype[object]]` does not satisfy upper bound `MaskedArray[_ShapeT_co@MaskedArray, _DTypeT_co@MaskedArray]` of type variable `Self`
- pandas/core/dtypes/missing.py:254:18 error[invalid-assignment] Object of type `ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]] | Any` is not assignable to `ndarray[tuple[Any, ...], dtype[numpy.bool[builtins.bool]]] | NDFrame`
- pandas/core/indexes/multi.py:4804:49 error[invalid-argument-type] Argument to bound method `MultiIndex.from_tuples` is incorrect: Expected `Iterable[tuple[Hashable, ...]]`, found `(Unknown & ~Generator[object, None, None] & ~MultiIndex) | (list[object] & ~MultiIndex)`
+ pandas/core/internals/construction.py:800:24 error[invalid-return-type] Return type does not match returned value: expected `tuple[list[ExtensionArray | ndarray[tuple[Any, ...], dtype[Any]]], Index]`, found `tuple[list[Unknown & ndarray[tuple[Any, ...], Unknown]], Index]`
- pandas/core/nanops.py:1483:30 error[no-matching-overload] No overload of bound method `ndarray.astype` matches arguments
- pandas/core/reshape/concat.py:799:17 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[Mapping[Unknown, object]].__getitem__(key: Never, /) -> object` cannot be called with key of type `object` on object of type `Top[Mapping[Unknown, object]]`
- 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/excel/_base.py:867:57 error[invalid-argument-type] Method `__getitem__` of type `Overload[(i: SupportsIndex, /) -> Unknown, (s: slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> list[Unknown]]` cannot be called with key of type `object` on object of type `list[Unknown]`
- pandas/io/formats/format.py:571:22 error[invalid-assignment] Object of type `(Sequence[str | int] & Top[Mapping[Unknown, object]] & ~int & ~str) | (Mapping[Hashable, str | int] & ~int & ~str)` is not assignable to `Mapping[Hashable, str | int]`
- pandas/io/formats/printing.py:283:24 error[invalid-assignment] Object of type `list[object]` is not assignable to `Iterable[str] | None`
- pandas/io/parsers/c_parser_wrapper.py:392: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 `object` on object of type `Top[dict[Unknown, Unknown]]`
- pandas/io/pytables.py:5445:26 error[no-matching-overload] No overload of bound method `ndarray.reshape` matches arguments
- pandas/tests/extension/date/array.py:106:25 error[unresolved-attribute] Attribute `astype` is not defined on `date` in union `date | ndarray[tuple[Any, ...], dtype[Any]] | Any`
- pandas/util/_validators.py:378:33 error[invalid-argument-type] Argument to function `validate_bool_kwarg` is incorrect: Argument type `object` does not satisfy constraints (`bool`, `int`, `None`) of type variable `BoolishNoneT`
pandera (https://github.com/pandera-dev/pandera)
- pandera/decorators.py:401:20 error[invalid-return-type] Return type does not match returned value: expected `None`, found `(Any & ~tuple[object, ...]) | tuple[object, ...]`
+ pandera/decorators.py:401:20 error[invalid-return-type] Return type does not match returned value: expected `None`, found `(Any & ~tuple[object, ...]) | tuple[Unknown, ...]`
- pandera/engines/utils.py:82:47 error[invalid-argument-type] Argument to function `numpy_pandas_coercible` is incorrect: Expected `Series[Any]`, found `Series[Any] | DataFrame | Any`
+ pandera/engines/utils.py:82:47 error[invalid-argument-type] Argument to function `numpy_pandas_coercible` is incorrect: Expected `Series[Any]`, found `(Series[Any] & ~ndarray[tuple[object, ...], dtype[object]]) | DataFrame | Series[int | float] | Any`
pip (https://github.com/pypa/pip)
- src/pip/_vendor/packaging/specifiers.py:1461:21 error[invalid-assignment] Object of type `tuple[object, ...]` is not assignable to attribute `_specs` of type `tuple[Specifier, ...]`
- src/pip/_vendor/packaging/specifiers.py:1470:31 error[unresolved-attribute] Object of type `object` has no attribute `get`
- 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/requests/cookies.py:617:21 error[no-matching-overload] No overload of function `cookiejar_from_dict` matches arguments
- src/pip/_vendor/resolvelib/structs.py:206:12 error[invalid-return-type] Return type does not match returned value: expected `Iterable[CT@build_iter_view]`, found `_SequenceIterableView[RT@_SequenceIterableView]`
porcupine (https://github.com/Akuli/porcupine)
- porcupine/plugins/filetypes.py:33: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]]`
- porcupine/plugins/filetypes.py:33:70 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]]`
prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/blocks/system.py:68:20 error[invalid-return-type] Return type does not match returned value: expected `SecretStr | Secret[T@Secret]`, found `(T@Secret & Secret[object]) | SecretStr | Secret[T@Secret]`
- src/prefect/cli/events.py:198:9 error[invalid-argument-type] Argument is incorrect: Expected `list[RelatedResource]`, found `(list[Any & Top[dict[Unknown, Unknown]]] & ~AlwaysFalsy) | (Any & Top[list[Unknown]] & ~AlwaysFalsy) | list[RelatedResource]`
+ src/prefect/cli/events.py:198:9 error[invalid-argument-type] Argument is incorrect: Expected `list[RelatedResource]`, found `(list[Any & dict[Unknown, Unknown]] & ~AlwaysFalsy) | (Any & list[Unknown] & ~AlwaysFalsy) | list[RelatedResource]`
- src/prefect/logging/loggers.py:385:13 error[unresolved-attribute] Object of type `object` has no attribute `_log`
pwndbg (https://github.com/pwndbg/pwndbg)
- pwndbg/commands/ptmalloc2.py:445:64 error[unresolved-attribute] Object of type `~AlwaysFalsy` has no attribute `address`
- pwndbg/commands/ptmalloc2.py:451:15 error[unresolved-attribute] Object of type `~AlwaysFalsy` has no attribute `value_to_human_readable`
pydantic (https://github.com/pydantic/pydantic)
- pydantic/json_schema.py:1719:13 error[no-matching-overload] No overload of bound method `MutableMapping.update` matches arguments
- pydantic/v1/main.py:1128:52 error[invalid-argument-type] Argument to `ValidationError.__init__` is incorrect: Expected `Sequence[Sequence[Any] | ErrorWrapper]`, found `list[object] & ~AlwaysFalsy`
pyproject-metadata (https://github.com/pypa/pyproject-metadata)
- pyproject_metadata/pyproject.py:103:44 error[unresolved-attribute] Object of type `object` has no attribute `get`
schema_salad (https://github.com/common-workflow-language/schema_salad)
- src/schema_salad/python_codegen_support.py:647:13 error[invalid-argument-type] Argument to `LoadingOptions.__init__` is incorrect: Expected `str | None`, found `object`
- src/schema_salad/python_codegen_support.py:653:22 error[invalid-argument-type] Argument to bound method `MutableSequence.pop` is incorrect: Expected `int`, found `Literal["$namespaces"]`
- src/schema_salad/python_codegen_support.py:655:22 error[invalid-argument-type] Argument to bound method `MutableMapping.pop` is incorrect: Expected `Never`, found `Literal["$schemas"]`
- 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:811: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["values"]` on object of type `Top[dict[Unknown, Unknown]]`
- src/schema_salad/jsonld_context.py:211:17 error[invalid-assignment] Cannot assign to a subscript on an object of type `int`
- src/schema_salad/jsonld_context.py:211:17 error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- src/schema_salad/jsonld_context.py:216:28 error[invalid-argument-type] Argument to function `fix_jsonld_ids` is incorrect: Expected `CommentedMap | int | float | str | CommentedSeq`, found `object`
- src/schema_salad/jsonld_context.py:229:19 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["@id"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/jsonld_context.py:252:9 error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- src/schema_salad/main.py:474:31 error[invalid-argument-type] Argument to function `printrdf` is incorrect: Expected `CommentedMap | CommentedSeq`, found `(int & Top[Mapping[Unknown, object]]) | (float & Top[Mapping[Unknown, object]]) | (str & Top[Mapping[Unknown, object]]) | ... omitted 6 union elements`
+ src/schema_salad/main.py:474:31 error[invalid-argument-type] Argument to function `printrdf` is incorrect: Expected `CommentedMap | CommentedSeq`, found `(int & Mapping[Unknown, Unknown]) | (float & Mapping[Unknown, Unknown]) | (str & Mapping[Unknown, Unknown]) | ... omitted 6 union elements`
- src/schema_salad/metaschema.py:679:22 error[invalid-argument-type] Argument to bound method `MutableMapping.pop` is incorrect: Expected `Never`, found `Literal["$base"]`
- src/schema_salad/ref_resolver.py:1135:61 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `str` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/ref_resolver.py:1135:61 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `str` on object of type `str`
- src/schema_salad/ref_resolver.py:1164:41 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `str` on object of type `str`
- src/schema_salad/ref_resolver.py:1177:21 error[invalid-argument-type] Argument to bound method `Loader.validate_links` is incorrect: Expected `int | float | str | ... omitted 3 union elements`, found `object`
- src/schema_salad/schema.py:271:57 error[invalid-argument-type] Argument to function `salad_to_jsonld_context` is incorrect: Expected `Iterable[MutableMapping[str, Any]]`, found `(int & Top[MutableSequence[Unknown]]) | (float & Top[MutableSequence[Unknown]]) | (str & Top[MutableSequence[Unknown]]) | (CommentedMap & Top[MutableSequence[Unknown]]) | CommentedSeq`
- src/schema_salad/schema.py:541:48 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:543:17 error[invalid-assignment] Invalid subscript assignment with key of type `Literal["name"]` and value of type `str` on object of type `MutableSequence[Any]`
- src/schema_salad/schema.py:545:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:558:20 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:558:20 error[invalid-argument-type] Method `__getitem__` of type `bound method str.__getitem__(key: SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None], /) -> str` cannot be called with key of type `Literal["name"]` on object of type `str`
- src/schema_salad/schema.py:559:38 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["name"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:564:21 error[invalid-argument-type] Method `__getitem__` of type `Overload[(index: int, /) -> Any, (index: slice[int | None, int | None, int | None], /) -> MutableSequence[Any]]` cannot be called with key of type `Literal["names"]` on object of type `MutableSequence[Any]`
- src/schema_salad/schema.py:564:21 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["type"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:564:21 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[MutableMapping[Unknown, Unknown]].__getitem__(key: Never, /) -> object` cannot be called with key of type `Literal["values"]` on object of type `Top[MutableMapping[Unknown, Unknown]]`
- src/schema_salad/schema.py:572:13 error[invalid-assignment] Cannot assign to a subscript on an object of type `str`
- src/schema_salad/schema.py:412:48 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/core/output/sanitization.py:31:31 error[invalid-argument-type] Method `__getitem__` of type `bound method Top[CaseInsensitiveDict[Unknown]].__getitem__(key: str) -> object` cannot be called with key of type `object` on object of type `Top[CaseInsensitiveDict[Unknown]]`
- src/schemathesis/core/output/sanitization.py:34:21 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `str` on object of type `Top[dict[Unknown, Unknown]]`
- src/schemathesis/specs/openapi/_hypothesis.py:1003:24 error[invalid-argument-type] Argument to function `_snap_float32_node` is incorrect: Expected `dict[str, Any]`, found `Top[dict[Unknown, Unknown]]`
- src/schemathesis/transport/requests.py:386: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 `str` on object of type `Top[dict[Unknown, Unknown]]`
scikit-build-core (https://github.com/scikit-build/scikit-build-core)
- src/scikit_build_core/_vendor/pyproject_metadata/project_table.py:276:16 error[no-matching-overload] No overload of bound method `Pattern.fullmatch` matches arguments
- src/scikit_build_core/_vendor/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]]`
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- sklearn/manifold/_spectral_embedding.py:421:9 error[unsupported-operator] Operator `-=` is not supported between objects of type `csr_matrix[Never]` and `dia_array[float64] | Unknown`
+ sklearn/manifold/_spectral_embedding.py:421:9 error[unsupported-operator] Operator `-=` is not supported between objects of type `csr_matrix[(Unknown & Top[number[Any, int | float | complex]]) | (Unknown & numpy.bool[builtins.bool])]` and `dia_array[float64] | Unknown`
- sklearn/metrics/tests/test_pairwise.py:769:21 error[no-matching-overload] No overload of function `vstack` matches arguments
- sklearn/preprocessing/_polynomial.py:448:37 error[invalid-argument-type] Argument to function `max` is incorrect: Expected `Literal[2]`, found `object`
scipy (https://github.com/scipy/scipy)
- subprojects/highs/highs/highspy/highs.py:663:58 error[invalid-assignment] Object of type `(Any & Top[Mapping[Unknown, object]] & ~float & ~int) | (Mapping[Any, Any] & ~float & ~int) | (Sequence[Any] & Top[Mapping[Unknown, object]] & ~float & ~int)` is not assignable to `Mapping[Any, int | float]`
- subprojects/highs/highs/highspy/highs.py:1135:29 error[unresolved-attribute] Unresolved attribute `index` on type `object`
- subprojects/highs/highs/highspy/highs.py:1164:35 error[invalid-argument-type] Argument to constructor `map.__new__` is incorrect: Expected `(object, /) -> int`, found `<class 'int'>`
scrapy (https://github.com/scrapy/scrapy)
- scrapy/utils/datatypes.py:89:31 error[invalid-argument-type] Argument to bound method `CaselessDict.normkey` is incorrect: Argument type `str | int | AnyStr@update` does not satisfy constraints (`str`, `bytes`) of type variable `AnyStr`
+ scrapy/utils/datatypes.py:89:31 error[invalid-argument-type] Argument to bound method `CaselessDict.normkey` is incorrect: Argument type `Unknown | AnyStr@update` does not satisfy constraints (`str`, `bytes`) of type variable `AnyStr`
spark (https://github.com/apache/spark)
- python/pyspark/ml/linalg/__init__.py:469:16 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `int` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- python/pyspark/ml/linalg/__init__.py:469:16 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `slice[Any, Any, Any]` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- python/pyspark/ml/linalg/__init__.py:703:27 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `ndarray[tuple[Any, ...], dtype[Unknown]]` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- python/pyspark/ml/linalg/__init__.py:759:25 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `Unknown` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- python/pyspark/mllib/linalg/__init__.py:809:27 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `ndarray[tuple[Any, ...], dtype[Unknown]]` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- python/pyspark/pandas/generic.py:487:28 error[invalid-assignment] Object of type `object` is not assignable to `(...) -> Any`
- python/pyspark/sql/connect/expressions.py:511:22 error[not-iterable] Object of type `(Any & Top[list[Unknown]]) | (Any & Decimal) | (Any & bytes) | ... omitted 4 union elements` may not be iterable
+ python/pyspark/sql/connect/expressions.py:511:22 error[not-iterable] Object of type `(Any & list[Unknown]) | (Any & Decimal) | (Any & bytes) | ... omitted 4 union elements` may not be iterable
- python/pyspark/sql/connect/expressions.py:527:42 error[invalid-argument-type] Argument to bound method `DateType.fromInternal` is incorrect: Expected `int`, found `(Any & Top[list[Unknown]]) | (Any & Decimal) | (Any & bytes) | ... omitted 4 union elements`
+ python/pyspark/sql/connect/expressions.py:527:42 error[invalid-argument-type] Argument to bound method `DateType.fromInternal` is incorrect: Expected `int`, found `(Any & list[Unknown]) | (Any & Decimal) | (Any & bytes) | ... omitted 4 union elements`
- python/pyspark/sql/connect/plan.py:1035:14 error[call-non-callable] Object of type `Column` is not callable
- python/pyspark/sql/pandas/conversion.py:989:32 error[invalid-argument-type] Argument to bound method `StructType.add` is incorrect: Expected `str`, found `object`
+ python/pyspark/sql/pandas/conversion.py:989:32 error[invalid-argument-type] Argument to bound method `StructType.add` is incorrect: Expected `str`, found `Unknown | str | StructField`
- python/pyspark/testing/utils.py:1036:45 error[invalid-argument-type] Argument to function `rename_dataframe_columns` is incorrect: Expected `pyspark.sql.dataframe.DataFrame`, found `pyspark.sql.dataframe.DataFrame | (pandas.core.frame.DataFrame & Top[list[Unknown]]) | (pyspark.pandas.frame.DataFrame[Unknown] & Top[list[Unknown]]) | list[Row] | Unknown`
+ python/pyspark/testing/utils.py:1036:45 error[invalid-argument-type] Argument to function `rename_dataframe_columns` is incorrect: Expected `pyspark.sql.dataframe.DataFrame`, found `pyspark.sql.dataframe.DataFrame | (pandas.core.frame.DataFrame & list[Unknown]) | (pyspark.pandas.frame.DataFrame[Unknown] & list[Unknown]) | list[Row] | Unknown`
- python/pyspark/testing/utils.py:1054:43 error[invalid-argument-type] Argument to function `cast_columns_to_string` is incorrect: Expected `pyspark.sql.dataframe.DataFrame`, found `pyspark.sql.dataframe.DataFrame | (pandas.core.frame.DataFrame & Top[list[Unknown]]) | (pyspark.pandas.frame.DataFrame[Unknown] & Top[list[Unknown]]) | list[Row] | Unknown`
+ python/pyspark/testing/utils.py:1054:43 error[invalid-argument-type] Argument to function `cast_columns_to_string` is incorrect: Expected `pyspark.sql.dataframe.DataFrame`, found `pyspark.sql.dataframe.DataFrame | (pandas.core.frame.DataFrame & list[Unknown]) | (pyspark.pandas.frame.DataFrame[Unknown] & list[Unknown]) | list[Row] | Unknown`
static-frame (https://github.com/static-frame/static-frame)
- static_frame/core/type_blocks.py:3291:35 error[invalid-argument-type] Argument to bound method `TypeBlocks._drop_blocks` is incorrect: Expected `int | integer[Any] | ndarray[Any, Any] | ... omitted 3 union elements`, found `object`
- static_frame/core/type_blocks.py:3595:24 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- static_frame/core/util.py:467:16 error[invalid-return-type] Return type does not match returned value: expected `int | list[int]`, found `list[int] | (ndarray[Any, dtype[signedinteger[_64Bit]]] & Top[list[Unknown]])`
- static_frame/test/unit/test_index.py:889:26 error[no-matching-overload] No overload of bound method `ndarray.tolist` matches arguments
- static_frame/test/unit/test_index.py:902:26 error[no-matching-overload] No overload of bound method `ndarray.tolist` matches arguments
strawberry (https://github.com/strawberry-graphql/strawberry)
- strawberry/http/sync_base_view.py:270:41 error[unresolved-attribute] Object of type `object` has no attribute `errors`
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/elements/widgets/time_widgets.py:655:70 warning[unused-ignore-comment] Unused `ty: ignore` directive
sympy (https://github.com/sympy/sympy)
- sympy/physics/quantum/operatorset.py:118:34 error[invalid-argument-type] Method `__getitem__` of type `bound method dict[frozenset[<class 'J2Op'> | <class 'JxOp'>] | frozenset[<class 'J2Op'> | <class 'JyOp'>] | frozenset[<class 'J2Op'> | <class 'JzOp'>] | ... omitted 4 union elements, <class 'JxKet'> | <class 'JyKet'> | <class 'JzKet'> | ... omitted 4 union elements].__getitem__(key: frozenset[<class 'J2Op'> | <class 'JxOp'>] | frozenset[<class 'J2Op'> | <class 'JyOp'>] | frozenset[<class 'J2Op'> | <class 'JzOp'>] | ... omitted 4 union elements, /) -> <class 'JxKet'> | <class 'JyKet'> | <class 'JzKet'> | ... omitted 4 union elements` cannot be called with key of type `frozenset[object]` on object of type `dict[frozenset[<class 'J2Op'> | <class 'JxOp'>] | frozenset[<class 'J2Op'> | <class 'JyOp'>] | frozenset[<class 'J2Op'> | <class 'JzOp'>] | ... omitted 4 union elements, <class 'JxKet'> | <class 'JyKet'> | <class 'JzKet'> | ... omitted 4 union elements]`
- sympy/printing/pretty/pretty_symbology.py:357:19 error[index-out-of-bounds] Index 3 is out of bounds for tuple `tuple[tuple[Unknown, Unknown, Unknown], str]` with length 2
- sympy/polys/domains/polynomialring.py:72:16 error[invalid-return-type] Return type does not match returned value: expected `PolyElement[Er@PolynomialRing]`, found `PolyElement[Er@PolynomialRing] | PolyElement[Er@PolyRing]`
+ sympy/polys/domains/polynomialring.py:72:16 error[invalid-return-type] Return type does not match returned value: expected `PolyElement[Er@PolynomialRing]`, found `(Er@PolynomialRing & PolyElement[Unknown]) | PolyElement[Er@PolynomialRing] | PolyElement[Er@PolyRing]`
- sympy/polys/domains/polynomialring.py:103:16 error[invalid-return-type] Return type does not match returned value: expected `PolyElement[Er@PolynomialRing]`, found `PolyElement[Er@PolynomialRing] | PolyElement[Er@PolyRing]`
+ sympy/polys/domains/polynomialring.py:103:16 error[invalid-return-type] Return type does not match returned value: expected `PolyElement[Er@PolynomialRing]`, found `PolyElement[Unknown] | PolyElement[Er@PolynomialRing] | PolyElement[Er@PolyRing]`
- sympy/polys/rings.py:1173:50 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- sympy/solvers/solveset.py:3167:15 error[no-matching-overload] No overload of bound method `Set.subs` matches arguments
- sympy/utilities/misc.py:465:24 error[invalid-argument-type] Argument to function `len` is incorrect: Expected `Sized`, found `object`
tornado (https://github.com/tornadoweb/tornado)
- tornado/gen.py:530:40 error[unresolved-attribute] Object of type `_S@map` has no attribute `result`
urllib3 (https://github.com/urllib3/urllib3)
- src/urllib3/_collections.py:359:31 error[not-iterable] Object of type `object` is not iterable
vision (https://github.com/pytorch/vision)
- torchvision/transforms/v2/_utils.py:69:13 error[invalid-assignment] Invalid subscript assignment with key of type `object` and value of type `list[int | float] | None` on object of type `dict[type | str, int | float | Sequence[int | float] | None]`
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/datastructures/headers.py:519:51 error[invalid-argument-type] Argument to bound method `Headers.getlist` is incorrect: Expected `str`, found `object`
- src/werkzeug/test.py:167:20 error[invalid-yield] Yield type `tuple[object, object]` does not match annotated yield type `tuple[str, Any]`
xarray (https://github.com/pydata/xarray)
- xarray/backends/common.py:197:51 error[invalid-argument-type] Argument to function `_normalize_path_list` is incorrect: Expected `NestedSequence[str | PathLike[Unknown] | ReadBuffer[Unknown]]`, found `(ReadBuffer[Unknown] & Top[list[Unknown]] & ~PathLike[object]) | (NestedSequence[str | PathLike[Unknown] | ReadBuffer[Unknown]] & Top[list[Unknown]] & ~PathLike[object])`
- xarray/core/common.py:1702:22 error[invalid-assignment] Object of type `(type[Any] & Top[Mapping[Unknown, object]]) | (str & Top[Mapping[Unknown, object]]) | (tuple[Any, SupportsIndex | Sequence[SupportsIndex]] & Top[Mapping[Unknown, object]]) | ... omitted 5 union elements` is not assignable to `Mapping[Any, dtype[Any] | None | type[Any] | ... omitted 6 union elements]`
- xarray/core/indexes.py:1007:29 error[unresolved-attribute] Object of type `Index[Any] & Top[CategoricalIndex[Any]]` has no attribute `remove_unused_categories`
+ xarray/core/indexes.py:1007:29 error[unresolved-attribute] Object of type `CategoricalIndex[Unknown]` has no attribute `remove_unused_categories`
- xarray/core/indexing.py:411:19 error[invalid-argument-type] Method `__getitem__` of type `Overload[(key: ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]] | tuple[ndarray[tuple[Any, ...], dtype[integer[Any] | numpy.bool[builtins.bool]]], ...], /) -> ndarray[tuple[Any, ...], dtype[object]], (key: SupportsIndex | tuple[SupportsIndex, ...], /) -> Any, (key: SupportsIndex | slice[Any, Any, Any] | EllipsisType | ... omitted 5 union elements, /) -> ndarray[tuple[Any, ...], dtype[object]]]` cannot be called with key of type `integer[Any]` on object of type `ndarray[tuple[object, ...], dtype[object]]`
- xarray/core/utils.py:356:35 error[invalid-argument-type] Argument to function `flat_items` is incorrect: Expected `Mapping[str, dict[str, Divergent] | Unknown]`, found `dict[str, Divergent] | (T@flat_items & Top[dict[Unknown, Unknown]])`
zulip (https://github.com/zulip/zulip)
- scripts/lib/supervisor.py:52:42 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- zerver/lib/event_schema.py:409:29 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- zerver/lib/event_schema.py:464:38 error[not-subscriptable] Cannot subscript object of type `object` with no `__getitem__` method
- zerver/lib/push_notifications.py:607: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["android_devices"]` on object of type `Top[dict[Unknown, Unknown]]`
- zerver/lib/validator.py:274: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 `object` on object of type `Top[dict[Unknown, Unknown]]`40c75ba to
1c0b597
Compare
isinstance narrowing (2)isinstance narrowing
1c0b597 to
7b8d150
Compare
| python_version: SupportedPythonVersion::Py311, | ||
| }, | ||
| 3, | ||
| 7, |
There was a problem hiding this comment.
The four new diagnostics here are due to unused ty: ignore suppression comments 🙃
| from typing import Any | ||
| from ty_extensions import Top | ||
|
|
||
| def f(xyxy: Top[list[Any]]): |
There was a problem hiding this comment.
I changed this to an explicit Top[...] annotation because that snippet does not create a Top materialization anymore.
|
|
||
| if isinstance(x, list): | ||
| reveal_type(x) # revealed: Sequence[int] & Top[list[Unknown]] | ||
| reveal_type(x) # revealed: Sequence[int] & list[Unknown] |
There was a problem hiding this comment.
It's plausible that we could simplify Sequence[int] & list[Unknown] to list[int], which would restore the type for x below (tracked in astral-sh/ty#1824).
isinstance narrowingisinstance/issubclass narrowing
0ac407b to
e36f2c9
Compare
|
|
||
| def _(xs: Item | list[Item]): | ||
| if isinstance(xs, list): | ||
| reveal_type(xs) # revealed: list[Item] |
There was a problem hiding this comment.
Here, we make use of the previously implemented simplification list[Item] & list[Unknown] = list[Item]
Though that section is about achieving the same strictness as mypy/pyright |
|
e36f2c9 to
5363a4c
Compare
|
(I haven't read the code yet) How does this intersect with astral-sh/ty#1130? E.g., would #25851 still be relevant? Separately, for this and for changes like #26414 and #26415, I think we should uniformly use a prefix like |
I think the change here is orthogonal to the
Yes, I think it still makes sense to intersect with the union of
You'd like to have that as a prefix for the configuration setting's name itself? Something like this: unsound-generic-narrowing = true # the default
unsound-generic-narrowing = falseI understand the intention and I agree that it seems like a good idea to group these somehow. It seems slightly unfortunate that users who WANT the strict behavior would then have to put a setting with the name "unsound" in their config file (if only to turn it off), while users with the default (unsound) behavior would have a "clean" config. Or did you intend for this to be a prefix for the configuration value, like this? generic-narrowing = "unsound-relaxed" # the default (or maybe just "unsound"?)
generic-narrowing = "strict"This way, users with the strict behavior would only have to add |
|
A couple high-level comments before I get into a more detailed review:
def f(x: Sequence[int]):
x[0].upper() # error
if isinstance(x, Sequence):
x[0].upper() # no error with the new defaultI don't think there is any justification for losing the precision of the original type, just because we've (redundantly) checked it with Ultimately I think this reveals the conceptual weakness of this approach (and the strength of the "special treatment of materialized object/Never" approach), which is that fundamentally narrowing via an |
Summary
This PR introduces a new
ty.analysis.generic-narrowingoption that controls howisinstanceandissubclassnarrowing works for unspecialized generic classes. When this option is set tostrict, we use the top materialization of the generic class (e.g.Top[list[Unknown]]). This is the current behavior onmain. However, when the option is set torelaxed(the new default), we intersect withlist[Unknown]directly, leading to a more gradual behavior (see example below). The idea here is to help users migrate from other type checkers. If they want to use a stricter type checking behavior, they can then switch togeneric-narrowing = "strict"later.strict(current behavior onmain)relaxed(new default behavior)One important detail here is how this new
relaxednarrowing behavior works in the negative case (inelsebranches, or when usingnot isinstance(...)). I previously tried to simply intersect with~list[Unknown], but this generally leads to leftover gradual types since we're not excluding all lists. A previous experiment shows that this leads to ~900 new diagnostics, even after implementing some gradual intersection simplifications. So here, we simply intersect with~Top[list[Unknown]]in the negative case, which reflects what the runtime does: it excludes alllistinstances. The only downside is that this breaks symmetry: the narrowed type in theifbranch and the narrowed type in theelsebranch don't recombine to the original type. I haven't seen any practical consequences of this though.Another alternative that I considered was to introduce special marked
object*/Never*types. This had a similar ecosystem impact, but the implementation is more complex. It also doesn't seem very principled and introduces two new fundamental types that can interact with the rest of the type system in many different ways. Maybe most importantly, I think this would be harder to teach to users. They would have to understand not just what a top-materialization is, but also that these give rise to newobjectandNevervariants that behave in complex ways that are not clear from their naming. The approach followed in this PR, by contrast, relies on our core concepts (set theoretic gradual types). In the new "relaxed" mode implemented here, users will also see a lot fewerTop[..]types. One advantage of theobject*approach is that it doesn't always "propagate" the gradual nature of the check. For example, when narrowingItem | Sequence[Item]viaisinstance(..., Sequence), it yieldsSequence[Item] & Sequence[object*] = Sequence[Item], instead of the permissiveSequence[Item & Unknown]that we get on this branch.In a follow-up to this PR, I will make a similar change to
TypeIsnarrowing.closes astral-sh/ty#3476
closes astral-sh/ty#3676
closes astral-sh/ty#3477
closes astral-sh/ty#3375
Post-merge TODO
if isinstance(..., Callable)should also follow this approach.Test plan
Ecosystem
1824 removed diagnostics. Most of the 32 newly added diagnostics are
unused-(type-)ignore-comment.