|
Option C Tools
|
Public Member Functions | |
| None | __init__ (self, *, TextIO|None stream=None, bool quiet=False) |
| None | render (self, list[str] lines, *, int footer_line=-1, int tasks_total=0) |
| None | update_line (self, int index, str text) |
| None | set_task (self, str name) |
| None | complete_task (self) |
| None | finish (self) |
Protected Member Functions | |
| None | _timer_loop (self) |
| None | _update_footer (self) |
Protected Attributes | |
| _stream = stream or sys.stdout | |
| _quiet = quiet | |
| _is_tty = hasattr(self._stream, "isatty") and self._stream.isatty() | |
| _lock = threading.Lock() | |
| list | _lines = [] |
| int | _line_count = 0 |
| int | _footer_line = -1 |
| str|None | _task_name = None |
| float | _task_start = 0.0 |
| float | _overall_start = 0.0 |
| int | _tasks_done = 0 |
| int | _tasks_total = 0 |
| _stop_event = threading.Event() | |
| threading.Thread|None | _timer_thread = None |
Fixed-size terminal display with in-place line updates and live timer. Prints a full template on render(), then overwrites individual lines via ANSI cursor movement as data becomes available. A background daemon thread refreshes the footer line every second so elapsed-time counters stay live. On non-TTY streams the template is NOT printed during render(); instead, update_line() silently accumulates changes and finish() prints the final state in one shot — clean output for CI and pipes.
Definition at line 194 of file progress.py.
| None progress.Dashboard.__init__ | ( | self, | |
| * | , | ||
| TextIO | None | stream = None, | ||
| bool | quiet = False ) |
Definition at line 206 of file progress.py.
|
protected |
Definition at line 292 of file progress.py.
|
protected |
Definition at line 298 of file progress.py.
| None progress.Dashboard.complete_task | ( | self | ) |
Increment done counter and clear the current task name.
Definition at line 268 of file progress.py.
| None progress.Dashboard.finish | ( | self | ) |
Stop the timer thread and render final state.
Definition at line 274 of file progress.py.
| None progress.Dashboard.render | ( | self, | |
| list[str] | lines, | ||
| * | , | ||
| int | footer_line = -1, | ||
| int | tasks_total = 0 ) |
Print all lines. *footer_line* is the index auto-updated by the background timer (default: third-from-last).
Definition at line 227 of file progress.py.
| None progress.Dashboard.set_task | ( | self, | |
| str | name ) |
Set current task name and reset the per-task elapsed timer.
Definition at line 261 of file progress.py.
| None progress.Dashboard.update_line | ( | self, | |
| int | index, | ||
| str | text ) |
Replace the line at *index* with *text*.
Definition at line 248 of file progress.py.
|
protected |
Definition at line 218 of file progress.py.
|
protected |
Definition at line 214 of file progress.py.
|
protected |
Definition at line 217 of file progress.py.
|
protected |
Definition at line 216 of file progress.py.
|
protected |
Definition at line 215 of file progress.py.
|
protected |
Definition at line 221 of file progress.py.
|
protected |
Definition at line 213 of file progress.py.
|
protected |
Definition at line 224 of file progress.py.
|
protected |
Definition at line 212 of file progress.py.
|
protected |
Definition at line 219 of file progress.py.
|
protected |
Definition at line 220 of file progress.py.
|
protected |
Definition at line 222 of file progress.py.
|
protected |
Definition at line 223 of file progress.py.
|
protected |
Definition at line 225 of file progress.py.