feat: Add type hints and improve type safety across multiple modules

This commit is contained in:
sha
2026-04-12 22:41:47 +03:00
parent f2af482154
commit bcc6b03ae2
20 changed files with 79 additions and 51 deletions
+5 -4
View File
@@ -4,11 +4,12 @@ class SizeFormatter:
@staticmethod
def format_size(bytes_size: int) -> str:
"""Format bytes to human readable with unit"""
size: float = bytes_size
for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
if bytes_size < 1024:
return f"{bytes_size:.1f} {unit}"
bytes_size /= 1024
return f"{bytes_size:.1f} TB"
if size < 1024:
return f"{size:.1f} {unit}"
size /= 1024
return f"{size:.1f} TB"
@staticmethod
def format_size_full(bytes_size: int) -> str: