MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / render

Method render

pager_lib/tqdm/rich.py:28–43  ·  view source on GitHub ↗

Calculate common unit for completed and total.

(self, task)

Source from the content-addressed store, hash-verified

26 super().__init__()
27
28 def render(self, task):
29 """Calculate common unit for completed and total."""
30 completed = int(task.completed)
31 total = int(task.total)
32 if self.unit_scale:
33 unit, suffix = filesize.pick_unit_and_suffix(
34 total,
35 ["", "K", "M", "G", "T", "P", "E", "Z", "Y"],
36 self.unit_divisor,
37 )
38 else:
39 unit, suffix = filesize.pick_unit_and_suffix(total, [""], 1)
40 precision = 0 if unit == 1 else 1
41 return Text(
42 f"{completed/unit:,.{precision}f}/{total/unit:,.{precision}f} {suffix}",
43 style="progress.download")
44
45
46class RateColumn(ProgressColumn):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected