Skip to content

Update loop task factory typing with kwargs #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions uvloop/loop.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ from typing import (
Generator,
List,
Optional,
Protocol,
Sequence,
Tuple,
TypeVar,
Expand All @@ -24,6 +25,14 @@ _ExceptionHandler = Callable[[asyncio.AbstractEventLoop, _Context], Any]
_SSLContext = Union[bool, None, ssl.SSLContext]
_ProtocolT = TypeVar("_ProtocolT", bound=asyncio.BaseProtocol)


class TaskFactoryCallable(Protocol):
def __call__(
self, loop: asyncio.AbstractEventLoop, coro: Generator[Any, None, _T], **kwargs: Any
) -> asyncio.Future[_T]:
...


class Loop:
def call_soon(
self, callback: Callable[..., Any], *args: Any, context: Optional[Any] = ...
Expand Down Expand Up @@ -52,17 +61,8 @@ class Loop:
*,
name: Optional[str] = ...,
) -> asyncio.Task[_T]: ...
def set_task_factory(
self,
factory: Optional[
Callable[[asyncio.AbstractEventLoop, Generator[Any, None, _T]], asyncio.Future[_T]]
],
) -> None: ...
def get_task_factory(
self,
) -> Optional[
Callable[[asyncio.AbstractEventLoop, Generator[Any, None, _T]], asyncio.Future[_T]]
]: ...
def set_task_factory(self, factory: Optional[TaskFactoryCallable]) -> None: ...
def get_task_factory(self) -> Optional[TaskFactoryCallable]: ...
@overload
def run_until_complete(self, future: Generator[Any, None, _T]) -> _T: ...
@overload
Expand Down