Пример #1
0
    class T(Observer):
      def __init__(self, parent):
        self.parent = parent
        self.observer = NoopObserver()
        self.subscription = SingleAssignmentDisposable()

      def setdisposable(self, value):
        self.subscription.disposable = value
      disposable = property(None, setdisposable)

      def onNext(self, value):
        self.observer.onNext(value)

      def onError(self, exception):
        self.parent.observer.onError(exception)
        self.parent.dispose()

      def onCompleted(self):
        self.observer.onCompleted()
        # We can't cancel the other stream yet, it may be on its way
        # to dispatch an OnError message and we don't want to have a race.
        self.subscription.dispose()
Пример #2
0
 def __init__(self, parent):
   self.parent = parent
   self.observer = NoopObserver()
   self.subscription = SingleAssignmentDisposable()