Skip to content

Commit 440e44b

Browse files
committed
Fix a type error by using Concatenate
The intention is to pass *worker_args and **worker_kwargs to the worker_fn function. We need to explicity tell the type checker that worker_fn is expected to accept the arguments from P in addition to the standard item of type T. We use typing.Concatenate.
1 parent c40f51e commit 440e44b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/docbuild/utils/concurrency.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from contextlib import suppress
1919
import functools
2020
import logging
21+
from typing import Concatenate
2122

2223
log = logging.getLogger(__name__)
2324

@@ -127,7 +128,7 @@ async def run_all[T, R](
127128

128129
async def run_parallel[T, R, **P](
129130
items: Iterable[T] | AsyncIterableABC[T],
130-
worker_fn: Callable[[T], Awaitable[R]],
131+
worker_fn: Callable[Concatenate[T, P], Awaitable[R]],
131132
limit: int,
132133
*worker_args: P.args,
133134
**worker_kwargs: P.kwargs,

0 commit comments

Comments
 (0)