utils: improve format_unit

This commit is contained in:
Peter Bieringer
2026-03-26 07:53:23 +01:00
parent bba835d486
commit a3068da865

View File

@@ -378,7 +378,10 @@ def format_unit(value: float, binary: bool = False) -> str:
unit = "k" unit = "k"
else: else:
unit = "" unit = ""
return ("%.1f %s" % (value, unit)) if unit == "":
return ("%d" % value)
else:
return ("%.1f %s" % (value, unit))
def limit_str(content: str, limit: int) -> str: def limit_str(content: str, limit: int) -> str: