MCPcopy Index your code
hub / github.com/archlinux/archinstall / binary_unit_highest

Method binary_unit_highest

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

Source from the content-addressed store, hash-verified

411 return f'{target_size.value}'
412
413 def binary_unit_highest(self, include_unit: bool = True) -> str:
414 binary_units = Unit.get_binary_units()
415
416 size = float(self._normalize())
417 unit = Unit.KiB
418 base_value = unit.value
419
420 for binary_unit in binary_units:
421 unit = binary_unit
422 if size < base_value:
423 break
424 size /= base_value
425
426 formatted_size = f'{size:.1f}'
427
428 if formatted_size.endswith('.0'):
429 formatted_size = formatted_size[:-2]
430
431 if not include_unit:
432 return formatted_size
433
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()

Callers 1

format_highestMethod · 0.95

Calls 2

_normalizeMethod · 0.95
get_binary_unitsMethod · 0.80

Tested by

no test coverage detected