yera.runtime.blocks.spinner

Spinner block implementation.

Symbols

class SpinnerStream — Stream handle for creating multiple chunks of the same spinner block.

SpinnerStream

Inherits: _StreamHandle

Stream handle for creating multiple chunks of the same spinner block.

Methods

update — Update any supplied part of the spinner's active state.
fail — Resolve the spinner with a failed terminal appearance.

SpinnerStream.__enter__

__enter__()

SpinnerStream.__exit__

__exit__(
    exc_type: type[BaseException],
    exc_value: BaseException | None,
    traceback: TracebackType,
)

SpinnerStream.update

update(
    message: str | None = None,
    glyph: str | None = None,
    colour: NamedColour | None = None,
) → None

Update any supplied part of the spinner's active state.

Parameters

message
type: str | None = None

Replacement message, or None to retain the current one.

glyph
type: str | None = None

Replacement glyph, or None to retain the current one.

colour
type: NamedColour | None = None

Replacement colour, or None to retain the current one.

SpinnerStream.fail

fail(
    message: str = 'Failed',
) → None

Resolve the spinner with a failed terminal appearance.

Calling this method does not raise an exception or end the surrounding block immediately. The failed state is emitted when the spinner context exits, allowing callers to handle expected failures without exception-based control flow.

Parameters

message
type: str = 'Failed'

Message shown in the failed terminal state.