(self, include_unit: bool = True)
| 434 | return f'{formatted_size} {unit.name}' |
| 435 | |
| 436 | def si_unit_highest(self, include_unit: bool = True) -> str: |
| 437 | si_units = Unit.get_si_units() |
| 438 | |
| 439 | all_si_values = [self.convert(si) for si in si_units] |
| 440 | filtered = filter(lambda x: x.value >= 1, all_si_values) |
| 441 | |
| 442 | # we have to get the max by the unit value as we're interested |
| 443 | # in getting the value in the highest possible unit without floats |
| 444 | si_value = max(filtered, key=lambda x: x.unit.value) |
| 445 | |
| 446 | if include_unit: |
| 447 | return f'{si_value.value} {si_value.unit.name}' |
| 448 | return f'{si_value.value}' |
| 449 | |
| 450 | def format_highest(self, include_unit: bool = True, units: Units = Units.BINARY) -> str: |
| 451 | if units == Units.BINARY: |
no test coverage detected