MCPcopy
hub / github.com/Textualize/rich / _RefreshThread

Class _RefreshThread

rich/live.py:22–38  ·  view source on GitHub ↗

A thread that calls refresh() at regular intervals.

Source from the content-addressed store, hash-verified

20
21
22class _RefreshThread(Thread):
23 """A thread that calls refresh() at regular intervals."""
24
25 def __init__(self, live: "Live", refresh_per_second: float) -> None:
26 self.live = live
27 self.refresh_per_second = refresh_per_second
28 self.done = Event()
29 super().__init__(daemon=True)
30
31 def stop(self) -> None:
32 self.done.set()
33
34 def run(self) -> None:
35 while not self.done.wait(1 / self.refresh_per_second):
36 with self.live._lock:
37 if not self.done.is_set():
38 self.live.refresh()
39
40
41class Live(JupyterMixin, RenderHook):

Callers 1

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected