From 10c43c284f3612ad99cdaa470a84304725eefc38 Mon Sep 17 00:00:00 2001 From: Boudewijn van Groos Date: Thu, 16 Feb 2023 16:22:26 +0100 Subject: [PATCH] Fix starmap_indexed not passing index --- reactivex/operators/__init__.py | 8 ++++---- reactivex/operators/_map.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/reactivex/operators/__init__.py b/reactivex/operators/__init__.py index 0983dfa22..f62f45157 100644 --- a/reactivex/operators/__init__.py +++ b/reactivex/operators/__init__.py @@ -3228,16 +3228,16 @@ def starmap_indexed( invoking the indexed mapper function with unpacked elements of the source. """ - from ._map import map_ + from ._map import map_indexed_ if mapper is None: return compose(identity) - def starred(values: Tuple[Any, ...]) -> Any: + def starred(values: Tuple[Any, ...], i: int) -> Any: assert mapper # mypy is paranoid - return mapper(*values) + return mapper(*values, i) - return compose(map_(starred)) + return compose(map_indexed_(starred)) def start_with(*args: _T) -> Callable[[Observable[_T]], Observable[_T]]: diff --git a/reactivex/operators/_map.py b/reactivex/operators/_map.py index 48b4c0947..25009cd7d 100644 --- a/reactivex/operators/_map.py +++ b/reactivex/operators/_map.py @@ -65,7 +65,7 @@ def _identity(value: _T1, _: int) -> _T2: return compose( ops.zip_with_iterable(infinite()), - ops.starmap_indexed(_mapper_indexed), + ops.starmap(_mapper_indexed), )