From 7ad074083492e78c66e705b97699c92e5d38541a Mon Sep 17 00:00:00 2001 From: Trygve Aaberge Date: Sun, 20 Nov 2022 19:35:28 +0100 Subject: Create buffers on connect --- slack/task.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'slack/task.py') diff --git a/slack/task.py b/slack/task.py index 2caf264..27abd48 100644 --- a/slack/task.py +++ b/slack/task.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Any, Awaitable, Coroutine, Generator, Tuple, TypeVar +from typing import Any, Awaitable, Coroutine, Generator, List, Tuple, TypeVar from uuid import uuid4 import weechat @@ -75,6 +75,11 @@ def create_task( return task +async def await_all_concurrent(requests: List[Coroutine[Any, Any, T]]) -> List[T]: + tasks = [create_task(request) for request in requests] + return [await task for task in tasks] + + async def sleep(milliseconds: int): future = FutureTimer() weechat.hook_timer( -- cgit