Method: rich.filesize.pick_unit_and_suffix
Calls: 13, Exceptions: 0, Paths: 1Back
Path 1: 13 calls (1.0)
13 (6) 50 (1) 2048 (1) 1000 (1) 1024 (1) 5 (1) 5000 (1) 8888888 (1)
['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] (7) ['', '×10³', '×10⁶', '×10⁹', '×10¹²'] (3) ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', ...
1000 (10) 1024 (3)
(1, 'bytes') (7) (1024, 'KB') (1) (1000, 'kB') (1) (1024, 'KiB') (1) (1, '') (1) (1000, '×10³') (1) (1000000, '×10⁶') (1)
1def pick_unit_and_suffix(size: int, suffixes: List[str], base: int) -> Tuple[int, str]:
2 """Pick a suffix and base for the given size."""
3 for i, suffix in enumerate(suffixes):
4 unit = base**i
5 if size < unit * base:
6 break
7 return unit, suffix