[ty] Add support for typing.Concatenate#23689
Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 85.31% to 85.93%. The percentage of expected errors that received a diagnostic increased from 78.79% to 80.02%. The number of fully passing files improved from 65/133 to 66/133. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
Test file breakdown6 files altered
True positives added (13)13 diagnostics
False positives removed (5)5 diagnostics
True positives changed (1)1 diagnostic
|
|
Memory usage reportMemory usage unchanged ✅ |
82a55c6 to
54c635c
Compare
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
163 | 136 | 10 |
unresolved-attribute |
5 | 1 | 80 |
missing-argument |
50 | 33 | 0 |
invalid-return-type |
47 | 2 | 6 |
invalid-method-override |
0 | 52 | 0 |
invalid-await |
40 | 0 | 0 |
type-assertion-failure |
2 | 24 | 11 |
no-matching-overload |
22 | 11 | 0 |
invalid-context-manager |
0 | 0 | 32 |
invalid-type-arguments |
0 | 24 | 0 |
invalid-assignment |
2 | 8 | 11 |
unused-type-ignore-comment |
1 | 12 | 0 |
unused-ignore-comment |
5 | 0 | 0 |
too-many-positional-arguments |
4 | 0 | 0 |
invalid-type-form |
0 | 1 | 0 |
not-iterable |
1 | 0 | 0 |
redundant-cast |
1 | 0 | 0 |
unbound-type-variable |
0 | 1 | 0 |
| Total | 343 | 305 | 150 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
Showing a random sample of 199 of 648 changes. See the HTML report for the full diff.
Raw diff sample (199 of 648 changes)
CPython (peg_generator) (https://github.com/python/cpython)
- Tools/peg_generator/pegen/validator.py:66:9 error[invalid-method-override] Invalid override of method `visit`: Definition is incompatible with `GrammarVisitor.visit`
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/map.py:391:1 error[invalid-argument-type] Argument is incorrect: Expected `(Never, /, *args: Unknown, **kwargs: Unknown) -> Never`, found `def filter[_Key, _Value](table: Map[_Key, _Value], predicate: (_Key, _Value, /) -> bool) -> Map[_Key, _Value]`
+ expression/collections/seq.py:93:38 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Self@filter`
+ expression/collections/seq.py:846:1 error[invalid-argument-type] Argument is incorrect: Expected `[_TSource](Never, /, count: int) -> Never`, found `def skip[_TSource](source: Iterable[_TSource], count: int) -> Iterable[_TSource]`
+ expression/core/result.py:432:1 error[invalid-argument-type] Argument is incorrect: Expected `(Never, /, *args: Unknown, **kwargs: Unknown) -> Never`, found `def filter[_TSource, _TError](result: Result[_TSource, _TError], predicate: (_TSource, /) -> bool, default: _TError) -> Result[_TSource, _TError]`
+ expression/extra/parser.py:57:39 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Parser[Any]`
+ expression/extra/parser.py:60:24 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Self@or_else`
+ expression/extra/parser.py:86:28 error[invalid-argument-type] Argument is incorrect: Expected `(_B'return@curry & Parser[Any]) | (_A'return@curry & Parser[Any])`, found `Parser[Any]`
+ expression/extra/parser.py:145:1 error[invalid-argument-type] Argument is incorrect: Expected `(Never, /, *args: Unknown, **kwargs: Unknown) -> Never`, found `def or_else[_A](p1: Parser[_A], p2: Parser[_A]) -> Parser[_A]`
+ expression/extra/parser.py:491:21 error[invalid-argument-type] Argument is incorrect: Expected `Never`, found `Parser[Any]`
+ tests/test_block.py:300:23 error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Block[int], /) -> Unknown`, found `(Never, /) -> Never`
+ tests/test_seq.py:229:23 error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Seq[int], /) -> Unknown`, found `(Never, /) -> Never`
+ tests/test_seq.py:239:23 error[invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Seq[int], /) -> Unknown`, found `(Never, /) -> Never`
Tanjun (https://github.com/FasterSpeeding/Tanjun)
+ tanjun/_internal/__init__.py:83:16 error[invalid-return-type] Return type does not match returned value: expected `bool`, found `Literal[True] | (Coroutine[Any, Any, bool] & ~AlwaysFalsy)`
- tanjun/checks.py:1051:23 error[invalid-type-arguments] Type `TypeVar` is not assignable to upper bound `Context` of type variable `_ContextT@_AllChecks`
+ tanjun/clients.py:1893:28 error[invalid-argument-type] Argument to bound method `add_check` is incorrect: Expected `(Context, /, *args: Any, **kwargs: Any) -> Coroutine[Any, Any, bool] | bool`, found `(def _check_human(ctx: Context, /) -> bool) & ~((Context, /, *args: Any, **kwargs: Any) -> Coroutine[Any, Any, bool] | bool)`
+ tanjun/clients.py:2294:27 error[not-iterable] Object of type `Iterable[str] | Coroutine[Any, Any, Iterable[str]]` may not be iterable
+ tanjun/parsing.py:1553:37 error[invalid-argument-type] Argument to bound method `_add_converter` is incorrect: Expected `(str, /, *args: Any, **kwargs: Any) -> Coroutine[Any, Any, Any] | Any`, found `object`
altair (https://github.com/vega/altair)
- tests/test_jupyter_chart.py:78:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:78:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:211:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:211:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1601:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1601:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1609:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1609:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_data.py:15:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_data.py:15:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:52:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:52:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:72:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:72:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:210:10 error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:210:10 error[invalid-context-manager] Object of type `PluginEnabler[(dict[Any, Any] | NativeDataFrame | narwhals.stable.v1.typing.DataFrameLike | ... omitted 3 union elements, /, *args: Unknown, **kwargs: Unknown) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
antidote (https://github.com/Finistere/antidote)
- tests/lib/lazy/test_lazy.py:458:35 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- tests/lib/lazy/test_lazy.py:835:27 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
apprise (https://github.com/caronc/apprise)
- tests/test_apprise_cli.py:1701:13 error[invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
- tests/test_apprise_cli.py:1724:13 error[invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
- tests/test_apprise_cli.py:1761:13 error[invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
- tests/test_apprise_cli.py:1804:13 error[invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
- tests/test_apprise_config.py:261:13 error[invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
artigraph (https://github.com/artigraph/artigraph)
- src/arti/internal/utils.py:28:24 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(...) -> Unknown`, found `property`
+ src/arti/internal/utils.py:28:24 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(type[Unknown], /, *args: Unknown, **kwargs: Unknown) -> Unknown`, found `property`
colour (https://github.com/colour-science/colour)
- colour/algebra/extrapolation.py:157:52 error[invalid-assignment] Object of type `NullInterpolator` is not assignable to `ProtocolInterpolator`: Incompatible value of type `NullInterpolator`
- colour/algebra/tests/test_extrapolation.py:59:13 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ProtocolInterpolator | None`, found `LinearInterpolator`
- colour/algebra/tests/test_extrapolation.py:99:13 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ProtocolInterpolator | None`, found `LinearInterpolator`
- colour/algebra/tests/test_extrapolation.py:127:13 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ProtocolInterpolator | None`, found `LinearInterpolator`
- colour/algebra/tests/test_extrapolation.py:135:13 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ProtocolInterpolator | None`, found `LinearInterpolator`
core (https://github.com/home-assistant/core)
+ homeassistant/components/androidtv/entity.py:67:41 error[invalid-argument-type] Argument is incorrect: Expected `_P@_adb_decorator.args`, found `_P@_adb_exception_catcher.args`
- homeassistant/components/androidtv/entity.py:110:16 error[invalid-return-type] Return type does not match returned value: expected `_ReturnFuncType[_ADBDeviceT@adb_decorator, _P@adb_decorator, _R@_adb_decorator]`, found `_Wrapped[(...), Awaitable[_R@_adb_decorator], (self: _ADBDeviceT@adb_decorator, *args: _P@adb_decorator.args, **kwargs: _P@adb_decorator.kwargs), CoroutineType[Any, Any, _R@_adb_exception_catcher | None]]`
+ homeassistant/components/androidtv/entity.py:110:16 error[invalid-return-type] Return type does not match returned value: expected `_ReturnFuncType[_ADBDeviceT@_adb_decorator, _P@_adb_decorator, _R@_adb_decorator]`, found `_Wrapped[(_ADBDeviceT@_adb_decorator, /, *args: _P@_adb_decorator.args, **kwargs: _P@_adb_decorator.kwargs), Awaitable[_R@_adb_decorator], (self: _ADBDeviceT@_adb_exception_catcher, *args: _P@_adb_exception_catcher.args, **kwargs: _P@_adb_exception_catcher.kwargs), CoroutineType[Any, Any, _R@_adb_exception_catcher | None]]`
- homeassistant/components/azure_storage/backup.py:96:53 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
+ homeassistant/components/azure_storage/backup.py:96:53 error[unresolved-attribute] Object of type `(AzureStorageBackupAgent, /, *args: P@handle_backup_errors.args, **kwargs: P@handle_backup_errors.kwargs) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
- homeassistant/components/denonavr/media_player.py:200:17 error[unresolved-attribute] Object of type `(...) -> Awaitable[_R@async_log_errors]` has no attribute `__name__`
+ homeassistant/components/denonavr/media_player.py:200:17 error[unresolved-attribute] Object of type `(_DenonDeviceT@async_log_errors, /, *args: _P@async_log_errors.args, **kwargs: _P@async_log_errors.kwargs) -> Awaitable[_R@async_log_errors]` has no attribute `__name__`
- homeassistant/components/dropbox/backup.py:55:30 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
+ homeassistant/components/dropbox/backup.py:55:30 error[unresolved-attribute] Object of type `(DropboxBackupAgent, /, *args: P@handle_backup_errors.args, **kwargs: P@handle_backup_errors.kwargs) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
+ homeassistant/components/hassio/addon_manager.py:58:43 error[invalid-argument-type] Argument is incorrect: Expected `_AddonManagerT@handle_hassio_api_error`, found `_AddonManagerT@wrapper`
+ homeassistant/components/hassio/addon_manager.py:68:12 error[invalid-return-type] Return type does not match returned value: expected `[_AddonManagerT'return, **_P'return, _R'return]((_AddonManagerT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Awaitable[_R'return], /) -> ((_AddonManagerT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Coroutine[Any, Any, _R'return])`, found `def handle_hassio_api_error(func: _FuncType[_AddonManagerT@handle_hassio_api_error, _P@handle_hassio_api_error, _R@handle_hassio_api_error]) -> _ReturnFuncType[_AddonManagerT@handle_hassio_api_error, _P@handle_hassio_api_error, _R@handle_hassio_api_error]`
- homeassistant/components/homematicip_cloud/helpers.py:49:49 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Any]` has no attribute `__name__`
+ homeassistant/components/homematicip_cloud/helpers.py:49:49 error[unresolved-attribute] Object of type `(_HomematicipGenericEntityT@handle_errors, /, *args: _P@handle_errors.args, **kwargs: _P@handle_errors.kwargs) -> Coroutine[Any, Any, Any]` has no attribute `__name__`
- homeassistant/components/izone/climate.py:132:16 error[invalid-return-type] Return type does not match returned value: expected `_FuncType[_DeviceT@_return_on_connection_error, _P@_return_on_connection_error, _R@wrap | _T@_return_on_connection_error]`, found `def wrapped_f(self: _DeviceT@_return_on_connection_error, *args: _P@_return_on_connection_error.args, **kwargs: _P@_return_on_connection_error.kwargs) -> _R@wrapped_f | _T@_return_on_connection_error`
+ homeassistant/components/izone/climate.py:132:16 error[invalid-return-type] Return type does not match returned value: expected `_FuncType[_DeviceT@wrap, _P@wrap, _R@wrap | _T@_return_on_connection_error]`, found `def wrapped_f(self: _DeviceT@wrapped_f, *args: _P@wrapped_f.args, **kwargs: _P@wrapped_f.kwargs) -> _R@wrapped_f | _T@_return_on_connection_error`
+ homeassistant/components/limitlessled/light.py:205:55 error[invalid-argument-type] Argument is incorrect: Expected `[email protected]`, found `[email protected]`
+ homeassistant/components/limitlessled/light.py:211:16 error[invalid-return-type] Return type does not match returned value: expected `(_LimitlessLEDGroupT@decorator, /, *args: [email protected], **kwargs: [email protected]) -> None`, found `def wrapper(self: _LimitlessLEDGroupT@wrapper, *args: [email protected], **kwargs: [email protected]) -> None`
+ homeassistant/components/limitlessled/light.py:213:12 error[invalid-return-type] Return type does not match returned value: expected `[_LimitlessLEDGroupT'return, **_P'return]((_LimitlessLEDGroupT'return, int, Unknown, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Any, /) -> ((_LimitlessLEDGroupT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> None)`, found `def decorator(function: (_LimitlessLEDGroupT@decorator, int, Unknown, /, *args: [email protected], **kwargs: [email protected]) -> Any) -> ((_LimitlessLEDGroupT@decorator, /, *args: [email protected], **kwargs: [email protected]) -> None)`
- homeassistant/components/onedrive/backup.py:98:17 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
+ homeassistant/components/onedrive/backup.py:98:17 error[unresolved-attribute] Object of type `(OneDriveBackupAgent, /, *args: P@handle_backup_errors.args, **kwargs: P@handle_backup_errors.kwargs) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
- homeassistant/components/onedrive_for_business/backup.py:90:17 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
+ homeassistant/components/onedrive_for_business/backup.py:90:17 error[unresolved-attribute] Object of type `(OneDriveBackupAgent, /, *args: P@handle_backup_errors.args, **kwargs: P@handle_backup_errors.kwargs) -> Coroutine[Any, Any, _R@handle_backup_errors]` has no attribute `__name__`
- homeassistant/components/openhome/media_player.py:78:55 error[unresolved-attribute] Object of type `(...) -> Awaitable[_R@call_wrapper]` has no attribute `__name__`
+ homeassistant/components/openhome/media_player.py:78:55 error[unresolved-attribute] Object of type `(_OpenhomeDeviceT@call_wrapper, /, *args: _P@call_wrapper.args, **kwargs: _P@call_wrapper.kwargs) -> Awaitable[_R@call_wrapper]` has no attribute `__name__`
+ homeassistant/components/otbr/silabs_multiprotocol.py:61:12 error[invalid-return-type] Return type does not match returned value: expected `[**_P'return, _R'return]((HomeAssistant, OTBRData, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Coroutine[Any, Any, _R'return], /) -> ((HomeAssistant, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Coroutine[Any, Any, _R'return | _R_Def])`, found `def _async_get_otbr_data(orig_func: (HomeAssistant, OTBRData, /, *args: _P@_async_get_otbr_data.args, **kwargs: _P@_async_get_otbr_data.kwargs) -> Coroutine[Any, Any, _R@_async_get_otbr_data]) -> ((HomeAssistant, /, *args: _P@_async_get_otbr_data.args, **kwargs: _P@_async_get_otbr_data.kwargs) -> Coroutine[Any, Any, _R@_async_get_otbr_data | _R_Def@async_get_otbr_data])`
+ homeassistant/components/otbr/silabs_multiprotocol.py:55:56 error[invalid-argument-type] Argument is incorrect: Expected `_P@_async_get_otbr_data.args`, found `_P@async_get_otbr_data_wrapper.args`
+ homeassistant/components/roku/helpers.py:55:12 error[invalid-return-type] Return type does not match returned value: expected `[_RokuEntityT'return, **_P'return]((_RokuEntityT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Awaitable[Any], /) -> ((_RokuEntityT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Coroutine[Any, Any, None])`, found `def decorator(func: _FuncType[_RokuEntityT@decorator, _P@decorator]) -> _ReturnFuncType[_RokuEntityT@decorator, _P@decorator]`
- homeassistant/components/russound_rio/entity.py:33:38 error[unresolved-attribute] Object of type `(...) -> Awaitable[None]` has no attribute `__name__`
+ homeassistant/components/russound_rio/entity.py:33:38 error[unresolved-attribute] Object of type `(_EntityT@command, /, *args: [email protected], **kwargs: [email protected]) -> Awaitable[None]` has no attribute `__name__`
+ homeassistant/components/sonos/helpers.py:68:38 error[invalid-argument-type] Argument is incorrect: Expected `[email protected]`, found `[email protected]`
- homeassistant/components/tplink/entity.py:141:29 error[unresolved-attribute] Object of type `(...) -> Awaitable[None]` has no attribute `__name__`
+ homeassistant/components/tplink/entity.py:141:29 error[unresolved-attribute] Object of type `(_T@async_refresh_after, /, *args: _P@async_refresh_after.args, **kwargs: _P@async_refresh_after.kwargs) -> Awaitable[None]` has no attribute `__name__`
- homeassistant/components/tplink/entity.py:150:29 error[unresolved-attribute] Object of type `(...) -> Awaitable[None]` has no attribute `__name__`
+ homeassistant/components/tplink/entity.py:150:29 error[unresolved-attribute] Object of type `(_T@async_refresh_after, /, *args: _P@async_refresh_after.args, **kwargs: _P@async_refresh_after.kwargs) -> Awaitable[None]` has no attribute `__name__`
- homeassistant/components/webostv/media_player.py:87:51 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, _R@cmd]` has no attribute `__name__`
+ homeassistant/components/webostv/media_player.py:87:51 error[unresolved-attribute] Object of type `(LgWebOSMediaPlayerEntity, /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, _R@cmd]` has no attribute `__name__`
- homeassistant/components/wiim/media_player.py:92:20 error[unresolved-attribute] Object of type `(...) -> Awaitable[_R@media_player_exception_wrap]` has no attribute `__name__`
+ homeassistant/components/wiim/media_player.py:92:20 error[unresolved-attribute] Object of type `(_WiimMediaPlayerEntityT@media_player_exception_wrap, /, *args: _P@media_player_exception_wrap.args, **kwargs: _P@media_player_exception_wrap.kwargs) -> Awaitable[_R@media_player_exception_wrap]` has no attribute `__name__`
discord.py (https://github.com/Rapptz/discord.py)
- discord/app_commands/commands.py:149:92 error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- discord/app_commands/commands.py:657:43 error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- discord/app_commands/commands.py:675:49 error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- discord/app_commands/commands.py:858:83 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- discord/app_commands/commands.py:859:65 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- discord/app_commands/commands.py:683:28 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Unknown]` has no attribute `__self__`
+ discord/app_commands/commands.py:683:28 error[unresolved-attribute] Object of type `((GroupT@Command, Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | ((Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command])` has no attribute `__self__`
- discord/app_commands/commands.py:684:41 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Unknown]` has no attribute `__func__`
+ discord/app_commands/commands.py:684:41 error[unresolved-attribute] Object of type `((GroupT@Command, Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | ((Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command])` has no attribute `__func__`
- discord/app_commands/commands.py:688:97 error[unresolved-attribute] Attribute `__globals__` is not defined on `(...) -> Coroutine[Any, Any, Unknown]` in union `((...) -> Coroutine[Any, Any, Unknown]) | Unknown`
+ discord/app_commands/commands.py:688:97 error[unresolved-attribute] Attribute `__globals__` is not defined on `(GroupT@Command, Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]`, `(Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]` in union `((GroupT@Command, Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | ((Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | Unknown`
- discord/app_commands/commands.py:2005:55 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Unknown]` has no attribute `__name__`
+ discord/app_commands/commands.py:2005:55 error[unresolved-attribute] Object of type `((GroupT@decorator, Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@decorator]) | ((Interaction[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@decorator])` has no attribute `__name__`
- discord/app_commands/errors.py:453:95 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Unknown]` has no attribute `__qualname__`
+ discord/app_commands/errors.py:453:95 error[unresolved-attribute] Object of type `Top[(...) -> Coroutine[Any, Any, object]]` has no attribute `__qualname__`
- discord/app_commands/tree.py:862:43 error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- discord/ext/commands/bot.py:296:41 error[invalid-type-arguments] Too many type arguments: expected 1, got 4
- discord/ext/commands/bot.py:306:50 error[invalid-type-arguments] Too many type arguments: expected 1, got 4
- discord/ext/commands/bot.py:320:41 error[invalid-type-arguments] Too many type arguments: expected 1, got 4
- discord/ext/commands/bot.py:330:50 error[invalid-type-arguments] Too many type arguments: expected 1, got 4
- discord/ext/commands/core.py:1063:71 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- discord/ext/commands/core.py:1673:75 warning[unused-type-ignore-comment] Unused blanket `type: ignore` directive
- discord/ext/commands/core.py:462:22 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, T@Command]` has no attribute `__commands_checks__`
+ discord/ext/commands/core.py:462:22 error[unresolved-attribute] Object of type `((CogT@Command, Context[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | ((Context[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command])` has no attribute `__commands_checks__`
- discord/ext/commands/core.py:470:24 error[unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, T@Command]` has no attribute `__commands_cooldown__`
+ discord/ext/commands/core.py:470:24 error[unresolved-attribute] Object of type `((CogT@Command, Context[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command]) | ((Context[Any], /, *args: [email protected], **kwargs: [email protected]) -> Coroutine[Any, Any, T@Command])` has no attribute `__commands_cooldown__`
- discord/ext/commands/core.py:2373:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])) -> Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])`
+ discord/ext/commands/core.py:2373:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: (...) -> Coroutine[Any, Any, Any]) -> ((...) -> Coroutine[Any, Any, Any])`
- discord/ext/commands/core.py:2448:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])) -> Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])`
+ discord/ext/commands/core.py:2448:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: (...) -> Coroutine[Any, Any, Any]) -> ((...) -> Coroutine[Any, Any, Any])`
- discord/ext/commands/core.py:2455:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])) -> Command[Unknown, (...), Unknown] | ((...) -> Coroutine[Any, Any, Any])`
+ discord/ext/commands/core.py:2455:9 error[unresolved-attribute] Unresolved attribute `predicate` on type `def decorator(func: (...) -> Coroutine[Any, Any, Any]) -> ((...) -> Coroutine[Any, Any, Any])`
- discord/ext/commands/hybrid.py:950:38 error[invalid-type-arguments] Too many type arguments: expected 1, got 4
django-stubs (https://github.com/typeddjango/django-stubs)
+ tests/assert_type/utils/test_decorators.py:17:60 warning[unused-ignore-comment] Unused `ty: ignore` directive
jax (https://github.com/google/jax)
- jax/_src/pallas/mosaic/random.py:160:43 error[invalid-argument-type] Argument to function `_make_stateful_sampler` is incorrect: Expected `SampleFn`, found `def uniform(key: Array | ndarray[tuple[Any, ...], dtype[Any]] | bool[bool] | ... omitted 4 union elements, shape: Sequence[int] = ..., dtype: str | type[Any] | dtype[Any] | SupportsDType | None = None, minval: Array | ndarray[tuple[Any, ...], dtype[Any]] | bool[bool] | ... omitted 4 union elements = ..., maxval: Array | ndarray[tuple[Any, ...], dtype[Any]] | bool[bool] | ... omitted 4 union elements = ..., *, out_sharding=None) -> Array`
- jax/_src/pallas/mosaic/random.py:162:42 error[invalid-argument-type] Argument to function `_make_stateful_sampler` is incorrect: Expected `SampleFn`, found `def normal(key: Array | ndarray[tuple[Any, ...], dtype[Any]] | bool[bool] | ... omitted 4 union elements, shape: Sequence[int] = ..., dtype: str | type[Any] | dtype[Any] | SupportsDType | None = None, *, out_sharding=None) -> Array`
manticore (https://github.com/trailofbits/manticore)
- tests/native/test_aarch64cpu.py:14071:9 error[invalid-method-override] Invalid override of method `assertEqual`: Definition is incompatible with `TestCase.assertEqual`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/indexes/accessors.py:175:9 error[invalid-method-override] Invalid override of method `_delegate_property_get`: Definition is incompatible with `PandasDelegate._delegate_property_get`
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/test_styler.py:64:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Styler`
+ tests/frame/test_frame.py:2442:9 error[no-matching-overload] No overload of bound method `pipe` matches arguments
- tests/frame/test_groupby.py:478:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[Any]`
- tests/frame/test_groupby.py:488:11 error[type-assertion-failure] Type `Unknown` does not match asserted type `Series[Any]`
- tests/frame/test_groupby.py:494:21 error[no-matching-overload] No overload of bound method `apply` matches arguments
- tests/frame/test_groupby.py:502:9 error[type-assertion-failure] Type `Unknown` does not match asserted type `DataFrame`
+ tests/series/test_series.py:2496:9 error[no-matching-overload] No overload of bound method `pipe` matches arguments
+ tests/test_resampler.py:191:9 error[no-matching-overload] No overload of bound method `pipe` matches arguments
+ tests/test_resampler.py:205:9 error[no-matching-overload] No overload of bound method `pipe` matches arguments
+ tests/test_resampler.py:212:9 error[no-matching-overload] No overload of bound method `pipe` matches arguments
pydantic (https://github.com/pydantic/pydantic)
- pydantic/_internal/_decorators.py:741:28 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(...) -> Unknown`, found `classmethod[Any, (...), Any] | staticmethod[(...), Any] | partialmethod[Any] | ((...) -> Any)`
+ pydantic/_internal/_decorators.py:741:28 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(type[Unknown], /, *args: Unknown, **kwargs: Unknown) -> Unknown`, found `classmethod[Any, (...), Any] | staticmethod[(...), Any] | partialmethod[Any] | ((...) -> Any)`
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/specs/openapi/adapter/parameters.py:247:12 error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
- src/schemathesis/specs/openapi/adapter/parameters.py:655:16 error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
- src/schemathesis/specs/openapi/adapter/parameters.py:1214:16 error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
- src/schemathesis/specs/openapi/stateful/__init__.py:200:37 error[missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
scikit-learn (https://github.com/scikit-learn/scikit-learn)
+ sklearn/_loss/tests/test_loss.py:943:15 error[no-matching-overload] No overload of function `newton` matches arguments
scipy (https://github.com/scipy/scipy)
- scipy/stats/_distribution_infrastructure.py:4712:9 error[invalid-method-override] Invalid override of method `_pxf_dispatch`: Definition is incompatible with `ContinuousDistribution._pxf_dispatch`
- scipy/stats/_distribution_infrastructure.py:4903:9 error[invalid-method-override] Invalid override of method `_support`: Definition is incompatible with `UnivariateDistribution._support`
scipy-stubs (https://github.com/scipy/scipy-stubs)
- tests/optimize/test__minpack_py.pyi:63:1 error[type-assertion-failure] Type `complex128` does not match asserted type `Unknown`
- tests/optimize/test__minpack_py.pyi:64:1 error[type-assertion-failure] Type `complex128` does not match asserted type `Unknown`
- tests/integrate/test_quad_vec.pyi:48:1 error[type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[Unknown, int | float]`
- tests/integrate/test_quad_vec.pyi:49:1 error[type-assertion-failure] Type `float64` does not match asserted type `Unknown`
- tests/integrate/test_quad_vec.pyi:62:1 error[type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[Unknown, int | float]`
- tests/integrate/test_quad_vec.pyi:77:1 error[type-assertion-failure] Type `float64` does not match asserted type `Unknown`
- tests/integrate/test_quad_vec.pyi:91:1 error[type-assertion-failure] Type `float64` does not match asserted type `Unknown`
+ tests/integrate/test_quad_vec.pyi:55:1 error[type-assertion-failure] Type `tuple[Unknown, int | float]` does not match asserted type `tuple[float64, int | float]`
- tests/integrate/test_quad_vec.pyi:13:1 error[type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[int | float, int | float]`
+ tests/integrate/test_quad_vec.pyi:13:1 error[type-assertion-failure] Type `tuple[Unknown, int | float]` does not match asserted type `tuple[int | float, int | float]`
- tests/integrate/test_quad_vec.pyi:69:1 error[type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[complexfloating[_32Bit, _32Bit], int | float]`
+ tests/integrate/test_quad_vec.pyi:69:1 error[type-assertion-failure] Type `tuple[Unknown, int | float]` does not match asserted type `tuple[complexfloating[_32Bit, _32Bit], int | float]`
scrapy (https://github.com/scrapy/scrapy)
- scrapy/extensions/httpcache.py:317:13 error[invalid-assignment] Object of type `(Overload[(filename: str | bytes | PathLike[str] | PathLike[bytes] | _ReadableFileobj, mode: Literal["r", "rb"] = "rb", compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | PathLike[bytes] | _WritableFileobj, mode: Literal["a", "ab", "w", "wb", "x", "xb"], compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: Literal["rt", "at", "wt", "xt"], compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> TextIOWrapper[_WrappedBuffer], (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: str, compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> GzipFile | TextIOWrapper[_WrappedBuffer]]) | (Overload[(file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["r+", "+r", "rt+", "r+t", "+rt", ... omitted 48 literals] = "r", buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> TextIOWrapper[_WrappedBuffer], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> FileIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 19 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedRandom, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["wb", "bw", "ab", "ba", "xb", "bx"], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedWriter, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb", "br", "rbU", "rUb", "Urb", ... omitted 3 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedReader[_BufferedReaderStream], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BinaryIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> IO[Any]])` is not assignable to `(...) -> IO[bytes]`: Incompatible value of type `(Overload[(filename: str | bytes | PathLike[str] | PathLike[bytes] | _ReadableFileobj, mode: Literal["r", "rb"] = "rb", compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | PathLike[bytes] | _WritableFileobj, mode: Literal["a", "ab", "w", "wb", "x", "xb"], compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: Literal["rt", "at", "wt", "xt"], compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> TextIOWrapper[_WrappedBuffer], (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: str, compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> GzipFile | TextIOWrapper[_WrappedBuffer]]) | (Overload[(file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["r+", "+r", "rt+", "r+t", "+rt", ... omitted 48 literals] = "r", buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> TextIOWrapper[_WrappedBuffer], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> FileIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 19 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedRandom, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["wb", "bw", "ab", "ba", "xb", "bx"], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedWriter, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb", "br", "rbU", "rUb", "Urb", ... omitted 3 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedReader[_BufferedReaderStream], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BinaryIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> IO[Any]])`
+ scrapy/extensions/httpcache.py:317:13 error[invalid-assignment] Object of type `(Overload[(filename: str | bytes | PathLike[str] | PathLike[bytes] | _ReadableFileobj, mode: Literal["r", "rb"] = "rb", compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | PathLike[bytes] | _WritableFileobj, mode: Literal["a", "ab", "w", "wb", "x", "xb"], compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: Literal["rt", "at", "wt", "xt"], compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> TextIOWrapper[_WrappedBuffer], (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: str, compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> GzipFile | TextIOWrapper[_WrappedBuffer]]) | (Overload[(file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["r+", "+r", "rt+", "r+t", "+rt", ... omitted 48 literals] = "r", buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> TextIOWrapper[_WrappedBuffer], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> FileIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 19 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedRandom, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["wb", "bw", "ab", "ba", "xb", "bx"], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedWriter, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb", "br", "rbU", "rUb", "Urb", ... omitted 3 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedReader[_BufferedReaderStream], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BinaryIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> IO[Any]])` is not assignable to `(str | PathLike[Unknown], str, /, *args: Any, **kwargs: Any) -> IO[bytes]`: Incompatible value of type `(Overload[(filename: str | bytes | PathLike[str] | PathLike[bytes] | _ReadableFileobj, mode: Literal["r", "rb"] = "rb", compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | PathLike[bytes] | _WritableFileobj, mode: Literal["a", "ab", "w", "wb", "x", "xb"], compresslevel: int = 9, encoding: None = None, errors: None = None, newline: None = None) -> GzipFile, (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: Literal["rt", "at", "wt", "xt"], compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> TextIOWrapper[_WrappedBuffer], (filename: str | bytes | PathLike[str] | ... omitted 3 union elements, mode: str, compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None) -> GzipFile | TextIOWrapper[_WrappedBuffer]]) | (Overload[(file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["r+", "+r", "rt+", "r+t", "+rt", ... omitted 48 literals] = "r", buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> TextIOWrapper[_WrappedBuffer], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> FileIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 19 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedRandom, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["wb", "bw", "ab", "ba", "xb", "bx"], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedWriter, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb", "br", "rbU", "rUb", "Urb", ... omitted 3 literals], buffering: Literal[-1, 1] = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BufferedReader[_BufferedReaderStream], (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: Literal["rb+", "r+b", "+rb", "br+", "b+r", ... omitted 33 literals], buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> BinaryIO, (file: int | str | bytes | PathLike[str] | PathLike[bytes], mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None, closefd: bool = True, opener: ((str, int, /) -> int) | None = None) -> IO[Any]])`
+ tests/test_contracts.py:343:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:385:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `<class 'ResponseMetaMock'>`
+ tests/test_contracts.py:403:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:413:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:445:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:455:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:480:26 error[invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
- tests/test_crawler.py:180:17 error[invalid-method-override] Invalid override of method `from_crawler`: Definition is incompatible with `Spider.from_crawler`
- tests/test_crawler.py:340:17 error[invalid-method-override] Invalid override of method `from_crawler`: Definition is incompatible with `Spider.from_crawler`
+ tests/test_downloadermiddleware_offsite.py:90:44 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `((Response, /, *args: Any, **kwargs: Any) -> Any) | None`, found `dict[Unknown, Unknown]`
starlette (https://github.com/encode/starlette)
- starlette/applications.py:71:27 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'ExceptionMiddleware'>`
- tests/middleware/test_cors.py:20:17 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:132:17 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:181:17 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:255:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:310:17 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:413:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:431:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:503:17 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_session.py:71:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'SessionMiddleware'>`
- tests/middleware/test_session.py:96:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'SessionMiddleware'>`
- tests/middleware/test_session.py:169:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'SessionMiddleware'>`
- tests/middleware/test_session.py:213:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'SessionMiddleware'>`
- tests/middleware/test_session.py:234:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'SessionMiddleware'>`
- tests/middleware/test_trusted_host.py:16:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'TrustedHostMiddleware'>`
- tests/middleware/test_base.py:153:24 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'bMiddleware'>`
- tests/middleware/test_base.py:154:24 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'cMiddleware'>`
- tests/middleware/test_base.py:609:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'ConsumingMiddleware'>`
- tests/middleware/test_base.py:1278:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'PassthroughMiddleware'>`
- tests/middleware/test_gzip.py:41:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'GZipMiddleware'>`
- tests/middleware/test_gzip.py:107:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'GZipMiddleware'>`
- tests/middleware/test_gzip.py:155:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'GZipMiddleware'>`
- tests/test_applications.py:486:28 error[invalid-argument-type] Argument to bound method `add_middleware` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'NoOpMiddleware'>`
- tests/test_authentication.py:343:28 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'AuthenticationMiddleware'>`
- tests/test_routing.py:328:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CustomMiddleware'>`
- tests/test_routing.py:843:36 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'AddHeadersMiddleware'>`
- tests/test_routing.py:964:40 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'NamedMiddleware'>`
- tests/test_routing.py:969:32 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'NamedMiddleware'>`
- tests/test_routing.py:1016:40 error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'WebsocketMiddleware'>`
svcs (https://github.com/hynek/svcs)
+ tests/typing/starlette.py:59:62 warning[unused-ignore-comment] Unused `ty: ignore` directive
sympy (https://github.com/sympy/sympy)
- sympy/physics/control/lti.py:1733:9 error[invalid-method-override] Invalid override of method `from_coeff_lists`: Definition is incompatible with `TransferFunctionBase.from_coeff_lists`
- sympy/physics/control/lti.py:1982:9 error[invalid-method-override] Invalid override of method `from_coeff_lists`: Definition is incompatible with `TransferFunctionBase.from_coeff_lists`
trio (https://github.com/python-trio/trio)
- src/trio/_socket.py:1160:16 error[invalid-assignment] Object of type `(...) -> Awaitable[tuple[bytes, Any]]` is not assignable to `def recvfrom(self, bufsize: int, flags: int = 0, /) -> Awaitable[tuple[bytes, Any]]`
+ src/trio/_socket.py:1160:16 error[invalid-assignment] Object of type `(_SocketType, bufsize: int, flags: int = 0, /) -> Awaitable[tuple[bytes, Any]]` is not assignable to `def recvfrom(self, bufsize: int, flags: int = 0, /) -> Awaitable[tuple[bytes, Any]]`
- src/trio/_socket.py:1179:21 error[invalid-assignment] Object of type `(...) -> Awaitable[tuple[int, Any]]` is not assignable to `def recvfrom_into(self, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[tuple[int, Any]]`
+ src/trio/_socket.py:1179:21 error[invalid-assignment] Object of type `(_SocketType, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[tuple[int, Any]]` is not assignable to `def recvfrom_into(self, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[tuple[int, Any]]`
+ src/trio/_tests/test_path.py:207:11 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/test_path.py:234:18 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/test_path.py:242:11 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/test_path.py:246:24 error[missing-argument] No argument provided for required parameter 1
- src/trio/_tests/test_path.py:125:12 error[unresolved-attribute] Attribute `__qualname__` is not defined on `[PathT'return](...) -> Awaitable[PathT'return]` in union `Unknown | ([PathT'return](...) -> Awaitable[PathT'return])`
+ src/trio/_tests/test_path.py:125:12 error[unresolved-attribute] Attribute `__qualname__` is not defined on `[PathT'return](PathT'return, /, strict: bool = False) -> Awaitable[PathT'return]` in union `Unknown | ([PathT'return](PathT'return, /, strict: bool = False) -> Awaitable[PathT'return])`
+ src/trio/_tests/type_tests/path.py:70:25 error[missing-argument] No argument provided for required parameter `pattern`
+ src/trio/_tests/type_tests/path.py:100:39 error[invalid-argument-type] Argument is incorrect: Argument type `Literal["*.py"]` does not satisfy upper bound `Path` of type variable `PathT'return`
+ src/trio/_tests/type_tests/path.py:112:31 error[invalid-argument-type] Argument is incorrect: Expected `Path`, found `Literal["hello"]`
+ src/trio/_tests/type_tests/path.py:67:34 error[invalid-argument-type] Argument is incorrect: Expected `Path`, found `Literal[511]`
+ src/trio/_tests/type_tests/path.py:73:27 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:81:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:82:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:84:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:90:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:94:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:97:23 error[missing-argument] No argument provided for required parameter `target`
- src/trio/_tests/type_tests/path.py:98:5 error[type-assertion-failure] Type `Unknown` does not match asserted type `Path`
+ src/trio/_tests/type_tests/path.py:98:5 error[type-assertion-failure] Type `Unknown | Path` does not match asserted type `Path`
+ src/trio/_tests/type_tests/path.py:104:23 error[missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:105:37 error[invalid-argument-type] Argument is incorrect: Expected `Path`, found `Literal["something_else"]`
+ src/trio/_tests/type_tests/path.py:106:23 error[missing-argument] No argument provided for required parameter `target`
+ src/trio/_tests/type_tests/path.py:107:23 error[missing-argument] No argument provided for required parameter `target`
+ src/trio/_tests/type_tests/path.py:110:23 error[missing-argument] No argument provided for required parameter `data`
+ src/trio/_tests/type_tests/path.py:110:40 error[invalid-argument-type] Argument is incorrect: Expected `Path`, found `Literal[b"123"]`
xarray (https://github.com/pydata/xarray)
- xarray/backends/memory.py:38:9 error[invalid-method-override] Invalid override of method `prepare_variable`: Definition is incompatible with `AbstractWritableDataStore.prepare_variable`
zulip (https://github.com/zulip/zulip)
- zerver/tests/test_parallel.py:197:17 error[invalid-argument-type] Argument to function `run_parallel` is incorrect: Expected `(int, /) -> None`, found `[**P'return](**P'return) -> None`
- zerver/tests/test_parallel.py:230:21 error[invalid-argument-type] Argument to function `run_parallel` is incorrect: Expected `(int, /) -> None`, found `[**P'return](**P'return) -> None`
- zerver/tests/test_parallel.py:267:17 error[invalid-argument-type] Argument to function `run_parallel` is incorrect: Expected `(int, /) -> None`, found `[**P'return](**P'return) -> None`
+ zerver/decorator.py:934:35 error[invalid-argument-type] Argument is incorrect: Expected `UserProfile`, found `AbstractBaseUser | AnonymousUser`
- zerver/decorator.py:516:49 error[unresolved-attribute] Object of type `(...) -> HttpResponse` has no attribute `__name__`
+ zerver/decorator.py:516:49 error[unresolved-attribute] Object of type `(HttpRequest, /, *args: ParamT@log_view_func.args, **kwargs: ParamT@log_view_func.kwargs) -> HttpResponse` has no attribute `__name__`
- zerver/decorator.py:900:19 error[unresolved-attribute] Object of type `(...) -> HttpResponse` has no attribute `__name__`
+ zerver/decorator.py:900:19 error[unresolved-attribute] Object of type `(HttpRequest, UserProfile | AnonymousUser, /, *args: ParamT@public_json_view.args, **kwargs: ParamT@public_json_view.kwargs) -> HttpResponse` has no attribute `__name__`
- zerver/lib/import_realm.py:1170:13 error[invalid-argument-type] Argument to function `run_parallel` is incorrect: Expected `(dict[str, Any], /) -> None`, found `(def process_avatars(record: dict[str, Any]) -> None) | ([**P'return](**P'return) -> None)`
- zerver/lib/parallel.py:121:60 error[invalid-argument-type] Argument to bound method `submit` is incorrect: Expected `P'[email protected]`, found `ParallelRecordType@run_parallel_queue`
- zerver/lib/typed_endpoint.py:294:53 error[unresolved-attribute] Object of type `(...) -> object` has no attribute `__name__`
+ zerver/lib/typed_endpoint.py:294:53 error[unresolved-attribute] Object of type `(HttpRequest, /, *args: ParamT@parse_view_func_signature.args, **kwargs: ParamT@parse_view_func_signature.kwargs) -> object` has no attribute `__name__`
- zerver/lib/typed_endpoint.py:502:21 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `object` on object of type `ParamT@_wrapped_view_func.kwargs`
+ zerver/lib/typed_endpoint.py:502:21 error[invalid-assignment] Invalid subscript assignment with key of type `str` and value of type `object` on object of type `ParamT@typed_endpoint.kwargs`
- zerver/webhooks/github/view.py:1048:61 error[invalid-assignment] Object of type `dict[str, ((Helper, /) -> str) | ([**P'return](**P'return) -> str)]` is not assignable to `dict[str, (Helper, /) -> str]`…23927) ## Summary This PR updates the constraint set assignability check to only special case overloaded callables against a callable containing `ParamSpec` and pass through any other callables to the check in `Signature`. This is to make sure for `Concatenate` (ref #23689) that we make sure that it goes through to `Signature` where the type checking / constraint set building would take place. Here are the detailed list of changes: In `check_callable_signature_pair_inner`, - Delegate the branch where both sides contain single signature with `ParamSpec` as the only parameter to `check_signature_pair` - For other branches where one side contain a single signature with `ParamSpec` as the only parameter, update the other side to check whether it's an overloaded callable. The reason is that the `signatures_is_single_paramspec` can return `None` even for non-overloaded non-ParamSpec callable which we should delegate to `check_signature_pair` In `check_signature_pair_inner`, - Move the constraint set assignability branch before any special case of `Top` and gradual form handling. This is to support the delegation that happened from `check_callable_signature_pair_inner` so that the constraint set contains a node for the `ParamSpec` type variable because otherwise we would've short-circuit for `Top` / gradual form cases. ## Test Plan Make sure there are no regression and existing test cases pass. I'm also working on top of this branch in #23689 to make sure these changes are valid, so far so good.
Co-authored-by: Valentin Iovene <[email protected]>
54c635c to
ef7efba
Compare
ef7efba to
77f0865
Compare
| reveal_type(Calculator().square_then_round(3.14)) # revealed: Unknown | int | ||
| ``` | ||
|
|
||
| ## Use case: Wrappers with explicit receivers |
There was a problem hiding this comment.
|
|
||
| class Sub23(Super4): | ||
| def method(self, x, *args, y, **kwargs): ... # error: [invalid-method-override] | ||
| ``` |
There was a problem hiding this comment.
This is now not an error because this PR fixes astral-sh/ty#1257 and this is a gradual callable as both *args and **kwargs are present without an annotation.
There was a problem hiding this comment.
Should we leave the class and only remove the error comment? Maybe with a comment explaining why this is not a liskov violation
There was a problem hiding this comment.
Yeah, that seems reasonable.
|
|
||
| # error: [invalid-argument-type] | ||
| @abstractclassmethod # error: [deprecated] | ||
| def make(cls) -> "Base": | ||
| raise NotImplementedError |
There was a problem hiding this comment.
I'm a bit unsure on why this isn't working, it might be related to the fact that it accepts type[_T] as the first parameter. Both mypy and Pyright seems to be raising an error here as well. And, ty works correctly when using the correct way i.e.,
@classmethod
@abstractmethod
def make(cls) -> "Base":
reveal_type(cls) # revealed: type[Self@make]
raise NotImplementedError|
Follow-up tasks:
|
| } else if prefix_params.iter().all(Parameter::is_positional) { | ||
| // TODO: Currently, we accept both positional-only and | ||
| // positional-or-keyword parameter but we should raise a warning to | ||
| // let users know that these parameters should be positional-only | ||
| kind = ParametersKind::Concatenate(ConcatenateTail::ParamSpec( | ||
| typevar, | ||
| )); |
There was a problem hiding this comment.
We have to allow positional-or-keyword parameter here otherwise the Starlette issue (astral-sh/ty#1635) will still fail because the signature of add_middleware does not use positional-only parameter strictly:
def add_middleware(self, middleware_class: _MiddlewareFactory[P], *args: P.args, **kwargs: P.kwargs) -> None:I'll open an issue about that.
The warning idea as proposed is here for ref: python/mypy#21001
dcreager
left a comment
There was a problem hiding this comment.
This looks great! Overall approach looks good, just one question about type invariants, and some nits
There was a problem hiding this comment.
Love all the removed TODOs here
|
|
||
| class Sub23(Super4): | ||
| def method(self, x, *args, y, **kwargs): ... # error: [invalid-method-override] | ||
| ``` |
There was a problem hiding this comment.
Should we leave the class and only remove the error comment? Maybe with a comment explaining why this is not a liskov violation
| // > If the input signature in a function definition includes both a `*args` and | ||
| // > `**kwargs` parameter and both are typed as Any (explicitly or implicitly | ||
| // > because it has no annotation), a type checker should treat this as the | ||
| // > equivalent of `...`. Any other parameters in the signature are unaffected and | ||
| // > are retained as part of the signature. | ||
| // | ||
| // https://typing.python.org/en/latest/spec/callables.html#meaning-of-in-callable |
There was a problem hiding this comment.
I like the explicit callouts to the spec
| ParametersKind::ParamSpec(typevar) => Some((&[], typevar)), | ||
| ParametersKind::Concatenate(ConcatenateTail::ParamSpec(typevar)) => { | ||
| Some((&self.value[..self.value.len().saturating_sub(2)], typevar)) | ||
| } |
There was a problem hiding this comment.
It seems like there are now some subtle invariants on the possible combinations of self.value and self.kind. For instance, if kind == ParamSpec(P), does that mean that values must be empty? And if kind == Concatenate(..., P), you're peeling two arguments off the end of the list, if they exist. Is that *args: P.args and **kwargs: P.kwargs? Or *args: Any and **kwargs: Any for the gradual form? It seems like those arguments aren't required. When would value have fewer than 2 elements?
It looks like this is documented down at the concatenate method, but it would be nice to document the invariants in the definition of struct Parameters as well.
(And even more ideally, it would be great if we could find a way to structure everything so that the invariants are enforced by the type structure. But that doesn't have to block this PR, other than maybe adding a TODO comment at the definition of the Parameters type)
There was a problem hiding this comment.
For instance, if
kind == ParamSpec(P), does that mean thatvaluesmust be empty? And ifkind == Concatenate(..., P), you're peeling two arguments off the end of the list, if they exist. Is that*args: P.argsand**kwargs: P.kwargs?
No, not really. So, the values which contains the individual parameters should always have the full parameter list including both *args and **kwargs where applicable. So,
Gradualwould have[*args: Any, **kwargs: Any]ParamSpec(P)would have[*args: P.args, **kwargs: P.kwargs]Concatenate(<prefix params>, P)would have[<prefix params>, *args: P.args, **kwargs: P.kwargs]Concatenate(<prefix params>, ....)would have[<prefix params>, *args: Any, **kwargs: Any]
So, the reason this method isn't removing the final two parameters in case of ParametersKind::ParamSpec is because it should only have exactly 2 parameters. But, I understand that it's a bit subtle and I can see how that's confusing.
Let me try to think through if I can represent the invariants directly in the type structure.
There was a problem hiding this comment.
Added a TODO, will try it as follow-up.
| /// - `(<prefix_params>, /, *args: Any, **kwargs: Any)` for the gradual form, or | ||
| /// - `(<prefix_params>, /, *args: P.args, **kwargs: P.kwargs)` for the `ParamSpec` form. |
There was a problem hiding this comment.
This suggests that the final two arguments are required for a Concatenate parameters. If so, you might consider using strict_sub above instead of saturating_sub, so that we panic if we create a parameter list that violates this requirement.
There was a problem hiding this comment.
Yeah, that is a way to enfore the invariant but I think I'd prefer to try out a different representation instead as a follow-up.
| // TODO: Remove this once we support Concatenate properly. This is necessary | ||
| // to avoid a lot of false positives downstream, because we can't represent the typevar- | ||
| // specialized `Callable` types yet. |
|
Number of max diagnostics for altair project is changed from 897 to 898 and here's where the new diagnostic is added: # FIXME: `to_csv` cannot accept all `DataType` https://github.com/vega/altair/issues/3441
data_transformers.register("csv", to_csv) # type: ignore[arg-type]ty raises: And, given that this is now not considered a blanket ignore, we raise this error. |
* main: [ty] make `test-case` a dev-dependency (#24187) [ty] implement cycle normalization for more types to prevent too-many-cycle panics (#24061) [ty] Silence all diagnostics in unreachable code (#24179) [ty] Intern `InferableTypeVars` (#24161) Implement unnecessary-if (RUF050) (#24114) Recognize `Self` annotation and `self` assignment in SLF001 (#24144) Bump the npm version before publish (#24178) [ty] Disallow Self in metaclass and static methods (#23231) Use trusted publishing for NPM packages (#24171) [ty] Respect non-explicitly defined dataclass params (#24170) Add RUF072: warn when using operator on an f-string (#24162) [ty] Check return type of generator functions (#24026) Implement useless-finally (RUF-072) (#24165) [ty] Add test for a dataclass with a default field converter (#24169) [ty] Dataclass field converters (#23088) [flake8-bandit] Treat sys.executable as trusted input in S603 (#24106) [ty] Add support for `typing.Concatenate` (#23689) `ASYNC115`: autofix to use full qualified `anyio.lowlevel` import (#24166) [ty] Disallow read-only fields in TypedDict updates (#24128) Speed up diagnostic rendering (#24146)

Summary
closes: astral-sh/ty#1535
closes: astral-sh/ty#1635
closes: astral-sh/ty#2024
This PR adds support for
typing.Concatenate.The way it implements is by expanding the existing
ParametersKindto include a new enumParametersKind::Concatenatewhich contains aConcatenateTailenum which represents the two form specifically theConcatenate[<prefix params>, ...](gradual form) andConcatenate[<prefix params>, P](wherePis aParamSpectype variable). Internally, it still adds the*argsand**kwargsto the parameter list.closes: astral-sh/ty#1257
Additionally, it also updates the
Parameters::newmethod to consider other gradual forms, specifically to support the following from the typing spec:Assignability
The main complexity rises in checking the relation between two signatures. Currently, the logic implemented in this PR is a little bit duplicated from existing check in the parameter loop but is a more limited version given the constraints the the prefix parameters have for concatenate (can be positional-only).
I plan to simplify this as a follow-up instead because otherwise the diff would be quite complicated.
Test Plan
Update existing test cases containing TODOs, add new test cases.
Go through the ecosystem analysis with the help of an agent, add regression test cases for some of the common cases.