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

Function _format_file_size

ci/compiler/platformio_cache.py:127–139  ·  view source on GitHub ↗

Format file size in human-readable format.

(size_bytes: Optional[int])

Source from the content-addressed store, hash-verified

125
126
127def _format_file_size(size_bytes: Optional[int]) -> str:
128 """Format file size in human-readable format."""
129 if size_bytes is None:
130 return "unknown size"
131
132 if size_bytes < 1024:
133 return f"{size_bytes} B"
134 elif size_bytes < 1024 * 1024:
135 return f"{size_bytes / 1024:.1f} KB"
136 elif size_bytes < 1024 * 1024 * 1024:
137 return f"{size_bytes / (1024 * 1024):.1f} MB"
138 else:
139 return f"{size_bytes / (1024 * 1024 * 1024):.1f} GB"
140
141
142# Global cache to track PlatformIO installations in this session

Callers 1

download_artifactMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected