Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 85.29% to 85.92%. The percentage of expected errors that received a diagnostic increased from 78.13% to 79.36%. The number of fully passing files improved from 64/132 to 65/132. 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 |
159 | 152 | 8 |
missing-argument |
49 | 31 | 0 |
unresolved-attribute |
5 | 1 | 72 |
invalid-return-type |
46 | 3 | 6 |
invalid-method-override |
0 | 50 | 0 |
invalid-await |
0 | 40 | 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 | 9 |
unused-type-ignore-comment |
3 | 16 | 0 |
too-many-positional-arguments |
4 | 0 | 0 |
unused-ignore-comment |
3 | 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 | 297 | 362 | 138 |
Changes in flaky projects detected. Raw diff output excludes flaky projects; see the HTML report for details.
Showing a random sample of 100 of 649 changes. See the HTML report for the full diff.
Raw diff sample (100 of 649 changes)
Expression (https://github.com/cognitedata/Expression)
+ expression/collections/array.py:592:1 [error] [invalid-argument-type] Argument is incorrect: Expected `[_TSource](Never, /, count: int) -> Never`, found `def take[_TSource](source: TypedArray[_TSource], count: int) -> TypedArray[_TSource]`
+ expression/collections/array.py:606:1 [error] [invalid-argument-type] Argument is incorrect: Expected `[_TSource](Never, /, count: int) -> Never`, found `def take_last[_TSource](source: TypedArray[_TSource], count: int) -> TypedArray[_TSource]`
+ expression/collections/seq.py:287:31 [error] [invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Self@skip, /) -> Unknown`, found `(Never, /) -> Never`
+ expression/collections/seq.py:316:31 [error] [invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Self@take, /) -> Unknown`, found `(Never, /) -> Never`
+ expression/extra/parser.py:54:39 [error] [invalid-argument-type] Argument is incorrect: Expected `Never`, found `Parser[_B@ignore_then]`
+ tests/test_block.py:309:23 [error] [invalid-argument-type] Argument to function `pipe` is incorrect: Expected `(Block[int], /) -> Unknown`, found `(Never, /) -> Never`
+ tests/test_result.py:296:24 [error] [invalid-argument-type] Argument to bound method `pipe` is incorrect: Expected `(Result[Literal[42], Any], /) -> Unknown`, found `(Never, /) -> Never`
+ tests/test_result.py:320:24 [error] [invalid-argument-type] Argument to bound method `pipe` is incorrect: Expected `(Result[Literal[42], Any], /) -> Unknown`, found `(Never, /) -> Never`
altair (https://github.com/vega/altair)
- altair/utils/_transformed_data.py:114:10 [error] [invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ altair/utils/_transformed_data.py:114: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/test_jupyter_chart.py:206: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:206: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/utils/test_mimebundle.py:231:10 [error] [invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/utils/test_mimebundle.py:231: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:990: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:990: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:27:13 [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:27:13 [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:299:27 [warning] [unused-type-ignore-comment] Unused blanket `type: ignore` directive
apprise (https://github.com/caronc/apprise)
- tests/test_config_http.py:73:13 [error] [invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
- tests/test_notification_manager.py:95:13 [error] [invalid-method-override] Invalid override of method `url`: Definition is incompatible with `URLBase.url`
asynq (https://github.com/quora/asynq)
+ asynq/tests/test_decorators.py:55:33 [error] [too-many-positional-arguments] Too many positional arguments to bound method `__call__`: expected 1, got 2
+ asynq/tests/test_decorators.py:57:42 [error] [too-many-positional-arguments] Too many positional arguments to bound method `asynq`: expected 1, got 2
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:172:41 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `ProtocolInterpolator | None`, found `LinearInterpolator`
- colour/notation/munsell/centore2014.py:718:26 [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:75:21 [error] [unresolved-attribute] Object of type `(...) -> Awaitable[_R@_adb_decorator]` has no attribute `__name__`
+ homeassistant/components/androidtv/entity.py:75:21 [error] [unresolved-attribute] Object of type `(_ADBDeviceT@_adb_decorator, /, *args: _P@_adb_decorator.args, **kwargs: _P@_adb_decorator.kwargs) -> Awaitable[_R@_adb_decorator]` has no attribute `__name__`
- homeassistant/components/cast/media_player.py:105:46 [error] [unresolved-attribute] Object of type `(...) -> _R@api_error` has no attribute `__name__`
+ homeassistant/components/cast/media_player.py:105:46 [error] [unresolved-attribute] Object of type `(_CastDeviceT@api_error, /, *args: _P@api_error.args, **kwargs: _P@api_error.kwargs) -> _R@api_error` 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/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:58:49 [error] [invalid-argument-type] Argument is incorrect: Expected `_P@handle_hassio_api_error.args`, found `_P@wrapper.args`
+ homeassistant/components/openhome/media_player.py:83:12 [error] [invalid-return-type] Return type does not match returned value: expected `[_OpenhomeDeviceT'return, **_P'return, _R'return]((_OpenhomeDeviceT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Awaitable[_R'return], /) -> ((_OpenhomeDeviceT'return, /, *args: _P'return.args, **kwargs: _P'return.kwargs) -> Coroutine[Any, Any, _R'return | None])`, found `def call_wrapper(func: _FuncType[_OpenhomeDeviceT@call_wrapper, _P@call_wrapper, _R@call_wrapper]) -> _ReturnFuncType[_OpenhomeDeviceT@call_wrapper, _P@call_wrapper, _R@call_wrapper]`
- 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/openhome/media_player.py:81:16 [error] [invalid-return-type] Return type does not match returned value: expected `_ReturnFuncType[_OpenhomeDeviceT@catch_request_errors, _P@catch_request_errors, _R@call_wrapper]`, found `_Wrapped[(...), Awaitable[_R@call_wrapper], (self: _OpenhomeDeviceT@catch_request_errors, *args: _P@catch_request_errors.args, **kwargs: _P@catch_request_errors.kwargs), CoroutineType[Any, Any, _R@wrapper | None]]`
+ homeassistant/components/openhome/media_player.py:81:16 [error] [invalid-return-type] Return type does not match returned value: expected `_ReturnFuncType[_OpenhomeDeviceT@call_wrapper, _P@call_wrapper, _R@call_wrapper]`, found `_Wrapped[(_OpenhomeDeviceT@call_wrapper, /, *args: _P@call_wrapper.args, **kwargs: _P@call_wrapper.kwargs), Awaitable[_R@call_wrapper], (self: _OpenhomeDeviceT@wrapper, *args: _P@wrapper.args, **kwargs: _P@wrapper.kwargs), CoroutineType[Any, Any, _R@wrapper | None]]`
+ homeassistant/components/roku/helpers.py:42:28 [error] [invalid-argument-type] Argument is incorrect: Expected `_RokuEntityT@decorator`, found `_RokuEntityT@wrapper`
+ homeassistant/components/roku/helpers.py:42:41 [error] [invalid-argument-type] Argument is incorrect: Expected `_P@decorator.kwargs`, found `_P@wrapper.kwargs`
- 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: _P@command.args, **kwargs: _P@command.kwargs) -> Awaitable[None]` has no attribute `__name__`
- homeassistant/components/tplink/entity.py:132:29 [error] [unresolved-attribute] Object of type `(...) -> Awaitable[None]` has no attribute `__name__`
+ homeassistant/components/tplink/entity.py:132: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__`
discord.py (https://github.com/Rapptz/discord.py)
- discord/app_commands/commands.py:657:43 [error] [invalid-type-arguments] Too many type arguments: expected 1, got 3
- discord/app_commands/commands.py:2066:51 [error] [unresolved-attribute] Object of type `(...) -> Coroutine[Any, Any, Unknown]` has no attribute `__name__`
+ discord/app_commands/commands.py:2066:51 [error] [unresolved-attribute] Object of type `((GroupT@decorator, Interaction[Any], /, *args: P@decorator.args, **kwargs: P@decorator.kwargs) -> Coroutine[Any, Any, T@decorator]) | ((Interaction[Any], /, *args: P@decorator.args, **kwargs: P@decorator.kwargs) -> Coroutine[Any, Any, T@decorator])` has no attribute `__name__`
- discord/ext/commands/bot.py:306:50 [error] [invalid-type-arguments] Too many type arguments: expected 1, got 4
- 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: P@Command.args, **kwargs: P@Command.kwargs) -> Coroutine[Any, Any, T@Command]) | ((Context[Any], /, *args: P@Command.args, **kwargs: P@Command.kwargs) -> 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: P@Command.args, **kwargs: P@Command.kwargs) -> Coroutine[Any, Any, T@Command]) | ((Context[Any], /, *args: P@Command.args, **kwargs: P@Command.kwargs) -> Coroutine[Any, Any, T@Command])` has no attribute `__commands_cooldown__`
hydpy (https://github.com/hydpy-dev/hydpy)
- hydpy/core/importtools.py:1084:39 [error] [unresolved-attribute] Object of type `(...) -> None` has no attribute `__name__`
+ hydpy/core/importtools.py:1084:39 [error] [unresolved-attribute] Object of type `(TM_contra@TargetParameterUpdater, /, *args: P_@TargetParameterUpdater.args, **kwargs: P_@TargetParameterUpdater.kwargs) -> None` has no attribute `__name__`
jax (https://github.com/google/jax)
- jax/_src/pallas/mosaic/random.py:159:40 [error] [invalid-argument-type] Argument to function `_make_stateful_sampler` is incorrect: Expected `SampleFn`, found `def bits(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`
- jax/_src/callback.py:249:41 [error] [invalid-argument-type] Argument to function `register_lowering` is incorrect: Expected `LoweringRule`, found `def pure_callback_lowering(ctx, *args, *, callback: _FlatCallback, sharding: SingleDeviceSharding | None, **params) -> Unknown`
pandas (https://github.com/pandas-dev/pandas)
- pandas/core/frame.py:17384:9 [error] [invalid-method-override] Invalid override of method `cummax`: Definition is incompatible with `NDFrame.cummax`
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- tests/frame/test_groupby.py:488:23 [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:1108:9 [error] [type-assertion-failure] Type `Unknown` does not match asserted type `Series[int | float]`
+ tests/series/test_series.py:2496:9 [error] [no-matching-overload] No overload of bound method `pipe` matches arguments
+ tests/series/test_series.py:2524:9 [error] [no-matching-overload] No overload of bound method `pipe` matches arguments
- tests/test_groupby.py:208:11 [error] [type-assertion-failure] Type `Unknown` does not match asserted type `DataFrame`
+ tests/test_resampler.py:191:9 [error] [no-matching-overload] No overload of bound method `pipe` matches arguments
+ tests/test_resampler.py:198:9 [error] [no-matching-overload] No overload of bound method `pipe` matches arguments
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
- pytest_robotframework/_internal/utils.py:51:16 [error] [invalid-return-type] Return type does not match returned value: expected `[**P'return](**P'return) -> T`, found `_Wrapped[(...), T@decorator, P@new_fn, T@decorator]`
schemathesis (https://github.com/schemathesis/schemathesis)
- src/schemathesis/specs/openapi/adapter/parameters.py:120:12 [error] [missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
- src/schemathesis/specs/openapi/adapter/parameters.py:211:12 [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/negative/__init__.py:204:16 [error] [missing-argument] No arguments provided for required parameters `*args`, `**kwargs`
- src/schemathesis/specs/openapi/stateful/__init__.py:342:16 [error] [missing-argument] No argument provided for required parameter `*args`
scipy-stubs (https://github.com/scipy/scipy-stubs)
+ 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:20:1 [error] [type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[int | float | complex, int | float]`
+ tests/integrate/test_quad_vec.pyi:20:1 [error] [type-assertion-failure] Type `tuple[Unknown, int | float]` does not match asserted type `tuple[int | float | complex, int | float]`
- tests/integrate/test_quad_vec.pyi:21:1 [error] [type-assertion-failure] Type `float64` does not match asserted type `int | float | complex`
+ tests/integrate/test_quad_vec.pyi:21:1 [error] [type-assertion-failure] Type `Unknown` does not match asserted type `int | float | complex`
- tests/integrate/test_quad_vec.pyi:42:1 [error] [type-assertion-failure] Type `float64` does not match asserted type `floating[_32Bit]`
+ tests/integrate/test_quad_vec.pyi:42:1 [error] [type-assertion-failure] Type `Unknown` does not match asserted type `floating[_32Bit]`
- tests/integrate/test_quad_vec.pyi:83:1 [error] [type-assertion-failure] Type `tuple[float64, int | float]` does not match asserted type `tuple[complex128, int | float]`
+ tests/integrate/test_quad_vec.pyi:83:1 [error] [type-assertion-failure] Type `tuple[Unknown, int | float]` does not match asserted type `tuple[complex128, int | float]`
scrapy (https://github.com/scrapy/scrapy)
- scrapy/utils/python.py:147:38 [error] [unbound-type-variable] Type variable `_SelfT` is not bound to any outer generic context
+ tests/test_contracts.py:336: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:394:26 [error] [invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMetaMock`
+ tests/test_contracts.py:403:26 [error] [invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:431:26 [error] [invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
+ tests/test_contracts.py:462:26 [error] [invalid-argument-type] Argument is incorrect: Expected `Response`, found `ResponseMock`
spack (https://github.com/spack/spack)
- lib/spack/spack/vendor/macholib/MachOStandalone.py:25:9 [error] [invalid-method-override] Invalid override of method `createNode`: Definition is incompatible with `ObjectGraph.createNode`
starlette (https://github.com/encode/starlette)
- 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:285:32 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_cors.py:480:32 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CORSMiddleware'>`
- tests/middleware/test_middleware.py:21:36 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CustomMiddleware'>`
- tests/middleware/test_base.py:169:75 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'CustomMiddleware'>`
- tests/middleware/test_base.py:434:24 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'ContextManagerMiddleware'>`
- tests/middleware/test_base.py:638:32 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'ConsumingMiddleware'>`
- tests/middleware/test_base.py:843:32 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'ConsumingMiddleware'>`
- tests/middleware/test_gzip.py:23: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/middleware/test_gzip.py:180:32 [error] [invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `_MiddlewareFactory[(...)]`, found `<class 'GZipMiddleware'>`
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:1973:9 [error] [invalid-method-override] Invalid override of method `from_rational_expression`: Definition is incompatible with `TransferFunctionBase.from_rational_expression`
- sympy/physics/control/lti.py:1991:9 [error] [invalid-method-override] Invalid override of method `from_zpk`: Definition is incompatible with `TransferFunctionBase.from_zpk`
- sympy/vector/basisdependent.py:240:9 [error] [invalid-method-override] Invalid override of method `_new_rawargs`: Definition is incompatible with `AssocOp._new_rawargs`
trio (https://github.com/python-trio/trio)
+ src/trio/_socket.py:1034:28 [error] [missing-argument] No argument provided for required parameter 1
- src/trio/_socket.py:1142:17 [error] [invalid-assignment] Object of type `(...) -> Awaitable[int]` is not assignable to `def recv_into(self, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[int]`
+ src/trio/_socket.py:1142:17 [error] [invalid-assignment] Object of type `(_SocketType, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[int]` is not assignable to `def recv_into(self, /, buffer: Buffer, nbytes: int = 0, flags: int = 0) -> Awaitable[int]`
+ src/trio/_tests/test_path.py:218:28 [error] [missing-argument] No argument provided for required parameter `pattern`
+ src/trio/_tests/test_path.py:226:35 [error] [invalid-argument-type] Argument is incorrect: Argument type `Literal["*.txt"]` does not satisfy upper bound `Path` of type variable `PathT'return`
- src/trio/_tests/test_path.py:124:12 [error] [unresolved-attribute] Attribute `__name__` is not defined on `[PathT'return](...) -> Awaitable[PathT'return]` in union `Unknown | ([PathT'return](...) -> Awaitable[PathT'return])`
+ src/trio/_tests/test_path.py:124:12 [error] [unresolved-attribute] Attribute `__name__` 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/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: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:102:41 [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:67:34 [error] [invalid-argument-type] Argument is incorrect: Expected `Path`, found `Literal[511]`
+ src/trio/_tests/type_tests/path.py:69:23 [error] [missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:89:23 [error] [missing-argument] No argument provided for required parameter 1
+ src/trio/_tests/type_tests/path.py:96:23 [error] [missing-argument] No argument provided for required parameter 1
zulip (https://github.com/zulip/zulip)
- 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/test_runner.py:129:32 [error] [invalid-argument-type] Argument to function `process_instrumented_calls` is incorrect: Expected `(dict[str, Any], /) -> None`, found `[**P'return](**P'return) -> Any`
- zerver/webhooks/groove/view.py:93:72 [error] [invalid-assignment] Object of type `dict[str, ((WildValue, /) -> str | None) | ([**P'return](**P'return) -> str)]` is not assignable to `dict[str, (WildValue, /) -> str | None]`
- zerver/webhooks/shortcut/view.py:737:88 [error] [invalid-assignment] Object of type `dict[str, ((WildValue, WildValue, /) -> str | None) | ([**P'return](**P'return) -> str | None)]` is not assignable to `dict[str, (WildValue, WildValue, /) -> str | None]`…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 <val@physight.com>
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.
This seems similar to astral-sh/ty#491
Reference in trio: https://github.com/python-trio/trio/blob/8ecba055808f09dae9ee4b232e628696ef53eb04/src/trio/_path.py#L72-L79
|
|
||
| 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.
|
|
||
| # 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
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.