def get_partitions(diskpath):
 dev = parted.getDevice(diskpath)
 disk = parted.newDisk(dev)
 partitions = []
 for part in disk.partitions:
  (_, _, pname) = part.path.rsplit('/')
  partitions.append({'name': pname, 'size': (part.getLength() * dev.sectorSize)})
 return partitions

def get_partitions ( diskpath ) : dev = parted . getDevice ( diskpath ) disk = parted . newDisk ( dev ) partitions = [ ] for part in disk . partitions : ( _ , _ , pname ) = part . path . rsplit ( '/' ) partitions . append ( { 'name' : pname , 'size' : ( part . getLength ( ) * dev . sectorSize ) } ) return partitions
return array of partition names for given disk .