THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
module documentation
Provide view globals operations.
Includes _compile_route_template, _build_route_path, _load_named_routes, _global_route.
| Function | _build |
Replace path placeholders with their values. |
| Function | _compile |
Split a route template into literal chunks and placeholder names. |
| Async Function | _load |
Collect every named route as a mapping of name to path template. |
| Constant | _MISSING |
Sentinel telling a missing placeholder apart from a legitimate None value. |
| Constant | _ROUTE |
Matches route path placeholders such as {id} or {id:int}. |
def _build_route_path(template:
str, params: dict[ str, Any]) -> tuple[ str, dict[ str, Any]]:
(source)
¶
Replace path placeholders with their values.
| Parameters | |
template:str | Route path containing {name} or {name:type} segments. |
params:dict[str, typing.Any] | Values available to fill the placeholders. |
| Returns | |
tuple[str, dict[str, typing.Any]] | The interpolated path and the parameters left unused, which the caller appends as a query string. |
| Raises | |
orionis.view.exceptions.ViewRouteException | If a placeholder has no matching value in params. |
@lru_cache( maxsize=1024)
def _compile_route_template(template: str) -> tuple[ tuple[ str, ...], tuple[ str, ...]]:
(source)
¶
Split a route template into literal chunks and placeholder names.
| Parameters | |
template:str | Route path containing {name} or {name:type} segments. |
| Returns | |
tuple[tuple[str, ...], tuple[str, ...]] | Literal chunks surrounding each placeholder and the ordered placeholder names. Cache at most 1,024 pure plans, evicting the least recently used template when the cache reaches capacity. |
Collect every named route as a mapping of name to path template.
| Parameters | |
app:orionis.IApplication | Application container used to build the route loader. |
| Returns | |
dict[str, str] | Route name mapped to its raw path, e.g. '/users/{id:int}'. |