def __init__(self, publisher: Publisher, predicate: Callable[[Any], bool], unpack: bool = False) -> None: Operator.__init__(self, publisher) self._predicate = predicate self._unpack = unpack
def __init__(self, publisher: Publisher, value, operation) -> None: Operator.__init__(self, publisher) self._value = value self._operation = operation if publisher.inherited_type is not None: self.inherit_type(publisher.inherited_type)
def __init__(self, publisher: Publisher, attribute_name) -> None: Operator.__init__(self, publisher) self._attribute_name = attribute_name self._args = None self._kwargs = None self.inherit_type(publisher.inherited_type)
def __init__(self, publisher: Publisher, operation) -> None: Operator.__init__(self) self.originator = publisher self._operation = operation if publisher.inherited_type is not None: self.inherit_type(publisher.inherited_type)
def __init__( self, publisher: Publisher, coro_with_args, mode=AsyncMode.CONCURRENT, error_callback=default_error_handler, ) -> None: Operator.__init__(self, publisher) self._coro = coro_with_args self._mode = mode self._error_callback = error_callback # ._future is the reference to a running coroutine encapsulated as task self._future = None # type: Optional[asyncio.Future] # ._last_emit is used for LAST_DISTINCT and keeps the last emit from # source publisher self._last_emit = NONE # type: Any # .scheduled is a Publisher which is emitting the value of the source # publisher when the coroutine is actually started self.scheduled = Publisher() # queue is initialized with following sizes: # Mode: size: # QUEUE unlimited # LAST, LAST_DISTINCT 1 # all others no queue used self._queue = None # type: Optional[MutableSequence] if mode in (AsyncMode.QUEUE, AsyncMode.LAST, AsyncMode.LAST_DISTINCT): maxlen = (None if mode is AsyncMode.QUEUE else 1) self._queue = deque(maxlen=maxlen)
def __init__(self, publisher: Publisher, duration: float, error_callback=default_error_handler, loop=None) -> None: Operator.__init__(self, publisher) self._duration = duration self._loop = loop or asyncio.get_event_loop() self._call_later_handler = None # type: asyncio.Handle self._last_state = NONE # type: Any self._error_callback = error_callback
def __init__(self, coro, *args, mode=AsyncMode.CONCURRENT, error_callback=default_error_handler, unpack: bool = False, **kwargs) -> None: Operator.__init__(self) _coro = wrap_coro(coro, unpack, *args, **kwargs) self._coro_queue = CoroQueue(_coro, mode=mode) self._error_callback = error_callback
def __init__(self, publisher: Publisher, duration: float, error_callback=default_error_handler, loop=None) -> None: Operator.__init__(self, publisher) self._duration = duration self._loop = loop or asyncio.get_event_loop() self._timer = Timer(self._delayed_emit_cb, loop=loop) self._error_callback = error_callback
def __init__(self, duration: float, error_callback=default_error_handler, loop=None) -> None: Operator.__init__(self) if duration < 0: raise ValueError('Duration has to be bigger than zero') self._duration = duration self._loop = loop or asyncio.get_event_loop() self._timer = Timer(self._delayed_emit_cb, loop=loop) self._error_callback = error_callback
def __init__(self, publisher: Publisher, function: Callable[[Any], Any], unpack: bool = False) -> None: """ Special care for return values: - return `None` (or nothing) if you don't want to return a result - return `None, ` if you want to return `None` - return `(a, b), ` to return a tuple as value - every other return value will be unpacked """ Operator.__init__(self, publisher) self._function = function self._unpack = unpack
def __init__(self, function: Callable[[Any], Any], *args, unpack: bool = False, **kwargs) -> None: """ Special care for return values: - return `None` (or nothing) if you don't want to return a result - return `None, ` if you want to return `None` - return `(a, b), ` to return a tuple as value - every other return value will be unpacked """ Operator.__init__(self) self._function = partial(function, *args, **kwargs) self._unpack = unpack
def __init__(self, init=NONE): Operator.__init__(self) self._state = init
def __init__(self, publisher: Publisher) -> None: Operator.__init__(self, publisher)
def __init__(self, predicate: Callable[[Any], bool], *args, unpack: bool = False, **kwargs) -> None: Operator.__init__(self) self._predicate = partial(predicate, *args, **kwargs) # type: Callable self._unpack = unpack
def __init__(self, publisher: Publisher = None) -> None: Operator.__init__(self) self._originator = publisher
def __init__(self, init: Any = NONE) -> None: Operator.__init__(self) self._state = init
def __init__(self, publisher: Publisher, init: Any = NONE) -> None: Operator.__init__(self, publisher) self._state = init