refactor: Consolidate text color decorators and update related properties

This commit is contained in:
sha
2026-01-04 20:49:55 +00:00
parent 3f8b158135
commit 336b030a6b
11 changed files with 136 additions and 280 deletions
+8 -3
View File
@@ -1,6 +1,6 @@
class SizeFormatter:
"""Class for formatting file sizes"""
@staticmethod
def format_size(bytes_size: int) -> str:
"""Format bytes to human readable with unit"""
@@ -9,9 +9,14 @@ class SizeFormatter:
return f"{bytes_size:.1f} {unit}"
bytes_size /= 1024
return f"{bytes_size:.1f} TB"
@staticmethod
def format_size_full(bytes_size: int) -> str:
"""Format size with both human readable and bytes"""
size_formatted = SizeFormatter.format_size(bytes_size)
return f"{size_formatted} ({bytes_size:,} bytes)"
return f"{size_formatted} ({bytes_size:,} bytes)"
@staticmethod
def format_size_short(bytes_size: int) -> str:
"""Format size with only human readable"""
return SizeFormatter.format_size(bytes_size)