def merge(cls, *args): """Merges all the observable sequences into a single observable sequence. The scheduler is optional and if not specified, the immediate scheduler is used. 1 - merged = rx.Observable.merge(xs, ys, zs) 2 - merged = rx.Observable.merge([xs, ys, zs]) 3 - merged = rx.Observable.merge(scheduler, xs, ys, zs) 4 - merged = rx.Observable.merge(scheduler, [xs, ys, zs]) Returns the observable sequence that merges the elements of the observable sequences.""" if not args[0]: scheduler = immediate_scheduler sources = args[1:] elif isinstance(args[0], Scheduler): scheduler = args[0] sources = args[1:] else: scheduler = immediate_scheduler sources = args[:] if isinstance(sources[0], list): sources = sources[0] return Observable.from_array(sources, scheduler).merge_observable()
def merge(cls, *args): """Merges all the observable sequences into a single observable sequence. The scheduler is optional and if not specified, the immediate scheduler is used. 1 - merged = rx.Observable.merge(xs, ys, zs) 2 - merged = rx.Observable.merge([xs, ys, zs]) 3 - merged = rx.Observable.merge(scheduler, xs, ys, zs) 4 - merged = rx.Observable.merge(scheduler, [xs, ys, zs]) Returns the observable sequence that merges the elements of the observable sequences. """ if not args[0]: scheduler = immediate_scheduler sources = args[1:] elif args[0].now: scheduler = args[0] sources = args[1:] else: scheduler = immediate_scheduler sources = args[0] if isinstance(sources[0], list): sources = sources[0] return Observable.from_array(sources, scheduler).merge_observable()
def start_with(self, *args, **kw): """Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. 1 - source.start_with(1, 2, 3) 2 - source.start_with(Scheduler.timeout, 1, 2, 3) Returns the source sequence prepended with the specified values. """ scheduler = kw.get("scheduler") if not scheduler and isinstance(args[0], Scheduler): scheduler = args.pop(0) else: scheduler = immediate_scheduler sequence = [Observable.from_array(args, scheduler), self] return concat(Enumerable.for_each(sequence))
def start_with(self, *args, **kw): """Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend. 1 - source.start_with(1, 2, 3) 2 - source.start_with(Rx.Scheduler.timeout, 1, 2, 3) Returns the source sequence prepended with the specified values. """ scheduler = kw.get("scheduler") if not scheduler and isinstance(args[0], Scheduler): scheduler = args.pop(0) else: scheduler = immediate_scheduler sequence = [Observable.from_array(args, scheduler), self] return concat(Enumerable.for_each(sequence))