Skip to content

Types Reference

view.typing

AsgiDict = Dict[str, AsgiSerial] module-attribute

AsgiReceive = Callable[[], Awaitable[AsgiDict]] module-attribute

AsgiSend = Callable[[AsgiDict], Awaitable[None]] module-attribute

AsgiSerial = Union[bytes, str, int, float, list, tuple, Dict[str, 'AsgiSerial'], bool, None] module-attribute

BodyTranslateStrategy = Literal['str', 'repr', 'result', 'custom'] module-attribute

CallNext = Callable[[], ViewResponse] module-attribute

Callback = Callable[[], Any] module-attribute

DocsType = Dict[Tuple[Union[str, Tuple[str, ...]], str], 'RouteDoc'] module-attribute

FileWriteMethod = Literal['only', 'never', 'both'] module-attribute

LogLevel = Literal['debug', 'info', 'warning', 'error', 'critical'] module-attribute

Middleware = Callable[Concatenate[CallNext, P], ViewResponse] module-attribute

P = ParamSpec('P') module-attribute

Parser = Callable[[str], ViewBody] module-attribute

R = TypeVar('R', bound='ViewResponse') module-attribute

RawResponseHeader = Tuple[bytes, bytes] module-attribute

ResponseHeaders = Union[Dict[str, str], List[RawResponseHeader], Tuple[RawResponseHeader, ...]] module-attribute

SameSite = Literal['strict', 'lax', 'none'] module-attribute

StrMethod = Literal['get', 'post', 'put', 'patch', 'delete', 'options', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'WEBSOCKET'] module-attribute

StrMethodASGI = Literal['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'] module-attribute

TemplateEngine = Literal['view', 'jinja', 'django', 'mako', 'chameleon'] module-attribute

TypeInfo = Union[Tuple[int, TypeObject, List['TypeInfo']], Tuple[int, TypeObject, List['TypeInfo'], Any]] module-attribute

TypeObject = Union[Type[Any], None] module-attribute

V = TypeVar('V', bound='ValueType') module-attribute

Validator = Callable[[V], ValidatorResult] module-attribute

ValidatorResult = Union[bool, Tuple[bool, str]] module-attribute

ValueType = Union[ViewBodyLike, str, int, Dict[str, 'ValueType'], bool, float, Any] module-attribute

ViewBody = Dict[str, 'ValueType'] module-attribute

ViewBodyLike = Union[_SupportsViewBodyCV, _SupportsViewBodyF] module-attribute

ViewResponse = Awaitable[ViewResult] module-attribute

ViewResult = Union[_ViewResponseTupleA, _ViewResponseTupleB, _ViewResponseTupleC, _ViewResponseTupleD, _ViewResponseTupleE, _ViewResponseTupleF, _ViewResponseTupleG, _ViewResponseTupleH, _ViewResponseTupleI, _ViewResponseTupleJ, str, SupportsViewResult, None] module-attribute

ViewRoute = Union[Callable[P, Union[ViewResponse, ViewResult]], WebSocketRoute] module-attribute

WebSocketRoute = Callable[Concatenate['WebSocket', P], Awaitable[None]] module-attribute

Part

Bases: Protocol[V]

name: str instance-attribute

tp: type[V] | None instance-attribute

RouteInputDict

Bases: TypedDict, Generic[V]

default: V | None instance-attribute

has_default: bool instance-attribute

is_body: bool instance-attribute

name: str instance-attribute

type_codes: list[TypeInfo] instance-attribute

validators: list[Validator[V]] instance-attribute

SupportsViewResult

Bases: Protocol

__view_result__() -> ViewResult