(n: int)
| 89 | |
| 90 | |
| 91 | def format_bytes(n: int) -> str: |
| 92 | units = ["B", "KB", "MB", "GB", "TB"] |
| 93 | size = float(n) |
| 94 | for unit in units: |
| 95 | if size < 1024 or unit == units[-1]: |
| 96 | return f"{size:.1f} {unit}" if unit != "B" else f"{int(size)} {unit}" |
| 97 | size /= 1024 |
| 98 | return f"{n} B" |
| 99 | |
| 100 | |
| 101 | def classify_worktree(wt: Path) -> WorktreeStatus: |