Skip to content

Commit

Permalink
fix: add space between value and unit symbol for file size formatting (
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth authored May 5, 2023
1 parent bdf0e21 commit 79e85bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cubi_tk/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def sizeof_fmt(num, suffix="B"): # pragma: nocover
"""Source: https://stackoverflow.com/a/1094933/84349"""
for unit in ["", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei", "Zi"]:
if abs(num) < 1024.0:
return "%3.1f%s%s" % (num, unit, suffix)
return "%3.1f %s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%s%s" % (num, "Yi", suffix)
return "%.1f %s%s" % (num, "Yi", suffix)


def get_terminal_columns():
Expand Down

0 comments on commit 79e85bf

Please sign in to comment.