|
1 | 1 | from collections.abc import Callable |
2 | 2 | from typing import Any, Generic, Literal, TypeVar, overload |
3 | | -from typing_extensions import ParamSpec |
| 3 | +from typing_extensions import ParamSpec, TypeVarTuple, Unpack |
4 | 4 |
|
5 | 5 | from uwsgi import _RPCCallable |
6 | 6 |
|
7 | 7 | _T = TypeVar("_T") |
8 | 8 | _T2 = TypeVar("_T2") |
| 9 | +_Ts = TypeVarTuple("_Ts") |
9 | 10 | _SR = TypeVar("_SR", bound=Literal[0, -1, -2] | None) |
10 | 11 | _SignalCallbackT = TypeVar("_SignalCallbackT", bound=Callable[[int], Any]) |
11 | 12 | _RPCCallableT = TypeVar("_RPCCallableT", bound=_RPCCallable) |
@@ -166,13 +167,10 @@ class lock(Generic[_P, _T]): |
166 | 167 | def __init__(self, f: Callable[_P, _T]) -> None: ... |
167 | 168 | def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _T: ... |
168 | 169 |
|
169 | | -# FIXME: Technically this only allows positional arguments, but there is not really |
170 | | -# an adequate way yet to express this, once bound on ParamSpec does something |
171 | | -# we could probably enforce this |
172 | | -class thread(Generic[_P, _T]): |
173 | | - f: Callable[_P, _T] |
174 | | - def __init__(self, f: Callable[_P, _T]) -> None: ... |
175 | | - def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ... |
| 170 | +class thread(Generic[Unpack[_Ts], _T]): |
| 171 | + f: Callable[[Unpack[_Ts]], _T] |
| 172 | + def __init__(self, f: Callable[[Unpack[_Ts]], _T]) -> None: ... |
| 173 | + def __call__(self, *args: Unpack[_Ts]) -> Callable[[Unpack[_Ts]], _T]: ... |
176 | 174 |
|
177 | 175 | class harakiri: |
178 | 176 | s: int |
|
0 commit comments