# Path: rx/disposable.py
# class Disposable(object):
#   """Represents a disposable object"""
# 
#   def dispose(self):
#     pass
# 
#   def __enter__(self):
#     return self
# 
#   def __exit__(self, exc_type, exc_value, traceback):
#     self.dispose()
# 
#   @staticmethod
#   def create(action):
#     return AnonymouseDisposable(action)
# 
#   @staticmethod
#   def empty():
#     return disposableEmpty
# 
# Path: rx/internal.py
# class Struct(object):
#   def __init__(self, **entries):
#     self.__dict__.update(entries)
# 
#   def __eq__(self, other):
#     if not isinstance(other, Struct):
#       return False
# 
#     return self.__dict__ == other.__dict__
# 
#   def __repr__(self):
#     return repr(self.__dict__)
# 
# Path: rx/notification.py
# class Notification(object):
#   """Represents a notification to an observer."""
# 
#   KIND_NEXT = 0
#   KIND_ERROR = 1
#   KIND_COMPLETED = 2
# 
#   def __eq__(self, other):
#     if not isinstance(other, Notification):
#       return False
# 
#     return (
#       self.kind == other.kind and
#       self.value == other.value and
#       self.hasValue == other.hasValue and
#       self.exception == other.exception
#     )
# 
#   def accept(self, observerOrOnNext, onError=None, onCompleted=None):
#     """Accepts an observer or the methods onNext, onError, onCompleted and invokes
#     either onNext, onError, onCompleted depending on which type of :class:`Notification`
#     it is. This is an abstract method that is implemented by
#     :class:`OnNextNotification`, :class:`OnErrorNotification`,
#     and :class:`OnCompletedNotification`."""
#     # if observerOrOnNext == None or hasattr(observerOrOnNext, '__call__'):
#     #   observer = Observer.create(observerOrOnNext, onError, onComplete)
#     raise NotImplementedError()
# 
#   @staticmethod
#   def createOnNext(value):
#     return OnNextNotification(value)
# 
#   @staticmethod
#   def createOnError(exception):
#     return OnErrorNotification(exception)
# 
#   @staticmethod
#   def createOnCompleted():
#     return OnCompletedNotification()
# 
# Path: rx/observable.py
# class Observable(object):
#   """Provides all extension methods to Observable"""
# 
#   def subscribe(self, observerOrOnNext=noop, onError=noop, onComplete=noop):
#     observer = observerOrOnNext
# 
#     if observerOrOnNext == None or callable(observerOrOnNext):
#       observer = Observer.create(observerOrOnNext, onError, onComplete)
# 
#     return self.subscribeCore(observer)
# 
#   def subscribeCore(self, observer):
#     raise NotImplementedError()
# 
#   def subscribeSafe(self, observer):
#     if isinstance(self, ObservableBase):
#       return self.subscribeCore(observer)
#     elif isinstance(self, Producer):
#       return self.subscribeRaw(observer, False)
# 
#     d = Disposable.empty()
# 
#     try:
#       d = self.subscribeCore(observer)
#     except Exception as e:
#       observer.onError(e)
# 
#     return d
# 
# Path: rx/observer.py
# class Observer(Disposable):
#   """Represents the IObserver Interface.
#   Has some static helper methods attached"""
# 
#   @staticmethod
#   def create(onNext=None, onError=None, onCompleted=None):
#     if onNext == None:
#       onNext = noop
#     if onError == None:
#       onError = defaultError
#     if onCompleted == None:
#       onCompleted = noop
# 
#     return AnonymousObserver(onNext, onError, onCompleted)
# 
#   @staticmethod
#   def synchronize(observer, lock=None):
#     if lock == None:
#       lock = RLock()
# 
#     return SynchronizedObserver(observer, lock)
# 
#   @staticmethod
#   def fromNotifier(handler):
#     return AnonymousObserver(
#       lambda x: handler(Notification.createOnNext(x)),
#       lambda ex: handler(Notification.createOnError(ex)),
#       lambda: handler(Notification.createOnCompleted())
#     )
# 
#   def toNotifier(self):
#     return lambda n: n.accept(self)
# 
#   def asObserver(self):
#     return AnonymousObserver(self.onNext, self.onError, self.onCompleted)
# 
#   def checked(self):
#     return CheckedObserver(self)
# 
#   def notifyOn(self, scheduler):
#     return ScheduledObserver(scheduler, self)
# 
#   def onNext(self, value):
#     raise NotImplementedError()
# 
#   def onError(self, exception):
#     raise NotImplementedError()
# 
#   def onCompleted(self):
#     raise NotImplementedError()
# 
# Path: rx/scheduler.py
# class HistoricalScheduler(VirtualTimeScheduler):
#   """Provides a virtual time scheduler that uses number for
#   absolute time and number for relative time."""
#   def __init__(self, initialClock = 0, comparer = defaultSubComparer):
#     super(HistoricalScheduler, self).__init__(initialClock, comparer)
#     self.clock = initialClock
#     self.cmp = comparer
# 
#   def add(self, absolute, relative):
#     return absolute + relative
# 
#   def toDateTimeOffset(self, absolute):
#     return absolute
# 
#   def toRelative(self, timeSpan):
#     return timeSpan


