def _scan(source): if isinstance(source, rs.MuxObservable): return scan_mux(accumulator, seed, reduce)(source) else: _seed = seed() if callable(seed) else seed if reduce is False: return rx.pipe( ops.scan(accumulator, _seed), ops.default_if_empty(default_value=_seed), )(source) else: return rx.pipe( ops.scan(accumulator, _seed), ops.last_or_default(default_value=_seed), )(source)
def create(): return xs.pipe(ops.default_if_empty(-1))
def create(): return xs.pipe(ops.default_if_empty(-1))
import rx import rx.operators as ops empty = rx.empty() empty.pipe(ops.default_if_empty("default")).subscribe( on_next=lambda i: print("on_next {}".format(i)), on_error=lambda e: print("on_error: {}".format(e)), on_completed=lambda: print("on_completed"))
"""Error Handling""" op.catch() op.retry() """Utility""" op.delay() op.materialize() op.time_interval() op.timeout() op.timestamp() """Conditional and Boolean""" op.all() op.contains() op.default_if_empty() op.sequence_equal() op.skip_until() op.skip_while() op.take_until() op.take_while() """Connectable""" op.publish() op.ref_count() op.replay() """Combining""" op.combine_latest() op.merge() op.start_with()