def _window_to_group(self, value): return value.pipe( ops.to_iterable(), ops.map( lambda x: rx.from_iterable(x).pipe(ops.group_by( _group_by), ops.map(_group_to_batch), ops.merge_all())), ops.merge_all())
def action1(scheduler, state): xs[0] = reactivex.from_iterable( ["alpha", "apple", "beta", "bat", "gamma"] ).pipe( ops.group_by(lambda s: s[0]), ops.map(lambda xs: xs.pipe(ops.to_iterable(), ops.map(list))), ops.merge_all(), )
def create(): return xs.pipe(ops.to_iterable())
def create(): return xs.pipe( ops.to_iterable(), ops.map(list), )
def test_run_range_to_iterable(self): result = reactivex.range(42).pipe(ops.to_iterable()).run() assert list(result) == list(range(42))
def _group_to_batch(group: GroupedObservable): return group.pipe(ops.to_iterable(), ops.map(list), ops.map(_create_batch(group)))
import reactivex import reactivex.operators as ops """ Use a dictionnary to convert elements declared in the marbles diagram to the specified values. """ lookup0 = {"a": 1, "b": 3, "c": 5} lookup1 = {"x": 2, "y": 4, "z": 6} source0 = reactivex.cold("a---b----c----|", timespan=0.01, lookup=lookup0) source1 = reactivex.cold("---x---y---z--|", timespan=0.01, lookup=lookup1) observable = reactivex.merge(source0, source1).pipe(ops.to_iterable()) elements = observable.run() print("received {}".format(list(elements)))