self.argv = argv
def get_devices(self):
- all_devices = disk.get_devices()
# remove devices with partitions
- # XXX Should be optional when getting device info
- for device, detail in all_devices.items():
- if detail.get('partitions') != {}:
- del all_devices[device]
- devices = sorted(all_devices.items(), key=lambda x: (x[0], x[1]['size']))
- return device_formatter(devices)
+ devices = [(device, details) for device, details in
+ disk.get_devices().items() if details.get('partitions') == {}]
+ size_sort = lambda x: (x[0], x[1]['size'])
+ return device_formatter(sorted(devices, key=size_sort))
def print_help(self):
return self._help.format(