MCPcopy Create free account
hub / github.com/archlinux/archinstall / si_unit_highest

Method si_unit_highest

archinstall/lib/models/device.py:436–448  ·  view source on GitHub ↗
(self, include_unit: bool = True)

Source from the content-addressed store, hash-verified

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:

Callers 1

format_highestMethod · 0.95

Calls 2

convertMethod · 0.95
get_si_unitsMethod · 0.80

Tested by

no test coverage detected