Fixed calculation of petabytes

This commit is contained in:
Manuel Cortez 2022-02-19 14:28:11 -06:00
parent 14324e56fe
commit c562a5498e
No known key found for this signature in database
GPG Key ID: 262CC30FA01B5CBF

View File

@ -9,7 +9,7 @@ def convert_bytes(n: float) -> str:
""" """
K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50 K, M, G, T, P = 1 << 10, 1 << 20, 1 << 30, 1 << 40, 1 << 50
if n >= P: if n >= P:
return "%.2fPb" % (float(n) / T) return "%.2fPb" % (float(n) / P)
elif n >= T: elif n >= T:
return "%.2fTb" % (float(n) / T) return "%.2fTb" % (float(n) / T)
elif n >= G: elif n >= G: