| 430 | |
| 431 | |
| 432 | class FileSize(int): |
| 433 | def __new__(cls, value, iec=False): |
| 434 | obj = int.__new__(cls, value) |
| 435 | obj.iec = iec |
| 436 | return obj |
| 437 | |
| 438 | def __format__(self, format_spec): |
| 439 | return format_file_size(int(self), iec=self.iec).__format__(format_spec) |
| 440 | |
| 441 | |
| 442 | def parse_file_size(s): |