Coverage for nexios\types.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-05-21 20:31 +0100

1from __future__ import annotations 

2from typing import Callable, Type, Awaitable, Any 

3import typing 

4from .http.request import Request 

5from .http.response import NexiosResponse as Response 

6from .websockets import WebSocket 

7 

8AppType = typing.TypeVar("AppType") 

9 

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

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

12 

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

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

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

16 

17MiddlewareType = typing.Callable[ 

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

19] 

20WsMiddlewareType = Callable[ 

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

22] 

23 

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

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

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

27 

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