Esempio n. 1
0
def buffer_when_(
    closing_mapper: Callable[[], Observable[Any]]
) -> Callable[[Observable[_T]], Observable[List[_T]]]:
    return compose(
        ops.window_when(closing_mapper),
        ops.flat_map(ops.to_list()),
    )
Esempio n. 2
0
        def create():
            def closing():
                return reactivex.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(),
            )
Esempio n. 3
0
        def create():
            def closing():
                curr = window[0]
                window[0] += 1
                return reactivex.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(),
            )