MCPcopy
hub / github.com/Gozargah/Marzban / readable_size

Function readable_size

app/utils/system.py:168–175  ·  view source on GitHub ↗
(size_bytes)

Source from the content-addressed store, hash-verified

166
167
168def readable_size(size_bytes):
169 if size_bytes <= 0:
170 return "0 B"
171 size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
172 i = int(math.floor(math.log(size_bytes, 1024)))
173 p = math.pow(1024, i)
174 s = round(size_bytes / p, 2)
175 return f'{s} {size_name[i]}'

Callers 15

list_usersFunction · 0.90
calculate_admin_usageFunction · 0.90
list_adminsFunction · 0.90
select_protocolsMethod · 0.90
get_user_info_textFunction · 0.90
get_template_info_textFunction · 0.90
usage_commandFunction · 0.90
report_new_userFunction · 0.90
report_user_modificationFunction · 0.90
get_system_infoFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected