MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / format_size

Function format_size

Scripts/Developer Base/Tree Explorer.py:172–178  ·  view source on GitHub ↗
(num_bytes: int)

Source from the content-addressed store, hash-verified

170UNITS = ("B", "KB", "MB", "GB", "TB", "PB")
171
172def format_size(num_bytes: int) -> str:
173 s = float(max(0, num_bytes))
174 unit = 0
175 while s >= 1024.0 and unit < len(UNITS) - 1:
176 s /= 1024.0
177 unit += 1
178 return f"{s:.2f} {UNITS[unit]}"
179
180def safe_lstat(path: Path) -> Optional[os.stat_result]:
181 try:

Callers 8

_walkFunction · 0.70
format_top_listFunction · 0.70
build_summary_textFunction · 0.70
format_dupesFunction · 0.70
format_sizes_reportFunction · 0.70
format_recentFunction · 0.70
file_info_textFunction · 0.70
rich_labelFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected