MCPcopy Create free account
hub / github.com/adny-code/fastgrind / _format_bytes

Function _format_bytes

tools/fastgrind.py:127–134  ·  view source on GitHub ↗
(value: int)

Source from the content-addressed store, hash-verified

125
126
127def _format_bytes(value: int) -> str:
128 units = ["B", "KiB", "MiB", "GiB", "TiB"]
129 size = float(value)
130 for unit in units:
131 if abs(size) < 1024.0 or unit == units[-1]:
132 return f"{size:.2f} {unit}"
133 size /= 1024.0
134 return f"{size:.2f} TiB"
135
136
137def _format_value(value: float) -> str:

Callers 2

generate_snapshot_htmlFunction · 0.85
inspect_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected