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.
Undocumented
| Function | _middleware |
Return a stable ordering key for middleware supplied in sets. |
| Function | flatten |
Flatten and validate middleware arguments into a plain list. |
| Function | is |
Check whether the route action parser accepts a candidate. |
| Function | normalize |
Normalise an HTTP route path to a canonical form. |
| Function | normalize |
Normalise a request path for route resolution. |
| Function | parse |
Parse and validate a route action into a normalised tuple. |
| Function | strip |
Remove start and end anchors from a regex pattern. |
| Constant | _ACTION |
Undocumented |
| Constant | _MULTI |
Undocumented |
MiddlewareInput) -> list[ type[ BaseMiddleware | WebSocketMiddleware]]:
(source)
¶
Flatten and validate middleware arguments into a plain list.
Accepts middleware classes passed either individually or wrapped in a list, tuple, set or frozenset (one level of nesting), so all of these are equivalent:
flatten_middleware(A, B) flatten_middleware([A, B]) flatten_middleware((A,), B)
| Parameters | |
*middleware:type | list | tuple | set | frozenset | Middleware classes or containers of middleware classes. |
| Returns | |
list[type[BaseMiddleware | WebSocketMiddleware]] | Flat list of validated middleware classes, in the order they were provided. |
| Raises | |
TypeError | If an entry is neither HTTP nor WebSocket middleware. |
Check whether the route action parser accepts a candidate.
Notes
Does not instantiate controllers or invoke handlers. Controller attribute lookup may execute descriptors; exceptions other than TypeError and ValueError propagate. Importability and dependency resolution are checked later in the routing lifecycle.
| Parameters | |
action:object | Candidate function, invokable controller class, or controller/method pair to validate using the same rules as parse_action. |
| Returns | |
bool | True if parse_action accepts the candidate; False if it raises TypeError or ValueError for an unsupported or malformed action. |
Normalise an HTTP route path to a canonical form.
Rules applied in order:
- Strip leading/trailing whitespace.
- Collapse consecutive slashes (//, ///, …) into one.
- Ensure the path starts with exactly one /.
- Remove any trailing / (except for the root path /).
| Parameters | |
path:str | Raw route path supplied by the developer. |
| Returns | |
str | Normalised path, e.g. '//users//me/' → '/users/me'. |
Parse and validate a route action into a normalised tuple.
Supports three forms:
- Invokable controller — concrete class that defines __call__.
- Controller + method — two-element list or tuple with a concrete class [ControllerClass, 'method_name'].
- Python function — plain function or coroutine function, excluding lambdas. Callable instances, bound methods and builtins are unsupported.
| Parameters | |
action:object | Candidate action to validate against the three forms described above. |
| Returns | |
tuple[ | |
| Raises | |
TypeError | If a bare class does not define __call__, if list elements have wrong types, if a controller class is abstract in either form, or if action is none of the accepted forms. |
ValueError | If the list does not have exactly two elements, or if the controller class does not expose the requested method. |