本文整理汇总了Python中rx.core.Observable.concat方法的典型用法代码示例。如果您正苦于以下问题:Python Observable.concat方法的具体用法?Python Observable.concat怎么用?Python Observable.concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.core.Observable
的用法示例。
在下文中一共展示了Observable.concat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_while
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import concat [as 别名]
def do_while(self, condition):
"""Repeats source as long as condition holds emulating a do while loop.
Keyword arguments:
condition -- {Function} The condition which determines if the source
will be repeated.
Returns an observable {Observable} sequence which is repeated as long
as the condition holds.
"""
return Observable.concat([self, Observable.while_do(condition, self)])
示例2: repeat
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import concat [as 别名]
def repeat(self, repeat_count=None):
"""Repeats the observable sequence a specified number of times. If the
repeat count is not specified, the sequence repeats indefinitely.
1 - repeated = source.repeat()
2 - repeated = source.repeat(42)
Keyword arguments:
repeat_count -- Number of times to repeat the sequence. If not
provided, repeats the sequence indefinitely.
Returns the observable sequence producing the elements of the given
sequence repeatedly."""
return Observable.concat(Enumerable.repeat(self, repeat_count))
示例3: while_do
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import concat [as 别名]
def while_do(cls, condition, source):
"""Repeats source as long as condition holds emulating a while loop.
Keyword arguments:
:param types.FunctionType condition: The condition which determines if the
source will be repeated.
:param Observable source: The observable sequence that will be run if the
condition function returns true.
:returns: An observable sequence which is repeated as long as the condition
holds.
:rtype: Observable
"""
source = Observable.from_future(source)
return Observable.concat(Enumerable.while_do(condition, source))
示例4: concat
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import concat [as 别名]
def concat(self, *args):
"""Concatenates all the observable sequences. This takes in either an
array or variable arguments to concatenate.
1 - concatenated = xs.concat(ys, zs)
2 - concatenated = xs.concat([ys, zs])
Returns an observable sequence that contains the elements of each given
sequence, in sequential order.
"""
if isinstance(args[0], list):
items = args[0]
else:
items = list(args)
items.insert(0, self)
return Observable.concat(items)
示例5: start_with
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import concat [as 别名]
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.
"""
if isinstance(args[0], Scheduler):
scheduler = args[0]
args = args[1:]
else:
scheduler = kw.get("scheduler", immediate_scheduler)
sequence = [Observable.from_(args, scheduler), self]
return Observable.concat(sequence)