Add ServerSessionT type var to Context (#271)
* Add ServerSessionT type var to Context * Passing locally * Try now
This commit is contained in:
parent
78fc5c12c0
commit
e756315dea
1 changed files with 44 additions and 38 deletions
|
|
@ -64,6 +64,8 @@ notifications. It automatically manages the request context and handles incoming
|
|||
messages from the client.
|
||||
"""
|
||||
|
||||
from __future__ import annotations as _annotations
|
||||
|
||||
import contextvars
|
||||
import logging
|
||||
import warnings
|
||||
|
|
@ -107,7 +109,7 @@ class NotificationOptions:
|
|||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(server: "Server") -> AsyncIterator[object]:
|
||||
async def lifespan(server: Server[LifespanResultT]) -> AsyncIterator[object]:
|
||||
"""Default lifespan context manager that does nothing.
|
||||
|
||||
Args:
|
||||
|
|
@ -126,7 +128,7 @@ class Server(Generic[LifespanResultT]):
|
|||
version: str | None = None,
|
||||
instructions: str | None = None,
|
||||
lifespan: Callable[
|
||||
["Server"], AbstractAsyncContextManager[LifespanResultT]
|
||||
[Server[LifespanResultT]], AbstractAsyncContextManager[LifespanResultT]
|
||||
] = lifespan,
|
||||
):
|
||||
self.name = name
|
||||
|
|
|
|||
Loading…
Reference in a new issue