Skip to content

Commit

Permalink
Fix starmap_indexed not passing index
Browse files Browse the repository at this point in the history
  • Loading branch information
Boudewijn26 authored and MainRo committed Nov 13, 2024
1 parent acfba97 commit 10c43c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions reactivex/operators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
2 changes: 1 addition & 1 deletion reactivex/operators/_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)


Expand Down

0 comments on commit 10c43c2

Please sign in to comment.