Format bytes in human-readable format.
(size_bytes: int)
| 26 | |
| 27 | |
| 28 | def 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 | |
| 38 | def calculate_savings(original: int, compressed: int) -> float: |
no outgoing calls
no test coverage detected
searching dependent graphs…