def create(): def closing(): return rx.throw(ex) def mapper(w, i): return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x))) return xs.pipe( ops.window_when(closing), ops.map_indexed(mapper), ops.merge_all(), )
def create(): def closing(): curr = window[0] window[0] += 1 return rx.timer(curr * 100) def mapper(w, i): return w.pipe(ops.map(lambda x: str(i) + ' ' + str(x))) return xs.pipe( ops.window_when(closing), ops.map_indexed(mapper), ops.merge_all(), )
def _buffer_when( closing_mapper: Callable[[], Observable] ) -> Callable[[Observable], Observable]: return pipe(ops.window_when(closing_mapper), ops.flat_map(pipe(ops.to_iterable(), ops.map(list))))