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 http adapters response operations.
Includes close_stream, await_cleanup, send_until_disconnect.
| Class | _ |
Own a synchronous byte source before its first asynchronous read. |
| Async Function | _cancel |
Cancel and join both owned tasks without abandoning asynchronous cleanup. |
| Async Function | _finish |
Join owned cleanup after cancellation and retain its failure cause. |
| Function | _raise |
Propagate real sender and watcher failures after both tasks finish. |
| Function | _record |
Record the first completed future in event-loop callback order. |
| Async Function | await |
Await owned cleanup before propagating cancellation to its caller. |
| Async Function | close |
Close an iterator without letting cleanup erase a delivery failure. |
| Async Function | send |
Race a stream delivery against the transport's disconnect notification. |
| Constant | _CLEANUP |
Central reporting phase shared by response-stream finalizers. |
Cancel and join both owned tasks without abandoning asynchronous cleanup.
| Parameters | |
tasks:tuple[asyncio.Task[None], asyncio.Task[None]] | Sender and disconnect watcher owned by one response. |
| Returns | |
None | Finish both tasks before propagating their errors or cancellation. |
Join owned cleanup after cancellation and retain its failure cause.
| Parameters | |
pending:asyncio.Future[T] | Cleanup operation which must finish before its owner returns. |
ready:asyncio.Future[asyncio.Future[T]] | Completion notification carrying no cleanup exception. |
| Returns | |
None | Finish cleanup while deferring additional cancellation requests. |
Propagate real sender and watcher failures after both tasks finish.
| Parameters | |
results:list[BaseException | None] | Outcomes collected from both owned response tasks. |
| Returns | |
None | Return when both tasks succeeded or were cancelled. |
| Raises | |
BaseException | Preserve one failure or group simultaneous failures. |
Record the first completed future in event-loop callback order.
| Parameters | |
first:asyncio.Future[asyncio.Future[T]] | Completion notification awaited by the stream coordinator or cleanup. |
completed:asyncio.Future[T] | Operation whose completion triggered this callback. |
| Returns | |
None | Preserve the first completion without changing a cancelled result. |
Await owned cleanup before propagating cancellation to its caller.
| Parameters | |
pending:asyncio.Future[T] | Cleanup operation protected from cancellation of its owner. |
| Returns | |
T | Completed cleanup result when the owner was not cancelled. |
| Raises | |
BaseException | Propagate cleanup failure, or cancellation after successful cleanup. |
async def close_stream(iterator:
AsyncIterable[ bytes] | None, failure: BaseException | None):
(source)
¶
Close an iterator without letting cleanup erase a delivery failure.
| Parameters | |
iterator:collections.abc.AsyncIterable[bytes] | None | Owned source whose optional asynchronous close must be awaited, if present. |
failure:BaseException | None | Producer or transport failure already propagating through cleanup. |
| Returns | |
None | Finish cleanup, retaining a real delivery error if cancellation races it. |
async def send_until_disconnect(sending:
Coroutine[ None, None, None], disconnected: Coroutine[ None, None, None]) -> bool:
(source)
¶
Race a stream delivery against the transport's disconnect notification.
| Parameters | |
sending:collections.abc.Coroutine[None, None, None] | Delivery operation, including iterator cleanup and final framing. |
disconnected:collections.abc.Coroutine[None, None, None] | Operation returning when the client disconnects. |
| Returns | |
bool | Whether delivery completed before the disconnect watcher. |
| Raises | |
BaseException | Propagate delivery, notification, cleanup errors or request cancellation. |