INNER CODE UNIT · Python

resource

ImFeH2/huddol · core/src/fora/adapters/websocket/server.py:252

async def resource[T](
    operation: Callable[..., T],
    release: Callable[[T], None],
    *args: Any,
) -> AsyncIterator[T]:
    task = asyncio.create_task(asyncio.to_thread(operation, *args))
    try:
        result = await asyncio.shield(task)
        yield result
    finally:
        result = await task
        await worker(release, result)


HOST = "127.0.0.1"
CONTENT_TYPES = {
    ".css": "text/css; charset=utf-8",
    ".html": "text/html; charset=utf-8",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…