fix issue 2177

This commit is contained in:
André Théo LAURET 2023-03-28 19:22:19 +04:00 committed by GitHub
parent 63981aacf9
commit 44be316673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -89,15 +89,15 @@ def binary_to_human(n: int) -> str:
"""
Convert bytes or bits into human readable format with binary prefix
"""
symbols = ("K", "M", "G", "T", "P", "E", "Z", "Y")
symbols = ("M", "G", "T", "P", "E", "Z", "Y")
prefix = {}
for i, s in enumerate(symbols):
prefix[s] = 1 << (i + 1) * 10
for s in reversed(symbols):
if n >= prefix[s]:
value = float(n) / prefix[s]
return "%.1f%s" % (value, s)
return "%s" % n
return "%d%s" % (value, s)
return "%sK" % n
def ram_available():