MCPcopy Create free account
hub / github.com/ScrapeGraphAI/toonify / format_size

Function format_size

benchmark/compare_formats.py:28–35  ·  view source on GitHub ↗

Format bytes in human-readable format.

(size_bytes: int)

Source from the content-addressed store, hash-verified

26
27
28def format_size(size_bytes: int) -> str:
29 """Format bytes in human-readable format."""
30 if size_bytes < 1024:
31 return f"{size_bytes}B"
32 elif size_bytes < 1024 * 1024:
33 return f"{size_bytes / 1024:.2f}KB"
34 else:
35 return f"{size_bytes / (1024 * 1024):.2f}MB"
36
37
38def calculate_savings(original: int, compressed: int) -> float:

Callers 2

benchmark_datasetFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…