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

Method render_speed

rich/progress.py:737–754  ·  view source on GitHub ↗

Render the speed in iterations per second. Args: task (Task): A Task object. Returns: Text: Text object containing the task speed.

(cls, speed: Optional[float])

Source from the content-addressed store, hash-verified

735
736 @classmethod
737 def render_speed(cls, speed: Optional[float]) -> Text:
738 """Render the speed in iterations per second.
739
740 Args:
741 task (Task): A Task object.
742
743 Returns:
744 Text: Text object containing the task speed.
745 """
746 if speed is None:
747 return Text("", style="progress.percentage")
748 unit, suffix = filesize.pick_unit_and_suffix(
749 int(speed),
750 ["", "×10³", "×10⁶", "×10⁹", "×10¹²"],
751 1000,
752 )
753 data_speed = speed / unit
754 return Text(f"{data_speed:.1f}{suffix} it/s", style="progress.percentage")
755
756 def render(self, task: "Task") -> Text:
757 if task.total is None and self.show_speed:

Callers 2

renderMethod · 0.95

Calls 1

TextClass · 0.85

Tested by 1