File: tomarbles.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 (11 lines) | stat: -rw-r--r-- 463 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import reactivex
from reactivex import operators as ops

source0 = reactivex.cold("a-----d---1--------4-|", timespan=0.1)
source1 = reactivex.cold("--b-c-------2---3-|   ", timespan=0.1)

print("to_marbles() is a blocking operator, we need to wait for completion...")
print('expecting  "a-b-c-d---1-2---3--4-|"')
observable = reactivex.merge(source0, source1).pipe(ops.to_marbles(timespan=0.1))
diagram = observable.run()
print('got        "{}"'.format(diagram))