def buffer_toggle_( openings: Observable[Any], closing_mapper: Callable[[Any], Observable[Any]] ) -> Callable[[Observable[_T]], Observable[List[_T]]]: return compose( ops.window_toggle(openings, closing_mapper), ops.flat_map(ops.to_list()), )
def create(): def closing(x): return reactivex.timer(x) def mapper(w, i): return w.pipe(ops.map(lambda x: str(i) + " " + str(x))) return xs.pipe( ops.window_toggle(ys, closing), ops.map_indexed(mapper), ops.merge_all(), )