当前位置: 首页>>代码示例>>Python>>正文


Python Observable.throw方法代码示例

本文整理汇总了Python中rx.observable.Observable.throw方法的典型用法代码示例。如果您正苦于以下问题:Python Observable.throw方法的具体用法?Python Observable.throw怎么用?Python Observable.throw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.observable.Observable的用法示例。


在下文中一共展示了Observable.throw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: timeoutAbsolute

# 需要导入模块: from rx.observable import Observable [as 别名]
# 或者: from rx.observable.Observable import throw [as 别名]
def timeoutAbsolute(self, dueTime, other=None, scheduler=Scheduler.timeBasedOperation):
  assert isinstance(self, Observable)
  assert isinstance(scheduler, Scheduler)

  if other == None:
    other = Observable.throw(TimeoutException())

  assert isinstance(other, Observable)

  return TimeoutAbsolute(self, dueTime, other, scheduler)
开发者ID:aguil,项目名称:RxPython,代码行数:12,代码来源:timeOperators.py

示例2: timeoutIndividual

# 需要导入模块: from rx.observable import Observable [as 别名]
# 或者: from rx.observable.Observable import throw [as 别名]
def timeoutIndividual(self, durationSelector, firstTimeout=None, other=None):
  assert isinstance(self, Observable)

  if firstTimeout == None:
    firstTimeout = Observable.never()
  if other == None:
    other = Observable.throw(TimeoutException())

  assert isinstance(firstTimeout, Observable)
  assert isinstance(other, Observable)

  return TimeoutObservable(self, firstTimeout, durationSelector, other)
开发者ID:aguil,项目名称:RxPython,代码行数:14,代码来源:timeOperators.py

示例3: run

# 需要导入模块: from rx.observable import Observable [as 别名]
# 或者: from rx.observable.Observable import throw [as 别名]
    def run(self):
      source = None
      disposable = Disposable.empty()

      try:
        resource = self.parent.resourceFactory()
        if resource != None:
          disposable = resource

        source = self.parent.observableFactory(resource)
      except Exception as e:
        return CompositeDisposable(Observable.throw(e).subscribeSafe(self), disposable)

      return CompositeDisposable(source.subscribeSafe(self), disposable)
开发者ID:aguil,项目名称:RxPython,代码行数:16,代码来源:using.py

示例4: start_async

# 需要导入模块: from rx.observable import Observable [as 别名]
# 或者: from rx.observable.Observable import throw [as 别名]
    def start_async(cls, function_async):
        """Invokes the asynchronous function, surfacing the result through an
        observable sequence.

        Keyword arguments:
        function_async -- {Function} Asynchronous function which returns a
            Future to run.

        Returns {Observable} An observable sequence exposing the function's
        result value, or an exception."""

        try:
            future = function_async()
        except Exception as ex:
            return Observable.throw(ex)

        return Observable.from_future(future)
开发者ID:jesonjn,项目名称:RxPY,代码行数:19,代码来源:startasync.py


注:本文中的rx.observable.Observable.throw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。