# Path: rx/internal/basic.py
# def noop(*args, **kw):
#    pass
# 
# def default_error(err):
#     if isinstance(err, BaseException):
#         raise err
#     else:
#         raise Exception(err)
# 
# Path: rx/abstractobserver.py
# class AbstractObserver(object):
#     """Abstract Observer"""
# 
#     def __init__(self):
#         self.is_stopped = False
# 
#     def next(self, value):
#         raise NotImplementedError
# 
#     def error(self, error):
#         raise NotImplementedError
# 
#     def completed(self):
#         raise NotImplementedError
# 
#     def on_next(self, value):
#         """Notifies the observer of a new element in the sequence.
#         
#         Keyword arguments:
#         value -- Next element in the sequence.
#         """
#         if not self.is_stopped:
#             self.next(value)
# 
#     def on_error(self, error):
#         """Notifies the observer that an exception has occurred.
#         
#         Keyword arguments:
#         error -- The error that has occurred.
#         """
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.error(error)
#     
#     def on_completed(self):
#         """Notifies the observer of the end of the sequence."""
# 
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.completed()
#     
#     def dispose(self):
#         """Disposes the observer, causing it to transition to the stopped 
#         state."""
# 
#         self.is_stopped = True
#     
#     def fail(self, exn):
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.error(exn)
#             return True
# 
#         return False
# 
# Path: rx/anonymousobserver.py
# class AnonymousObserver(AbstractObserver):
#     def __init__(self, on_next, on_error, on_completed):
#         super(AnonymousObserver, self).__init__()
#         self._on_next = on_next
#         self._on_error = on_error
#         self._on_completed = on_completed
#     
#     def next(self, value):
#         self._on_next(value)
#     
#     def error(self, exception):
#         self._on_error(exception)
#     
#     def completed(self):
#         self._on_completed()


from rx.internal import noop, default_error
from .abstractobserver import AbstractObserver
from .anonymousobserver import AnonymousObserver


class Observer(AbstractObserver):
    """Supports push-style iteration over an observable sequence."""

    def __init__(self, on_next=None, on_error=None, on_completed=None):
        super(Observer, self).__init__()

        self.next = on_next or noop
        self.error = on_error or default_error

# Path: rx/internal/basic.py
# def noop(*args, **kw):
#    pass
# 
# def default_error(err):
#     if isinstance(err, BaseException):
#         raise err
#     else:
#         raise Exception(err)
# 
# Path: rx/abstractobserver.py
# class AbstractObserver(object):
#     """Abstract Observer"""
# 
#     def __init__(self):
#         self.is_stopped = False
# 
#     def next(self, value):
#         raise NotImplementedError
# 
#     def error(self, error):
#         raise NotImplementedError
# 
#     def completed(self):
#         raise NotImplementedError
# 
#     def on_next(self, value):
#         """Notifies the observer of a new element in the sequence.
#         
#         Keyword arguments:
#         value -- Next element in the sequence.
#         """
#         if not self.is_stopped:
#             self.next(value)
# 
#     def on_error(self, error):
#         """Notifies the observer that an exception has occurred.
#         
#         Keyword arguments:
#         error -- The error that has occurred.
#         """
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.error(error)
#     
#     def on_completed(self):
#         """Notifies the observer of the end of the sequence."""
# 
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.completed()
#     
#     def dispose(self):
#         """Disposes the observer, causing it to transition to the stopped 
#         state."""
# 
#         self.is_stopped = True
#     
#     def fail(self, exn):
#         if not self.is_stopped:
#             self.is_stopped = True
#             self.error(exn)
#             return True
# 
#         return False
# 
# Path: rx/anonymousobserver.py
# class AnonymousObserver(AbstractObserver):
#     def __init__(self, on_next, on_error, on_completed):
#         super(AnonymousObserver, self).__init__()
#         self._on_next = on_next
#         self._on_error = on_error
#         self._on_completed = on_completed
#     
#     def next(self, value):
#         self._on_next(value)
#     
#     def error(self, exception):
#         self._on_error(exception)
#     
#     def completed(self):
#         self._on_completed()


# Path: rx/observer.py
from rx.internal import noop, default_error
from .abstractobserver import AbstractObserver
from .anonymousobserver import AnonymousObserver



class Observer(AbstractObserver):
    """Supports push-style iteration over an observable sequence."""

    def __init__(self, on_next=None, on_error=None, on_completed=None):
        super(Observer, self).__init__()

        self.next = on_next or noop
        self.error = on_error or default_error

        self.completed = on_completed or noop