Source code for caspia.reactive.operations.transition

from ..errors import ValueNotReady
from .cached import cached


[docs]class transition(cached):
[docs] async def on_next(self, value, **kwargs): if not hasattr(self, 'previous'): await super().on_error(ValueNotReady('waiting for transition')) self.previous = value else: await super().on_next((self.previous, value)) self.previous = value
def __str__(self): return '<transition (last, current) of {}>'.format(self.observable)