Skip to content

Commit

Permalink
Change type hint docs (#70)
Browse files Browse the repository at this point in the history
* Change type hint docs

* fix type check

* fix older version python
  • Loading branch information
abersheeran authored Sep 26, 2024
1 parent 4c303bd commit 3c260b8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions baize/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@

Send = Callable[[Message], Awaitable[None]]

ASGIApp = Callable[[Scope, Receive, Send], Awaitable[None]]

class ASGIApp(Protocol):
def __call__(self, scope: Scope, receive: Receive, send: Send) -> Awaitable[None]:
...


# WSGI: view PEP3333
Environ = MutableMapping[str, Any]
Expand All @@ -66,11 +70,16 @@ def __call__(
status: str,
response_headers: List[Tuple[str, str]],
exc_info: Optional[ExcInfo] = None,
) -> None:
) -> Any:
...


WSGIApp = Callable[[Environ, StartResponse], Iterable[bytes]]
class WSGIApp(Protocol):
def __call__(
self, environ: Environ, start_response: StartResponse
) -> Iterable[bytes]:
...


# Server-sent Event
# https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
Expand Down

0 comments on commit 3c260b8

Please sign in to comment.