From ecb9a7e4f6b1ddeecbf0e00af4a149a99b4fa4c9 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela Date: Sun, 26 Jun 2022 21:18:30 +0400 Subject: Document Create Task Return Type Signed-off-by: Hassan Abouelela --- botcore/utils/scheduling.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'botcore') diff --git a/botcore/utils/scheduling.py b/botcore/utils/scheduling.py index d9c3937a..8d2f875e 100644 --- a/botcore/utils/scheduling.py +++ b/botcore/utils/scheduling.py @@ -208,13 +208,16 @@ class Scheduler: self._log.error(f"Error in task #{task_id} {id(done_task)}!", exc_info=exception) +TASK_RETURN = typing.TypeVar("TASK_RETURN") + + def create_task( - coro: typing.Coroutine, + coro: typing.Coroutine[typing.Any, typing.Any, TASK_RETURN], *, suppressed_exceptions: tuple[typing.Type[Exception]] = (), event_loop: typing.Optional[asyncio.AbstractEventLoop] = None, **kwargs, -) -> asyncio.Task: +) -> asyncio.Task[TASK_RETURN]: """ Wrapper for creating an :obj:`asyncio.Task` which logs exceptions raised in the task. -- cgit v1.2.3