fix Incorrect overload selection for itertools.accumulate #2876#2947
fix Incorrect overload selection for itertools.accumulate #2876#2947asukaminato0721 wants to merge 2 commits intofacebook:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes pyrefly’s overload selection so that failed tentative overload candidates don’t leave behind solver state that biases later candidates (e.g., "{}/{}".format used with itertools.accumulate), and adjusts callable subtyping to avoid prematurely pinning inferred vars when the target callable still contains unsolved vars.
Changes:
- Add solver snapshot/restore support and use it to roll back state after failed tentative overload checks.
- Update callable subtyping to compare return types before parameters when the target callable contains inferred vars.
- Add a regression test covering
itertools.accumulatewith a boundstr.format.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
pyrefly/lib/test/overload.rs |
Adds regression test for bound-method overload behavior via itertools.accumulate. |
pyrefly/lib/solver/subset.rs |
Wraps overload candidate checks with rollback and adjusts callable subtyping comparison order when vars are present. |
pyrefly/lib/solver/solver.rs |
Introduces solver snapshot/restore (variables + instantiation errors) to support rollback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let want_has_vars = | ||
| Type::Callable(Box::new(u.clone())).may_contain_quantified_var(); | ||
| if want_has_vars { |
There was a problem hiding this comment.
want_has_vars currently builds a fresh Type::Callable(Box::new(u.clone())) just to call may_contain_quantified_var(), which allocates and clones the full callable signature. If this check is on a hot path, consider a cheaper predicate (e.g., a helper that inspects u.params/u.ret directly, or adding a Callable::may_contain_quantified_var() method) to avoid the extra clone/allocation.
|
Diff from mypy_primer, showing the effect of this PR on open source code: anyio (https://github.com/agronholm/anyio)
- ERROR src/anyio/_core/_eventloop.py:77:34-38: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run` [bad-argument-type]
+ ERROR src/anyio/_core/_eventloop.py:77:34-38: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run` [bad-argument-type]
- ERROR src/anyio/_core/_fileio.py:480:41-58: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.to_thread.run_sync` [bad-argument-type]
+ ERROR src/anyio/_core/_fileio.py:480:41-58: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> bool` in function `anyio.to_thread.run_sync` [bad-argument-type]
- ERROR src/anyio/_core/_fileio.py:522:41-57: Argument `(self: Path, *, follow_symlinks: bool = True) -> str` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.to_thread.run_sync` [bad-argument-type]
+ ERROR src/anyio/_core/_fileio.py:522:41-57: Argument `(self: Path, *, follow_symlinks: bool = True) -> str` is not assignable to parameter `func` with type `(**tuple[*@_]) -> str` in function `anyio.to_thread.run_sync` [bad-argument-type]
- ERROR src/anyio/_core/_fileio.py:551:41-58: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.to_thread.run_sync` [bad-argument-type]
+ ERROR src/anyio/_core/_fileio.py:551:41-58: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> bool` in function `anyio.to_thread.run_sync` [bad-argument-type]
- ERROR src/anyio/_core/_fileio.py:557:41-59: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.to_thread.run_sync` [bad-argument-type]
+ ERROR src/anyio/_core/_fileio.py:557:41-59: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> bool` in function `anyio.to_thread.run_sync` [bad-argument-type]
- ERROR src/anyio/_core/_fileio.py:637:41-57: Argument `(self: Path, *, follow_symlinks: bool = True) -> str` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.to_thread.run_sync` [bad-argument-type]
+ ERROR src/anyio/_core/_fileio.py:637:41-57: Argument `(self: Path, *, follow_symlinks: bool = True) -> str` is not assignable to parameter `func` with type `(**tuple[*@_]) -> str` in function `anyio.to_thread.run_sync` [bad-argument-type]
- ERROR src/anyio/from_thread.py:91:9-13: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread` [bad-argument-type]
+ ERROR src/anyio/from_thread.py:91:9-13: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval]` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval]` in function `anyio.abc._eventloop.AsyncBackend.run_async_from_thread` [bad-argument-type]
- ERROR src/anyio/from_thread.py:119:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread` [bad-argument-type]
+ ERROR src/anyio/from_thread.py:119:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> T_Retval` in function `anyio.abc._eventloop.AsyncBackend.run_sync_from_thread` [bad-argument-type]
- ERROR src/anyio/from_thread.py:378:38-42: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval] | T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[@_] | @_` in function `BlockingPortal._spawn_task_from_thread` [bad-argument-type]
+ ERROR src/anyio/from_thread.py:378:38-42: Argument `(**tuple[*PosArgsT]) -> Awaitable[T_Retval] | T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> Awaitable[T_Retval] | T_Retval` in function `BlockingPortal._spawn_task_from_thread` [bad-argument-type]
- ERROR src/anyio/to_thread.py:64:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `anyio.abc._eventloop.AsyncBackend.run_sync_in_worker_thread` [bad-argument-type]
+ ERROR src/anyio/to_thread.py:64:9-13: Argument `(**tuple[*PosArgsT]) -> T_Retval` is not assignable to parameter `func` with type `(**tuple[*@_]) -> T_Retval` in function `anyio.abc._eventloop.AsyncBackend.run_sync_in_worker_thread` [bad-argument-type]
bokeh (https://github.com/bokeh/bokeh)
+ ERROR src/bokeh/layouts.py:575:34-68: Argument `list[LayoutDOM | grid.col | grid.row]` is not assignable to parameter `children` with type `list[grid.col | grid.row]` in function `col.__init__` [bad-argument-type]
+ ERROR src/bokeh/layouts.py:575:34-68: Argument `list[LayoutDOM | grid.col | grid.row]` is not assignable to parameter `children` with type `list[grid.col | grid.row]` in function `row.__init__` [bad-argument-type]
- ERROR src/bokeh/layouts.py:575:43-51: Argument `((children: list[LayoutDOM], level: int = 0) -> grid.col | grid.row) | ((item: LayoutDOM, top_level: bool = False) -> LayoutDOM | grid.col | grid.row)` is not assignable to parameter `func` with type `(list[LayoutDOM]) -> grid.col | grid.row` in function `map.__new__` [bad-argument-type]
+ ERROR src/bokeh/layouts.py:575:43-51: Argument `((children: list[LayoutDOM], level: int = 0) -> grid.col | grid.row) | ((item: LayoutDOM, top_level: bool = False) -> LayoutDOM | grid.col | grid.row)` is not assignable to parameter `func` with type `(list[LayoutDOM]) -> LayoutDOM | grid.col | grid.row` in function `map.__new__` [bad-argument-type]
Expression (https://github.com/cognitedata/Expression)
- ERROR expression/collections/block.py:268:30-37: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*@_]) -> @_` in function `starmap` [bad-argument-type]
+ ERROR expression/collections/block.py:268:30-37: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*@_]) -> _TResult` in function `starmap` [bad-argument-type]
- ERROR expression/core/option.py:449:27-33: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> @_` in function `Option.starmap` [bad-argument-type]
+ ERROR expression/core/option.py:449:27-33: Argument `(**tuple[*_P]) -> _TResult` is not assignable to parameter `mapper` with type `(**tuple[*_P]) -> _TResult` in function `Option.starmap` [bad-argument-type]
- ERROR tests/test_array.py:47:36-50: Argument `(TypedArray[object]) -> TypedArray[str]` is not assignable to parameter `fn1` with type `(TypedArray[int]) -> @_` in function `expression.core.pipe.pipe` [bad-argument-type]
+ ERROR tests/test_array.py:47:36-50: Argument `(TypedArray[object]) -> TypedArray[str]` is not assignable to parameter `fn1` with type `(TypedArray[int]) -> TypedArray[str]` in function `expression.core.pipe.pipe` [bad-argument-type]
freqtrade (https://github.com/freqtrade/freqtrade)
+ ERROR freqtrade/data/metrics.py:333:12-40: Returned type `tuple[Series[float] | Series | float, Series[float] | Series | float]` is not assignable to declared return type `tuple[float, float]` [bad-return]
+ ERROR freqtrade/data/metrics.py:411:20-65: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/data/metrics.py:434:12-24: Returned type `Literal[-100] | Series | Unknown` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/freqtradebot.py:844:26-48: `/` is not supported between `Series[str]` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/freqtradebot.py:844:26-48: `/` is not supported between `Series[str]` and `Series` [unsupported-operation]
+ ERROR freqtrade/freqtradebot.py:844:26-48: `/` is not supported between `Series` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_max_drawdown.py:44:20-33: Returned type `Series[str] | Series` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_max_drawdown.py:45:16-57: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_max_drawdown.py:45:16-57: Returned type `Series | Unknown` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_max_drawdown_relative.py:40:24-37: Returned type `Series[str] | Series` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_max_drawdown_relative.py:43:20-33: Returned type `Series[str] | Series` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_multi_metric.py:67:25-69: `/` is not supported between `Series[str]` and `Series` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_multi_metric.py:94:32-96:10: `-` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_multi_metric.py:94:48-88: `*` is not supported between `Literal[0]` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_multi_metric.py:94:48-88: `*` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_onlyprofit.py:26:16-33: `*` is not supported between `Literal[-1]` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_onlyprofit.py:26:16-33: Returned type `Series | int` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_profit_drawdown.py:36:16-38:10: Returned type `Series | Unknown` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_profit_drawdown.py:37:13-92: `-` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_profit_drawdown.py:37:29-69: `*` is not supported between `Literal[0]` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_profit_drawdown.py:37:29-69: `*` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_short_trade_dur.py:49:34-68: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/hyperopt_loss/hyperopt_loss_short_trade_dur.py:52:16-22: Returned type `Series | Unknown` is not assignable to declared return type `float` [bad-return]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:87:20-65: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:89:21-66: `+` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:93:21-56: `/` is not supported between `Series[str]` and `Series` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:128:65-78: Argument `Series | float` is not assignable to parameter `final_balance` with type `float` in function `freqtrade.data.metrics.calculate_cagr` [bad-argument-type]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:273:21-56: `/` is not supported between `Series[str]` and `Series` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:560:21-56: `/` is not supported between `Series[str]` and `Series` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:582:25-68: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/optimize/optimize_reports/optimize_reports.py:583:30-99: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/rpc/rpc.py:1523:45-55: Argument `Series[str] | Series | int` is not assignable to parameter `x` with type `Buffer | SupportsIndex | SupportsInt | SupportsTrunc | str` in function `int.__new__` [bad-argument-type]
+ ERROR freqtrade/templates/sample_hyperopt_loss.py:54:34-68: `/` is not supported between `Series[str]` and `float` [unsupported-operation]
+ ERROR freqtrade/templates/sample_hyperopt_loss.py:57:16-22: Returned type `Series | Unknown` is not assignable to declared return type `float` [bad-return]
more-itertools (https://github.com/more-itertools/more-itertools)
- ERROR more_itertools/more.py:950:22-25: Argument `type[map]` is not assignable to parameter `func` with type `((Any) -> Unknown, Iterable[Any], Iterable[Any]) -> @_` in function `map.__new__` [bad-argument-type]
+ ERROR more_itertools/more.py:950:22-25: Argument `type[map]` is not assignable to parameter `func` with type `((Any) -> Unknown, Iterable[Any], Iterable[Any]) -> map[Unknown]` in function `map.__new__` [bad-argument-type]
pwndbg (https://github.com/pwndbg/pwndbg)
- ERROR pwndbg/commands/onegadget.py:27:1-63: Argument `(((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) -> (show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) | ((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None)` is not assignable to parameter with type `((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) -> (show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None` [bad-argument-type]
+ ERROR pwndbg/commands/onegadget.py:27:1-63: Argument `(((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) -> (show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) | ((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None)` is not assignable to parameter with type `((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) -> ((show_unsat: bool = False, no_unknown: bool = False, verbose: bool = False) -> None) | None` [bad-argument-type]
setuptools (https://github.com/pypa/setuptools)
- ERROR setuptools/_vendor/more_itertools/more.py:917:22-25: Argument `type[map]` is not assignable to parameter `func` with type `((Any) -> Unknown, Iterable[Any], Iterable[Any]) -> @_` in function `map.__new__` [bad-argument-type]
+ ERROR setuptools/_vendor/more_itertools/more.py:917:22-25: Argument `type[map]` is not assignable to parameter `func` with type `((Any) -> Unknown, Iterable[Any], Iterable[Any]) -> map[Unknown]` in function `map.__new__` [bad-argument-type]
steam.py (https://github.com/Gobot1234/steam.py)
+ ERROR steam/ext/tf2/currency.py:91:18-45: Object of class `int` has no attribute `as_tuple` [missing-attribute]
schemathesis (https://github.com/schemathesis/schemathesis)
- ERROR src/schemathesis/specs/openapi/adapter/parameters.py:1139:45-60: Argument `(value: dict[str, Any]) -> dict[str, Any]` is not assignable to parameter `pack` with type `(GeneratedValue) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/openapi/adapter/parameters.py:1139:45-60: Argument `(value: dict[str, Any]) -> dict[str, Any]` is not assignable to parameter `pack` with type `(GeneratedValue) -> dict[str, Any]` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
- ERROR src/schemathesis/specs/openapi/adapter/parameters.py:1152:45-74: Argument `(value: dict[str, Any]) -> dict[str, Any]` is not assignable to parameter `pack` with type `(GeneratedValue) -> @_` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
+ ERROR src/schemathesis/specs/openapi/adapter/parameters.py:1152:45-74: Argument `(value: dict[str, Any]) -> dict[str, Any]` is not assignable to parameter `pack` with type `(GeneratedValue) -> dict[str, Any]` in function `hypothesis.strategies._internal.strategies.SearchStrategy.map` [bad-argument-type]
pip (https://github.com/pypa/pip)
- ERROR src/pip/_vendor/rich/text.py:1285:16-27: Returned type `Literal[1] | SupportsIndex` is not assignable to declared return type `int` [bad-return]
openlibrary (https://github.com/internetarchive/openlibrary)
- ERROR openlibrary/core/imports.py:144:24-34: Argument `type[ImportItem]` is not assignable to parameter `func` with type `(@_) -> @_` in function `map.__new__` [bad-argument-type]
+ ERROR openlibrary/core/imports.py:144:24-34: Argument `type[ImportItem]` is not assignable to parameter `func` with type `(@_) -> ImportItem` in function `map.__new__` [bad-argument-type]
egglog-python (https://github.com/egraphs-good/egglog-python)
- ERROR python/egglog/thunk.py:50:20-49: Argument `Unresolved[@_, *TS]` is not assignable to parameter `state` with type `Error | Resolved[@_] | Resolving | Unresolved[@_, *TS]` in function `Thunk.__init__` [bad-argument-type]
+ ERROR python/egglog/thunk.py:50:20-49: Argument `Unresolved[T, *TS]` is not assignable to parameter `state` with type `Error | Resolved[T] | Resolving | Unresolved[T, *TS]` in function `Thunk.__init__` [bad-argument-type]
- ERROR python/egglog/thunk.py:50:31-33: Argument `(**tuple[*TS]) -> T` is not assignable to parameter `fn` with type `(**tuple[*TS]) -> @_` in function `Unresolved.__init__` [bad-argument-type]
+ ERROR python/egglog/thunk.py:50:31-33: Argument `(**tuple[*TS]) -> T` is not assignable to parameter `fn` with type `(**tuple[*TS]) -> T` in function `Unresolved.__init__` [bad-argument-type]
antidote (https://github.com/Finistere/antidote)
- ERROR tests/core/test_inject.py:549:13-27: Argument `() -> object` is not assignable to parameter `__arg` with type `(Any, ParamSpec(@_)) -> @_` in function `antidote.core.Inject.method` [bad-argument-type]
+ ERROR tests/core/test_inject.py:549:13-27: Argument `() -> object` is not assignable to parameter `__arg` with type `(Any, ParamSpec(@_)) -> object` in function `antidote.core.Inject.method` [bad-argument-type]
aiohttp (https://github.com/aio-libs/aiohttp)
- ERROR aiohttp/cookiejar.py:410:37-80: No matching overload found for function `itertools.accumulate.__new__` called with arguments: (type[accumulate[_T]], list[str], Overload[
- (self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString
- (self: LiteralString, *args: object, **kwargs: object) -> str
- ]) [no-matching-overload]
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
+ ERROR tests/series/test_agg.py:26:22-44: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:26:34-36: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:27:22-46: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:27:36-38: No matching overload found for function `pandas.core.series.Series.median` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:28:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:28:33-35: No matching overload found for function `pandas.core.series.Series.std` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:29:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:29:33-35: No matching overload found for function `pandas.core.series.Series.var` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:34:22-44: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:34:34-36: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:35:22-46: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:35:36-38: No matching overload found for function `pandas.core.series.Series.median` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:36:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:36:33-35: No matching overload found for function `pandas.core.series.Series.std` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:37:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:37:33-35: No matching overload found for function `pandas.core.series.Series.var` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:42:22-44: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:42:34-36: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:43:22-46: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:43:36-38: No matching overload found for function `pandas.core.series.Series.median` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:44:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:44:33-35: No matching overload found for function `pandas.core.series.Series.std` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:45:22-43: assert_type(Unknown, float) failed [assert-type]
+ ERROR tests/series/test_agg.py:45:33-35: No matching overload found for function `pandas.core.series.Series.var` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:52:22-46: assert_type(Unknown, complex) failed [assert-type]
+ ERROR tests/series/test_agg.py:52:34-36: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:97:22-51: assert_type(Unknown, Timedelta) failed [assert-type]
+ ERROR tests/series/test_agg.py:97:34-36: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:98:22-53: assert_type(Unknown, Timedelta) failed [assert-type]
+ ERROR tests/series/test_agg.py:98:36-38: No matching overload found for function `pandas.core.series.Series.median` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_agg.py:99:22-50: assert_type(Unknown, Timedelta) failed [assert-type]
+ ERROR tests/series/test_agg.py:99:33-35: No matching overload found for function `pandas.core.series.Series.std` called with arguments: () [no-matching-overload]
+ ERROR tests/series/test_cumul.py:35:20-60: assert_type(Series[Series | complex], Series[complex]) failed [assert-type]
bandersnatch (https://github.com/pypa/bandersnatch)
- ERROR src/bandersnatch/mirror.py:814:70-81: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
+ ERROR src/bandersnatch/mirror.py:814:70-81: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `func` with type `(**tuple[*@_]) -> bool` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
hydpy (https://github.com/hydpy-dev/hydpy)
+ ERROR hydpy/core/seriestools.py:326:31-36: Argument `Index` is not assignable to parameter `date` with type `Date | datetime | str` in function `hydpy.core.timetools.Date.__new__` [bad-argument-type]
pandas (https://github.com/pandas-dev/pandas)
- ERROR pandas/core/computation/align.py:86:12-19: Returned type `(terms: Unknown) -> tuple[partial[Unknown] | type[NDFrame], dict[str, Index] | None] | tuple[Unknown, None] | Unknown` is not assignable to declared return type `(F) -> F` [bad-return]
+ ERROR pandas/core/computation/align.py:86:12-19: Returned type `(terms: Unknown) -> tuple[dtype | Unknown, None] | tuple[partial[Unknown] | type[NDFrame], dict[str, Index] | None] | Unknown` is not assignable to declared return type `(F) -> F` [bad-return]
- ERROR pandas/core/computation/common.py:46:36-60: No matching overload found for function `pandas.core.dtypes.cast.find_common_type` called with arguments: (list[_Buffer | _HasDType[dtype] | _HasNumPyDType[dtype] | _NestedSequence[bytes | complex | str] | _NestedSequence[_SupportsArray[dtype]] | _SupportsArray[dtype] | bytes | complex | dtype | list[Any] | str | _DTypeDict | tuple[Any, Any] | type[Any] | Unknown | None]) [no-matching-overload]
- ERROR pandas/core/computation/expr.py:172:9-173:41: Argument `Generator[object]` is not assignable to parameter `iterable` with type `Iterable[_Token]` in function `tokenize.untokenize` [bad-argument-type]
+ ERROR pandas/core/computation/expr.py:172:9-173:41: Argument `Generator[object | Unknown]` is not assignable to parameter `iterable` with type `Iterable[_Token]` in function `tokenize.untokenize` [bad-argument-type]
+ ERROR pandas/core/computation/ops.py:266:27-28: Argument `type[bool] | dtype | Unknown` is not assignable to parameter `cls` with type `type` in function `issubclass` [bad-argument-type]
pytest-robotframework (https://github.com/detachhead/pytest-robotframework)
- ERROR tests/type_tests.py:64:5-40: Argument `() -> None` is not assignable to parameter `fn` with type `() -> AbstractContextManager[@_]` in function `pytest_robotframework._WrappedContextManagerKeywordDecorator.__call__` [bad-argument-type]
+ ERROR tests/type_tests.py:64:5-40: Argument `() -> None` is not assignable to parameter `fn` with type `(ParamSpec(@_)) -> AbstractContextManager[@_]` in function `pytest_robotframework._WrappedContextManagerKeywordDecorator.__call__` [bad-argument-type]
mypy (https://github.com/python/mypy)
- ERROR mypy/typeshed/stdlib/builtins.pyi:227:5-17: Argument `(metacls: Self@type, name: str, bases: tuple[type[Any], ...], /, **kwds: Any) -> MutableMapping[str, object]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:227:5-17: Argument `(metacls: Self@type, name: str, bases: tuple[type[Any], ...], /, **kwds: Any) -> MutableMapping[str, object]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> MutableMapping[str, object]` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:277:9-21: Argument `(cls: Self@int, bytes: Buffer | Iterable[SupportsIndex] | SupportsBytes, byteorder: Literal['big', 'little'] = 'big', *, signed: bool = False) -> Self@int` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:277:9-21: Argument `(cls: Self@int, bytes: Buffer | Iterable[SupportsIndex] | SupportsBytes, byteorder: Literal['big', 'little'] = 'big', *, signed: bool = False) -> Self@int` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> Self@int` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:370:5-17: Argument `(cls: Self@float, string: str, /) -> Self@float` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:370:5-17: Argument `(cls: Self@float, string: str, /) -> Self@float` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> Self@float` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:640:9-21: Argument `(cls: Self@bytes, string: str, /) -> Self@bytes` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:640:9-21: Argument `(cls: Self@bytes, string: str, /) -> Self@bytes` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> Self@bytes` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:750:9-21: Argument `(cls: Self@bytearray, string: str, /) -> Self@bytearray` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:750:9-21: Argument `(cls: Self@bytearray, string: str, /) -> Self@bytearray` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> Self@bytearray` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:1117:5-17: Argument `(cls: Self@mypy.typeshed.stdlib.builtins.dict, iterable: Iterable[_T], value: None = None, /) -> builtins.dict[_T, Any | None]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:1117:5-17: Argument `(cls: Self@mypy.typeshed.stdlib.builtins.dict, iterable: Iterable[_T], value: None = None, /) -> builtins.dict[_T, Any | None]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> builtins.dict[_T, Any | None]` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:1119:9-17: `fromkeys` has type `classmethod[Unknown, Ellipsis, Unknown]` after decorator application, which is not callable [invalid-overload]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:1119:9-17: `fromkeys` has type `classmethod[Unknown, Ellipsis, dict[_T, Any | None]]` after decorator application, which is not callable [invalid-overload]
- ERROR mypy/typeshed/stdlib/builtins.pyi:1120:5-17: Argument `(cls: Self@mypy.typeshed.stdlib.builtins.dict, iterable: Iterable[_T], value: _S, /) -> builtins.dict[_T, _S]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> @_` in function `classmethod.__init__` [bad-argument-type]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:1120:5-17: Argument `(cls: Self@mypy.typeshed.stdlib.builtins.dict, iterable: Iterable[_T], value: _S, /) -> builtins.dict[_T, _S]` is not assignable to parameter `f` with type `(type[@_], ParamSpec(@_)) -> builtins.dict[_T, _S]` in function `classmethod.__init__` [bad-argument-type]
- ERROR mypy/typeshed/stdlib/builtins.pyi:1122:9-17: `fromkeys` has type `classmethod[@_, @_, @_]` after decorator application, which is not callable [invalid-overload]
+ ERROR mypy/typeshed/stdlib/builtins.pyi:1122:9-17: `fromkeys` has type `classmethod[@_, @_, dict[_T, _S]]` after decorator application, which is not callable [invalid-overload]
werkzeug (https://github.com/pallets/werkzeug)
- ERROR tests/test_utils.py:285:5-27: Argument `() -> Literal[42]` is not assignable to parameter `fget` with type `(Any) -> @_` in function `werkzeug.utils.cached_property.__init__` [bad-argument-type]
+ ERROR tests/test_utils.py:285:5-27: Argument `() -> Literal[42]` is not assignable to parameter `fget` with type `(Any) -> int` in function `werkzeug.utils.cached_property.__init__` [bad-argument-type]
rich (https://github.com/Textualize/rich)
- ERROR rich/text.py:1287:16-27: Returned type `Literal[1] | SupportsIndex` is not assignable to declared return type `int` [bad-return]
core (https://github.com/home-assistant/core)
- ERROR homeassistant/components/backup/backup.py:101:56-74: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> @_` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
+ ERROR homeassistant/components/backup/backup.py:101:56-74: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> bool` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
- ERROR homeassistant/components/image_upload/__init__.py:223:54-73: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> @_` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
+ ERROR homeassistant/components/image_upload/__init__.py:223:54-73: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> bool` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
- ERROR homeassistant/components/media_source/local_source.py:305:49-67: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> @_` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
+ ERROR homeassistant/components/media_source/local_source.py:305:49-67: Argument `(self: Path, *, follow_symlinks: bool = True) -> bool` is not assignable to parameter `target` with type `(**tuple[*@_]) -> bool` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
- ERROR homeassistant/components/panasonic_viera/__init__.py:251:62-66: Argument `(**tuple[*_Ts]) -> _R` is not assignable to parameter `target` with type `(**tuple[*@_]) -> @_` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
+ ERROR homeassistant/components/panasonic_viera/__init__.py:251:62-66: Argument `(**tuple[*_Ts]) -> _R` is not assignable to parameter `target` with type `(**tuple[*@_]) -> _R` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
- ERROR homeassistant/components/rfxtrx/entity.py:123:48-51: Argument `(**tuple[Unknown, *_Ts]) -> None` is not assignable to parameter `target` with type `(**tuple[*@_]) -> @_` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
+ ERROR homeassistant/components/rfxtrx/entity.py:123:48-51: Argument `(**tuple[Unknown, *_Ts]) -> None` is not assignable to parameter `target` with type `(**tuple[*@_]) -> None` in function `homeassistant.core.HomeAssistant.async_add_executor_job` [bad-argument-type]
- ERROR homeassistant/core.py:842:48-54: Argument `(**tuple[*_Ts]) -> _T` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
+ ERROR homeassistant/core.py:842:48-54: Argument `(**tuple[*_Ts]) -> _T` is not assignable to parameter `func` with type `(**tuple[*@_]) -> _T` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
- ERROR homeassistant/core.py:859:64-70: Argument `(**tuple[*_Ts]) -> _T` is not assignable to parameter `func` with type `(**tuple[*@_]) -> @_` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
+ ERROR homeassistant/core.py:859:64-70: Argument `(**tuple[*_Ts]) -> _T` is not assignable to parameter `func` with type `(**tuple[*@_]) -> _T` in function `asyncio.events.AbstractEventLoop.run_in_executor` [bad-argument-type]
trio (https://github.com/python-trio/trio)
- ERROR src/trio/_tests/test_signals.py:73:38-57: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, None]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[@_], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
+ ERROR src/trio/_tests/test_signals.py:73:38-57: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, None]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[Unknown | None], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
- ERROR src/trio/_tests/test_threads.py:921:44-86: Unpacked argument `tuple[() -> Task]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> @_, *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
+ ERROR src/trio/_tests/test_threads.py:921:44-86: Unpacked argument `tuple[() -> Task]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Task, *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
- ERROR src/trio/_tests/test_threads.py:922:44-81: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, Task]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[@_], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
+ ERROR src/trio/_tests/test_threads.py:922:44-81: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, Task]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[Task], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
- ERROR src/trio/_tests/test_threads.py:931:31-72: Unpacked argument `tuple[() -> int]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> @_, *Unknown]` in function `trio._threads.from_thread_run` [bad-argument-type]
- ERROR src/trio/_tests/test_threads.py:990:33-67: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, None]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[@_], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
+ ERROR src/trio/_tests/test_threads.py:990:33-67: Unpacked argument `tuple[() -> Coroutine[Unknown, Unknown, None]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[Unknown | None], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
- ERROR src/trio/_tests/test_threads.py:1121:37-89: Unpacked argument `tuple[(seconds: float) -> Coroutine[Unknown, Unknown, None], Literal[0]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[@_], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
+ ERROR src/trio/_tests/test_threads.py:1121:37-89: Unpacked argument `tuple[(seconds: float) -> Coroutine[Unknown, Unknown, None], Literal[0]]` is not assignable to parameter `*args` with type `tuple[(**tuple[*Unknown]) -> Awaitable[Unknown | None], *Unknown]` in function `trio._threads.to_thread_run_sync` [bad-argument-type]
xarray (https://github.com/pydata/xarray)
- ERROR xarray/core/groupby.py:544:28-37: Object of class `bytes` has no attribute `data`
- Object of class `complex` has no attribute `data`
- Object of class `str` has no attribute `data` [missing-attribute]
- ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Any]` is not assignable to parameter `indexers` with type `Mapping[Any, Any] | None` in function `xarray.core.dataarray.DataArray.reindex` [bad-argument-type]
+ ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Index]` is not assignable to parameter `indexers` with type `Mapping[Any, Any] | None` in function `xarray.core.dataarray.DataArray.reindex` [bad-argument-type]
- ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Any]` is not assignable to parameter `labels` with type `ExtensionArray | Index | SequenceNotStr[Any] | Series | ndarray | range | None` in function `pandas.core.frame.DataFrame.reindex` [bad-argument-type]
+ ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Index]` is not assignable to parameter `labels` with type `ExtensionArray | Index | SequenceNotStr[Any] | Series | ndarray | range | None` in function `pandas.core.frame.DataFrame.reindex` [bad-argument-type]
- ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Any]` is not assignable to parameter `index` with type `ExtensionArray | Index | SequenceNotStr[Any] | Series | ndarray | range | None` in function `pandas.core.series.Series.reindex` [bad-argument-type]
+ ERROR xarray/tests/test_dataset.py:574:57-73: Argument `Iterator[Index]` is not assignable to parameter `index` with type `ExtensionArray | Index | SequenceNotStr[Any] | Series | ndarray | range | None` in function `pandas.core.series.Series.reindex` [bad-argument-type]
spark (https://github.com/apache/spark)
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:204:47-49: No matching overload found for function `pandas.core.series.Series.mean` called with arguments: () [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:206:45-47: No matching overload found for function `pandas.core.series.Series.var` called with arguments: () [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:207:51-59: No matching overload found for function `pandas.core.series.Series.var` called with arguments: (ddof=Literal[0]) [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:208:51-59: No matching overload found for function `pandas.core.series.Series.var` called with arguments: (ddof=Literal[2]) [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:209:45-47: No matching overload found for function `pandas.core.series.Series.std` called with arguments: () [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:210:51-59: No matching overload found for function `pandas.core.series.Series.std` called with arguments: (ddof=Literal[0]) [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/computation/test_stats.py:211:51-59: No matching overload found for function `pandas.core.series.Series.std` called with arguments: (ddof=Literal[2]) [no-matching-overload]
+ ERROR python/pyspark/pandas/tests/series/test_compute.py:155:63-67: No matching overload found for function `pandas.core.series.Series.diff` called with arguments: (Literal[-1]) [no-matching-overload]
- ERROR python/pyspark/pandas/tests/series/test_cumulative.py:31:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
+ ERROR python/pyspark/pandas/tests/series/test_cumulative.py:31:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[Series[str] | Series | float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
- ERROR python/pyspark/pandas/tests/series/test_cumulative.py:44:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
+ ERROR python/pyspark/pandas/tests/series/test_cumulative.py:44:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[Series[str] | Series | float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
- ERROR python/pyspark/pandas/tests/series/test_cumulative.py:57:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
+ ERROR python/pyspark/pandas/tests/series/test_cumulative.py:57:41-43: Argument `Series[float | None]` is not assignable to parameter `self` with type `SupportsGetItem[Scalar, _SupportsAdd[Series[str] | Series | float]]` in function `pandas.core.series.Series.sum` [bad-argument-type]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py:1028:17-42: `+=` is not supported between `int` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py:1046:17-42: `+=` is not supported between `int` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py:1354:17-49: `+=` is not supported between `int` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_grouped_map.py:1455:17-42: `+=` is not supported between `int` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:551:17-38: `+=` is not supported between `int` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:552:20-25: Returned type `Series | int` is not assignable to declared return type `int` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:940:17-40: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:942:20-53: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:972:17-41: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:973:20-64: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:997:17-38: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:998:20-25: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:1006:17-33: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_grouped_agg.py:1007:20-25: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py:397:17-40: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py:399:20-53: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py:420:17-41: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/pandas/test_pandas_udf_typehints.py:421:20-64: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
+ ERROR python/pyspark/sql/tests/test_udf_profiler.py:551:17-35: `+=` is not supported between `float` and `Series[str]` [unsupported-operation]
+ ERROR python/pyspark/sql/tests/test_udf_profiler.py:553:20-53: Returned type `Series | float` is not assignable to declared return type `float` [bad-return]
- ERROR python/pyspark/sql/types.py:2760:25-2768:26: Argument `Generator[DataType]` is not assignable to parameter `iterable` with type `Iterable[StructType]` in function `functools.reduce` [bad-argument-type]
attrs (https://github.com/python-attrs/attrs)
- ERROR tests/test_converters.py:25:23-26: Argument `type[int]` is not assignable to parameter `converter` with type `(ConvertibleToInt, AttrsInstance, Attribute[Unknown]) -> @_` in function `attr.Converter.__init__` [bad-argument-type]
+ ERROR tests/test_converters.py:25:23-26: Argument `type[int]` is not assignable to parameter `converter` with type `(ConvertibleToInt, AttrsInstance, Attribute[Unknown]) -> int` in function `attr.Converter.__init__` [bad-argument-type]
- ERROR tests/test_converters.py:104:23-30: Argument `(_: Unknown, __: Unknown, ___: Unknown) -> float` is not assignable to parameter `converter` with type `(Unknown) -> @_` in function `attr.Converter.__init__` [bad-argument-type]
+ ERROR tests/test_converters.py:104:23-30: Argument `(_: Unknown, __: Unknown, ___: Unknown) -> float` is not assignable to parameter `converter` with type `(Unknown) -> float` in function `attr.Converter.__init__` [bad-argument-type]
prefect (https://github.com/PrefectHQ/prefect)
- ERROR src/prefect/server/database/_migrations/env.py:190:35-52: Argument `(connection: AsyncEngine) -> None` is not assignable to parameter with type `(Connection, ParamSpec(@_)) -> @_` in function `sqlalchemy.ext.asyncio.engine.AsyncConnection.run_sync` [bad-argument-type]
+ ERROR src/prefect/server/database/_migrations/env.py:190:35-52: Argument `(connection: AsyncEngine) -> None` is not assignable to parameter with type `(Connection, ParamSpec(@_)) -> None` in function `sqlalchemy.ext.asyncio.engine.AsyncConnection.run_sync` [bad-argument-type]
jax (https://github.com/google/jax)
+ ERROR jax/_src/pallas/mosaic/interpret/interpret_pallas_call.py:2032:53-67: Argument `DynamicGridDim | int | Unknown` is not assignable to parameter `y` with type `Array | builtins.bool | numpy.bool | complex | float | int | ndarray | number` in function `jax.numpy.BinaryUfunc.__call__` [bad-argument-type]
scipy-stubs (https://github.com/scipy/scipy-stubs)
+ ERROR tests/sparse/test_construct.pyi:291:12-130: assert_type(coo_array[_Numeric, tuple[int, int]] | coo_matrix, coo_array[floating[_32Bit], tuple[int, int]] | coo_matrix[floating[_32Bit]]) failed [assert-type]
|
Primer Diff Classification❌ 9 regression(s) | ✅ 2 improvement(s) | ➖ 18 neutral | 29 project(s) total | +153, -61 errors 9 regression(s) across bokeh, freqtrade, steam.py, openlibrary, pandas-stubs, hydpy, spark, jax, scipy-stubs. error kinds:
Detailed analysis❌ Regression (9)bokeh (+2, -1)
freqtrade (+30)
Per-category reasoning:
steam.py (+1)
openlibrary (+1, -1)
pandas-stubs (+33)
Per-category reasoning:
hydpy (+1)
spark (+31, -4)
Per-category reasoning:
jax (+1)
scipy-stubs (+1)
✅ Improvement (2)pip (-1)
rich (-1)
➖ Neutral (18)anyio (+10, -10)
Expression (+3, -3)
more-itertools (+1, -1)
pwndbg (+1, -1)
setuptools (+1, -1)
schemathesis (+2, -2)
egglog-python (+2, -2)
antidote (+1, -1)
bandersnatch (+1, -1)
pandas (+3, -3)
pytest-robotframework (+1, -1)
mypy (+9, -9)
werkzeug (+1, -1)
core (+7, -7)
Note: One location (homeassistant/components/media_source/local_source.py:305) has a real bug —
trio (+5, -6)
xarray (+1, -1)
attrs (+2, -2)
prefect (+1, -1)
Suggested fixesSummary: The PR's change to check return type before parameters when the target callable has inference variables fixes itertools.accumulate but breaks overload resolution for pandas operations and other generic callables, causing 97+ pyrefly-only false positives across 7 projects. 1. In the
2. Alternative approach: In the
Was this helpful? React with 👍 or 👎 Classification by primer-classifier (9 heuristic, 20 LLM) |
Summary
Fixes #2876
when matching a generic callable target that still has inference vars, Pyrefly now checks the return type before the parameter list
Test Plan
add test