def wrapped(self, *args, **kwargs): queued = kwargs.pop('queued', self._is_messages_queued_default) isgroup = kwargs.pop('isgroup', False) if queued: prom = promise.Promise(method, (self, ) + args, kwargs) return self._msg_queue(prom, isgroup) return method(self, *args, **kwargs)
def wrapped(self: 'Bot', *args: Any, **kwargs: Any) -> Any: queued = kwargs.pop( 'queued', self._is_messages_queued_default # type: ignore[attr-defined] ) isgroup = kwargs.pop('isgroup', False) if queued: prom = promise.Promise(method, (self,) + args, kwargs) return self._msg_queue(prom, isgroup) # type: ignore[attr-defined] return method(self, *args, **kwargs)
def wrapped(self, *args, **kwargs): queued = kwargs.pop('queued', self._is_messages_queued_default) isgroup = kwargs.pop('isgroup', False) if queued: prom = promise.Promise(method, (self, ) + args, kwargs) prom.raise_exc = False self._msg_queue(prom, isgroup) ready = False while not ready: ready = prom.done.wait(timeout=0.5) if prom._exception is not None: raise prom._exception # pylint: disable=raising-bad-type return prom._result return method(self, *args, **kwargs)