def __init__(self, poll_delay: int = 30): AsyncIOEventEmitter.__init__(self) self.poll_delay = poll_delay self.last_poll = 0 self.tx = {} self.medium_fee = 0 self.session = ...
def __init__(self, modules: list, loop, poll_delay: int = 2): """ :param modules: modules to poll :param poll_delay: how long to wait after polling finishes until polling starts again """ self.modules = modules self.poll_delay = poll_delay self.loop = loop AsyncIOEventEmitter.__init__(self, loop=loop)
def __init__(self, initial_value, value_forwarder=None): """ Initialize the object. initial_value -- the initial value value_forwarder -- the method that updates the actual value on the thing """ EventEmitter.__init__(self) self.last_value = initial_value self.value_forwarder = value_forwarder
def __init__(self, request, signing_secret, app_id, accepted_event_types=_ACCEPTED_EVENT_TYPES): AsyncIOEventEmitter.__init__(self) self.app_id = app_id self.request = request self.event = request['body'] self.signing_secret = signing_secret self.package_info = self.get_package_info() self.accepted_event_types = accepted_event_types
def __init__(self, initial_value=None, read_forwarder=None, write_forwarder=None): """ Initialize the object. initial_value -- the initial value value_forwarder -- the method that updates the actual value on the thing """ EventEmitter.__init__(self) self._value = initial_value self.read_forwarder = read_forwarder self.write_forwarder = write_forwarder
def __init__( self, id: str, input: T, runner: AbstractJobRunner, # TODO: Typing callable kwargs? coro: Callable[[T, Job[T, S], ThreadPoolExecutor], Awaitable[S]], threadpool: Union[ThreadPoolExecutor, None] = None): """Initialises and starts Job :param self: class instance :param id: unique job ID for the runner :param input: input data for the job :param runner: runner in which the job is being executed :param coro: the async function to execute with input and context, returning the result :param threadpool: optional threadpool to pass to coro if supplied """ self.id = id self.input = input self.runner = runner AsyncIOEventEmitter.__init__(self) self.task = create_task(coro(input, self, threadpool=threadpool)) def onTaskDone(task): """Task done handler to publish complete (success) & critical (fail) events""" try: err = task.exception() if (err): self.emit("critical", err) else: result = task.result() self.emit("complete", result) except CancelledError as err: self.emit( "warning", CancelledError("onTaskDone called after task cancelled"). with_traceback(err.__traceback__)) LOGGER.warning("Shouldn't see onTaskDone when cancelled??") except InvalidStateError as err: self.emit( "error", InvalidStateError( "onTaskDone called before task finished: Risk of zombie task" ).with_traceback(err.__traceback__)) self.task.add_done_callback(onTaskDone)
def __init__(self, token, session=None): AsyncIOEventEmitter.__init__(self) self.logger = logging.getLogger('Telegram') self.token = token self.update_id = 0 self.runner = None self.webhook = False self.webhook_url = '' if session is None: self.logger.debug('Creating new session') self.session = aiohttp.ClientSession() self.user_provided_session = False else: self.logger.debug('Using user provided session') self.session = session self.user_provided_session = True
def __init__(self, name, *args, **kwargs): self.name = name AsyncIOEventEmitter.__init__(self, *args, **kwargs)