Skip to content

Commit 3a01656

Browse files
committed
Improve the trio typing
1 parent d3786eb commit 3a01656

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/hypercorn/trio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async def serve(
1717
config: Config,
1818
*,
1919
shutdown_trigger: Callable[..., Awaitable[None]] | None = None,
20-
task_status: trio.TaskStatus = trio.TASK_STATUS_IGNORED,
20+
task_status: trio.TaskStatus[list[str]] = trio.TASK_STATUS_IGNORED,
2121
mode: Literal["asgi", "wsgi"] | None = None,
2222
) -> None:
2323
"""Serve an ASGI framework app given the config.

src/hypercorn/trio/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async def worker_serve(
3333
*,
3434
sockets: Sockets | None = None,
3535
shutdown_trigger: Callable[..., Awaitable[None]] | None = None,
36-
task_status: trio.TaskStatus = trio.TASK_STATUS_IGNORED,
36+
task_status: trio.TaskStatus[list[str]] = trio.TASK_STATUS_IGNORED,
3737
) -> None:
3838
config.set_statsd_logger_class(StatsdLogger)
3939

@@ -86,7 +86,7 @@ async def worker_serve(
8686
bind = repr_socket_addr(sock.family, sock.getsockname())
8787
await config.log.info(f"Running on https://{bind} (QUIC) (CTRL + C to quit)")
8888

89-
task_status.started(binds) # type: ignore[call-overload]
89+
task_status.started(binds)
9090
try:
9191
async with trio.open_nursery(strict_exception_groups=True) as nursery:
9292
if shutdown_trigger is not None:

src/hypercorn/trio/worker_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
def _cancel_wrapper(func: Callable[[], Awaitable[None]]) -> Callable[[], Awaitable[None]]:
1212
@wraps(func)
1313
async def wrapper(
14-
task_status: trio.TaskStatus = trio.TASK_STATUS_IGNORED,
14+
task_status: trio.TaskStatus[trio.CancelScope] = trio.TASK_STATUS_IGNORED,
1515
) -> None:
1616
cancel_scope = trio.CancelScope()
17-
task_status.started(cancel_scope) # type: ignore[call-overload]
17+
task_status.started(cancel_scope)
1818
with cancel_scope:
1919
await func()
2020

0 commit comments

Comments
 (0)