(value: int)
| 441 | return total |
| 442 | |
| 443 | |
| 444 | def _format_bytes(value: int) -> str: |
| 445 | size = float(max(0, int(value or 0))) |
| 446 | for unit in ("B", "KB", "MB", "GB", "TB"): |
| 447 | if size < 1024 or unit == "TB": |
| 448 | if unit == "B": |
| 449 | return f"{int(size)}B" |
| 450 | return f"{size:.1f}{unit}" |
| 451 | size /= 1024 |
| 452 | return "0B" |
| 453 | |
| 454 |