clearer numbers

This commit is contained in:
Kristian Krsnik 2024-04-12 15:13:28 +02:00
parent f34cd88de1
commit 95c6ecf8b4
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85

View File

@ -5,10 +5,10 @@ def convert_to_bytes(size: int | str) -> int:
return int(size)
except ValueError: # treat as string
units = {
'TB': 10 ** 12, 'TiB': 2 ** 40,
'GB': 10 ** 9, 'GiB': 2 ** 30,
'MB': 10 ** 6, 'MiB': 2 ** 20,
'KB': 10 ** 3, 'KiB': 2 ** 10,
'TB': 1000 ** 4, 'TiB': 1024 ** 4,
'GB': 1000 ** 3, 'GiB': 1024 ** 3,
'MB': 1000 ** 2, 'MiB': 1024 ** 2,
'KB': 1000, 'KiB': 1024,
'B': 1
}