File: frommarbles_flatmap.py

package info (click to toggle)
python-rx 4.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,056 kB
  • sloc: python: 39,070; javascript: 77; makefile: 24
file content (17 lines) | stat: -rw-r--r-- 531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import reactivex
from reactivex import operators as ops

a = reactivex.cold(" ---a0---a1----------------a2-|    ")
b = reactivex.cold("    ---b1---b2---|                 ")
c = reactivex.cold("             ---c1---c2---|        ")
d = reactivex.cold("                   -----d1---d2---|")
e1 = reactivex.cold("a--b--------c-----d-------|       ")

observableLookup = {"a": a, "b": b, "c": c, "d": d}

source = e1.pipe(
    ops.flat_map(lambda value: observableLookup[value]),
    ops.do_action(lambda v: print(v)),
)

source.run()