def for_in(cls, sources, result_selector): """Concatenates the observable sequences obtained by running the specified result selector for each element in source. sources -- {Array} An array of values to turn into an observable sequence. result_selector -- {Function} A function to apply to each item in the sources array to turn it into an observable sequence. Returns an observable {Observable} sequence from the concatenated observable sequences.""" return Observable.concat(Enumerable.for_each(sources, result_selector))
def for_in(cls, sources, result_selector): """Concatenates the observable sequences obtained by running the specified result selector for each element in source. sources -- {Array} An array of values to turn into an observable sequence. result_selector -- {Function} A function to apply to each item in the sources array to turn it into an observable sequence. Returns an observable {Observable} sequence from the concatenated observable sequences.""" return Observable.concat(Enumerable.for_each(sources, result_selector))
def concat(cls, *args): """Concatenates all the observable sequences. 1 - res = Observable.concat(xs, ys, zs) 2 - res = Observable.concat([xs, ys, zs]) Returns an observable sequence that contains the elements of each given sequence, in sequential order. """ if isinstance(args[0], list): sources = args[0] else: sources = list(args) return concat(Enumerable.for_each(sources))
def concat(cls, *args): """Concatenates all the observable sequences. 1 - res = Observable.concat(xs, ys, zs) 2 - res = Observable.concat([xs, ys, zs]) Returns an observable sequence that contains the elements of each given sequence, in sequential order. """ if isinstance(args[0], list): sources = args[0] else: sources = list(args) return concat(Enumerable.for_each(sources))
def catch_exception(cls, *args): """Continues an observable sequence that is terminated by an exception with the next observable sequence. 1 - res = Observable.catch_exception(xs, ys, zs) 2 - res = Observable.catch_exception([xs, ys, zs]) Returns an observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. """ if args and isinstance(args[0], list): items = args[0] else: items = list(args) return catch_exception(Enumerable.for_each(items))
def catch_exception(cls, *args): """Continues an observable sequence that is terminated by an exception with the next observable sequence. 1 - res = Observable.catch_exception(xs, ys, zs) 2 - res = Observable.catch_exception([xs, ys, zs]) Returns an observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully. """ if args and isinstance(args[0], list): items = args[0] else: items = list(args) return catch_exception(Enumerable.for_each(items))
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))