Set decimal_places to 0 when result is in bytes.

So that you get "100 b" instead of "100.000 b".
This commit is contained in:
Ethan Dalool 2020-03-12 14:00:38 -07:00
parent 169c944c38
commit 9abf74cb9b

View file

@ -56,6 +56,9 @@ def bytestring(size, decimal_places=3, force_unit=None):
size_unit_string = UNIT_STRINGS[divisor]
if divisor == BYTE:
decimal_places = 0
size_string = '{number:.0{decimal_places}f} {unit}'
size_string = size_string.format(
decimal_places=decimal_places,