MCPcopy Create free account
hub / github.com/FastLED/FastLED / format_bytes

Function format_bytes

ci/clean-worktrees.py:91–98  ·  view source on GitHub ↗
(n: int)

Source from the content-addressed store, hash-verified

89
90
91def 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
101def classify_worktree(wt: Path) -> WorktreeStatus:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected