From 0f7853c3568791f0e93ece57d2fc750dbc93b963 Mon Sep 17 00:00:00 2001 From: David Montague Date: Mon, 14 Oct 2019 02:34:51 -0700 Subject: [PATCH] Add type hint for run_in_threadpool return type --- starlette/concurrency.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/starlette/concurrency.py b/starlette/concurrency.py index 56db3db3..c5ac039e 100644 --- a/starlette/concurrency.py +++ b/starlette/concurrency.py @@ -8,10 +8,12 @@ try: except ImportError: # pragma: no cover contextvars = None # type: ignore +T = typing.TypeVar("T") + async def run_in_threadpool( - func: typing.Callable, *args: typing.Any, **kwargs: typing.Any -) -> typing.Any: + func: typing.Callable[..., T], *args: typing.Any, **kwargs: typing.Any +) -> T: loop = asyncio.get_event_loop() if contextvars is not None: # pragma: no cover # Ensure we run in the same context -- 2.47.2