import unittest
from rx.disposable import Disposable
from rx.internal import Struct
from rx.notification import Notification
from rx.observable import Observable
from rx.observer import Observer
from rx.scheduler import HistoricalScheduler

    super(TestScheduler, self).start()

    return state.observer

  class MockObserver(Observer):
    def __init__(self, scheduler):
      super(TestScheduler.MockObserver, self).__init__()
      self.scheduler = scheduler
      self.messages = []

    def onNext(self, value):
      self.messages.append((
        self.scheduler.now(),
        OnNext(value)
      ))

    def onError(self, exception):
      self.messages.append((
        self.scheduler.now(),
        OnError(exception)
      ))

    def onCompleted(self):
      self.messages.append((
        self.scheduler.now(),
        OnCompleted()
      ))



# Path: rx/disposable.py
# class Disposable(object):
#   """Represents a disposable object"""
# 
#   def dispose(self):
#     pass
# 
#   def __enter__(self):
#     return self
# 
#   def __exit__(self, exc_type, exc_value, traceback):
#     self.dispose()
# 
#   @staticmethod
#   def create(action):
#     return AnonymouseDisposable(action)
# 
#   @staticmethod
#   def empty():
#     return disposableEmpty
# 
# Path: rx/internal.py
# class Struct(object):
#   def __init__(self, **entries):
#     self.__dict__.update(entries)
# 
#   def __eq__(self, other):
#     if not isinstance(other, Struct):
#       return False
# 
#     return self.__dict__ == other.__dict__
# 
#   def __repr__(self):
#     return repr(self.__dict__)
# 
# Path: rx/notification.py
# class Notification(object):
#   """Represents a notification to an observer."""
# 
#   KIND_NEXT = 0
#   KIND_ERROR = 1
#   KIND_COMPLETED = 2
# 
#   def __eq__(self, other):
#     if not isinstance(other, Notification):
#       return False
# 
#     return (
#       self.kind == other.kind and
#       self.value == other.value and
#       self.hasValue == other.hasValue and
#       self.exception == other.exception
#     )
# 
#   def accept(self, observerOrOnNext, onError=None, onCompleted=None):
#     """Accepts an observer or the methods onNext, onError, onCompleted and invokes
#     either onNext, onError, onCompleted depending on which type of :class:`Notification`
#     it is. This is an abstract method that is implemented by
#     :class:`OnNextNotification`, :class:`OnErrorNotification`,
#     and :class:`OnCompletedNotification`."""
#     # if observerOrOnNext == None or hasattr(observerOrOnNext, '__call__'):
#     #   observer = Observer.create(observerOrOnNext, onError, onComplete)
#     raise NotImplementedError()
# 
#   @staticmethod
#   def createOnNext(value):
#     return OnNextNotification(value)
# 
#   @staticmethod
#   def createOnError(exception):
#     return OnErrorNotification(exception)
# 
#   @staticmethod
#   def createOnCompleted():
#     return OnCompletedNotification()
# 
# Path: rx/observable.py
# class Observable(object):
#   """Provides all extension methods to Observable"""
# 
#   def subscribe(self, observerOrOnNext=noop, onError=noop, onComplete=noop):
#     observer = observerOrOnNext
# 
#     if observerOrOnNext == None or callable(observerOrOnNext):
#       observer = Observer.create(observerOrOnNext, onError, onComplete)
# 
#     return self.subscribeCore(observer)
# 
#   def subscribeCore(self, observer):
#     raise NotImplementedError()
# 
#   def subscribeSafe(self, observer):
#     if isinstance(self, ObservableBase):
#       return self.subscribeCore(observer)
#     elif isinstance(self, Producer):
#       return self.subscribeRaw(observer, False)
# 
#     d = Disposable.empty()
# 
#     try:
#       d = self.subscribeCore(observer)
#     except Exception as e:
#       observer.onError(e)
# 
#     return d
# 
# Path: rx/observer.py
# class Observer(Disposable):
#   """Represents the IObserver Interface.
#   Has some static helper methods attached"""
# 
#   @staticmethod
#   def create(onNext=None, onError=None, onCompleted=None):
#     if onNext == None:
#       onNext = noop
#     if onError == None:
#       onError = defaultError
#     if onCompleted == None:
#       onCompleted = noop
# 
#     return AnonymousObserver(onNext, onError, onCompleted)
# 
#   @staticmethod
#   def synchronize(observer, lock=None):
#     if lock == None:
#       lock = RLock()
# 
#     return SynchronizedObserver(observer, lock)
# 
#   @staticmethod
#   def fromNotifier(handler):
#     return AnonymousObserver(
#       lambda x: handler(Notification.createOnNext(x)),
#       lambda ex: handler(Notification.createOnError(ex)),
#       lambda: handler(Notification.createOnCompleted())
#     )
# 
#   def toNotifier(self):
#     return lambda n: n.accept(self)
# 
#   def asObserver(self):
#     return AnonymousObserver(self.onNext, self.onError, self.onCompleted)
# 
#   def checked(self):
#     return CheckedObserver(self)
# 
#   def notifyOn(self, scheduler):
#     return ScheduledObserver(scheduler, self)
# 
#   def onNext(self, value):
#     raise NotImplementedError()
# 
#   def onError(self, exception):
#     raise NotImplementedError()
# 
#   def onCompleted(self):
#     raise NotImplementedError()
# 
# Path: rx/scheduler.py
# class HistoricalScheduler(VirtualTimeScheduler):
#   """Provides a virtual time scheduler that uses number for
#   absolute time and number for relative time."""
#   def __init__(self, initialClock = 0, comparer = defaultSubComparer):
#     super(HistoricalScheduler, self).__init__(initialClock, comparer)
#     self.clock = initialClock
#     self.cmp = comparer
# 
#   def add(self, absolute, relative):
#     return absolute + relative
# 
#   def toDateTimeOffset(self, absolute):
#     return absolute
# 
#   def toRelative(self, timeSpan):
#     return timeSpan


# Path: test/reactive.py
import unittest
from rx.disposable import Disposable
from rx.internal import Struct
from rx.notification import Notification
from rx.observable import Observable
from rx.observer import Observer
from rx.scheduler import HistoricalScheduler


    super(TestScheduler, self).start()

    return state.observer

  class MockObserver(Observer):
    def __init__(self, scheduler):
      super(TestScheduler.MockObserver, self).__init__()
      self.scheduler = scheduler
      self.messages = []

    def onNext(self, value):
      self.messages.append((
        self.scheduler.now(),
        OnNext(value)
      ))

    def onError(self, exception):
      self.messages.append((
        self.scheduler.now(),
        OnError(exception)
      ))

    def onCompleted(self):
      self.messages.append((
        self.scheduler.now(),
        OnCompleted()
      ))



class HotObservable(Observable):