mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
fix issue 2177
This commit is contained in:
parent
63981aacf9
commit
44be316673
1 changed files with 3 additions and 3 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Reference in a new issue