def __init__(self, publisher: Publisher, attribute_name) -> None:
        Operator.__init__(self)
        self.originator = publisher
        self._attribute_name = attribute_name
        self._args = None
        self._kwargs = None

        self.inherit_type(publisher.inherited_type)
    def __init__(self, publisher: Publisher, value, operation) -> None:
        Operator.__init__(self)
        self.originator = publisher
        self._value = value
        self._operation = operation

        if publisher.inherited_type is not None:
            self.inherit_type(publisher.inherited_type)
Пример #3
0
    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
Пример #4
0
 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
Пример #5
0
    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
Пример #6
0
    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
Пример #7
0
    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
Пример #8
0
    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
Пример #9
0
 def __init__(self, init=NONE):
     Operator.__init__(self)
     self._state = init
Пример #10
0
 def __init__(self, publisher: Publisher) -> None:
     Operator.__init__(self, publisher)
Пример #11
0
    def __init__(self, publisher: Publisher, operation) -> None:
        Operator.__init__(self, publisher)
        self._operation = operation

        if publisher.inherited_type is not None:
            self.inherit_type(publisher.inherited_type)
Пример #12
0
 def __init__(self, init: Any = NONE) -> None:
     Operator.__init__(self)
     self._state = init
Пример #13
0
 def __init__(self, publisher: Publisher = None) -> None:
     Operator.__init__(self)
     self._originator = publisher
Пример #14
0
 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
Пример #15
0
 def __init__(self, publisher: Publisher, init: Any = NONE) -> None:
     Operator.__init__(self, publisher)
     self._state = init