]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Add type hint for run_in_threadpool return type 674/head
authorDavid Montague <david@exactrics.com>
Mon, 14 Oct 2019 09:34:51 +0000 (02:34 -0700)
committerDavid Montague <david@exactrics.com>
Mon, 14 Oct 2019 09:34:51 +0000 (02:34 -0700)
starlette/concurrency.py

index 56db3db3c164fe791e8313f87ec01000859b8441..c5ac039eb21de6c01f3ee984311544ca80a75875 100644 (file)
@@ -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