Coverage for src/lilbee/cli/tui/spinner.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-08-14 11:46 +0000

1"""Braille spinner frames, sourced from Rich's canonical ``dots`` spinner. 

2 

3Rich already ships the cli-spinners frame data that backs its own ``Spinner``; 

4the task bar and the catalog loader index into these frames on their own poll 

5tick, so there is one definition here rather than a hand-copied braille tuple at 

6each call site. 

7""" 

8 

9from __future__ import annotations 

10 

11from typing import cast 

12 

13from rich.spinner import SPINNERS 

14 

15# Rich stores the frames as one glyph-per-character string, but types the spinner 

16# table loosely (the entry values are ``object``), so narrow it here. 

17SPINNER_FRAMES: tuple[str, ...] = tuple(cast(str, SPINNERS["dots"]["frames"])) 

18 

19 

20def spinner_frame(tick: int) -> str: 

21 """The braille spinner glyph for *tick*, wrapping over the frame set.""" 

22 return SPINNER_FRAMES[tick % len(SPINNER_FRAMES)]