Coverage for nexios\types.py: 100%

1 from __future__ import annotations

2 from typing import Callable, Type, Awaitable, Any

3 import typing

4 from .http.request import Request

5 from .http.response import NexiosResponse as Response

6 from .websockets import WebSocket

7

8 AppType = typing.TypeVar("AppType")

9

10 Scope = typing.MutableMapping[str, typing.Any]

11 Message = typing.MutableMapping[str, typing.Any]

12

13 Receive = typing.Callable[[], typing.Awaitable[Message]]

14 Send = typing.Callable[[Message], typing.Awaitable[None]]

15 RequestResponseEndpoint = typing.Callable[[Request], typing.Awaitable[Response]]

16

17 MiddlewareType = typing.Callable[

18 [Request, Response, RequestResponseEndpoint], typing.Awaitable[Response]

19]

20 WsMiddlewareType = Callable[

21 [Type[WebSocket], Type[Callable[..., Awaitable[Message]]]], Type[Send]

22]

23

24 WsHandlerType = typing.Callable[[WebSocket], typing.Awaitable[None]]

25 HandlerType = Callable[..., Awaitable[Any]]

26 ExceptionHandlerType = Callable[[Request, Response, Exception], typing.Any]

27

28 ASGIApp = typing.Callable[[Scope, Receive, Send], typing.Awaitable[None]]