yggdrasil.dataclasses.awaitable¶
awaitable ¶
Awaitable ¶
Bases: ABC
progress ¶
A 0..1 completion fraction for a progress bar, or None if unknown.
A UI hook: a generic awaitable can't know its fraction, so the base
returns None (drive a spinner, not a bar). Subclasses that do know
— a batch's children done, a statement's rows fetched — override this.
Consumed by :func:yggdrasil.cli.style.track.
watch ¶
Drive to completion, calling on_tick(self) each poll.
The hook a UI (spinner / progress bar) connects to without this trait
importing any UI — keeping the layering clean. Starts the awaitable if
it hasn't been, polls until done, then surfaces a failure (unless
raise_error is False). Pairs with :func:yggdrasil.cli.style.track.
AwaitableBatch ¶
Bases: Awaitable
progress ¶
Fraction of child awaitables finished — drives a real progress bar.
watch ¶
Drive to completion, calling on_tick(self) each poll.
The hook a UI (spinner / progress bar) connects to without this trait
importing any UI — keeping the layering clean. Starts the awaitable if
it hasn't been, polls until done, then surfaces a failure (unless
raise_error is False). Pairs with :func:yggdrasil.cli.style.track.