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:
parent
169c944c38
commit
9abf74cb9b
1 changed files with 3 additions and 0 deletions
|
@ -56,6 +56,9 @@ def bytestring(size, decimal_places=3, force_unit=None):
|
||||||
|
|
||||||
size_unit_string = UNIT_STRINGS[divisor]
|
size_unit_string = UNIT_STRINGS[divisor]
|
||||||
|
|
||||||
|
if divisor == BYTE:
|
||||||
|
decimal_places = 0
|
||||||
|
|
||||||
size_string = '{number:.0{decimal_places}f} {unit}'
|
size_string = '{number:.0{decimal_places}f} {unit}'
|
||||||
size_string = size_string.format(
|
size_string = size_string.format(
|
||||||
decimal_places=decimal_places,
|
decimal_places=decimal_places,
|
||||||
|
|
Loading…
Reference in a new issue