Exemple #1
0
 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())
Exemple #2
0
 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(),
     )
Exemple #3
0
 def create():
     return xs.pipe(ops.to_iterable())
Exemple #4
0
 def create():
     return xs.pipe(
         ops.to_iterable(),
         ops.map(list),
     )
Exemple #5
0
 def test_run_range_to_iterable(self):
     result = reactivex.range(42).pipe(ops.to_iterable()).run()
     assert list(result) == list(range(42))
Exemple #6
0
def _group_to_batch(group: GroupedObservable):
    return group.pipe(ops.to_iterable(), ops.map(list),
                      ops.map(_create_batch(group)))
Exemple #7
0
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)))