Classes
FragmentContract
2
▼
Declares that a route returns a specific template fragment.
FragmentContract
2
▼
Declares that a route returns a specific template fragment.
Attributes
| Name | Type | Description |
|---|---|---|
template |
str
|
— |
block |
str
|
— |
SSEContract
2
▼
Declares event types and optional fragments emitted by an SSE route.
SSEContract
2
▼
Declares event types and optional fragments emitted by an SSE route.
Attributes
| Name | Type | Description |
|---|---|---|
event_types |
frozenset[str]
|
— |
fragments |
tuple[FragmentContract, ...]
|
— |
FormContract
3
▼
Declares which dataclass a route binds form data to.
FormContract
3
▼
Declares which dataclass a route binds form data to.
Attributes
| Name | Type | Description |
|---|---|---|
datacls |
type
|
— |
template |
str
|
— |
block |
str | None
|
— |
RouteContract
3
▼
Full contract metadata for a route.
RouteContract
3
▼
Full contract metadata for a route.
Attributes
| Name | Type | Description |
|---|---|---|
returns |
FragmentContract | SSEContract | None
|
— |
form |
FormContract | None
|
— |
description |
str
|
— |
Functions
contract
3
Any
▼
Attach a RouteContract to a route handler.
contract
3
Any
▼
def contract(returns: FragmentContract | SSEContract | None = None, *, form: FormContract | None = None, description: str = '') -> Any
Parameters
| Name | Type | Description |
|---|---|---|
returns |
FragmentContract | SSEContract | None |
Default:None
|
form |
FormContract | None |
Default:None
|
description |
str |
Default:''
|
Returns
Any