AQIT 0.1.0
Loading...
Searching...
No Matches
spinners.py
Go to the documentation of this file.
1# Copyright (c) 2025-present Aquin Labs Private Limited. All Rights Reserved.
2"""Spinner / bullet glyphs from py-spinners (cli-spinners)."""
3
4from __future__ import annotations
5
6from typing import Any
7
8# Status list animation: braille dots + ASCII flip.
9_STATUS_SPINNERS = ("dots9", "flip")
10
11
12def _spinner(name: str) -> dict[str, Any]:
13 from spinners import Spinners
14
15 return getattr(Spinners, name).value
17
18def bullet_mark(*, plain: bool = False) -> str:
19 """Settled glyph after the spin — plain slash, not circle/square."""
20 _ = plain
21 return "/"
23
24def status_spin_sequence() -> list[tuple[str, float]]:
25 """(frame, delay_seconds) for ``aquin status`` — plays dots9 then flip."""
26 seq: list[tuple[str, float]] = []
27 for name in _STATUS_SPINNERS:
28 sp = _spinner(name)
29 delay = sp["interval"] / 1000.0
30 for frame in sp["frames"]:
31 # Keep bullet column width predictable on blank-ish frames.
32 mark = frame if frame.strip() else "-"
33 seq.append((mark, delay))
34 return seq
35
36
37def spinner_frames(name: str = "dots") -> list[str]:
38 """Frame list for an animating spinner."""
39 return list(_spinner(name)["frames"])
40
42def spinner_interval_ms(name: str = "dots") -> int:
43 return int(_spinner(name)["interval"])
int spinner_interval_ms(str name="dots")
Definition spinners.py:46
str bullet_mark(*, bool plain=False)
Definition spinners.py:22
list[tuple[str, float]] status_spin_sequence()
Definition spinners.py:28
dict[str, Any] _spinner(str name)
Definition spinners.py:16
list[str] spinner_frames(str name="dots")
Definition spinners.py:41