Пример #1
0
        def create():
            def closing(x):
                return rx.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(),
            )
Пример #2
0
def _buffer_toggle(
    openings: Observable, closing_mapper: Callable[[Any], Observable]
) -> Callable[[Observable], Observable]:
    return pipe(ops.window_toggle(openings, closing_mapper),
                ops.flat_map(pipe(ops.to_iterable(), ops.map(list))))