def get_partitions(self):
     metadata = Helper.execute_fdisk(self.get_path())
     partitions = []
     if metadata:
         partition_section_columns = 0
         for line in metadata.split("\n"):
             line = line.strip()
             if not line:
                 continue
             match = re.search("Sector size .*?: (\d+) bytes", line)
             if match:
                 self.set_sector_size(int(match.group(1)))
                 continue
             if re.search(r"Device\s+Boot\s+Start\s+End", line):
                 partition_section_columns = len(line.split())
                 continue
             if partition_section_columns > 0:
                 splits = line.split()
                 if re.search(r"\d+", splits[1]):
                     splits.insert(1, False)
                 else:
                     splits[1] = True
                 if len(splits) > 7:
                     extra_splits = splits[8:]
                     splits[7] += ' ' + ' '.join(extra_splits)
                     for extra_split in extra_splits:
                         splits.remove(extra_split)
                 partitions.append(Partition(splits[0], splits[1:]))
     return partitions
 def get_all():
     fd_output = Helper.execute_fdisk()
     disks = []
     if fd_output:
         for line in fd_output.split("\n"):
             line = line.strip()
             if not line:
                 continue
             match = re.search(r"^Disk\s+(\\dev\\sd[a-z]):", line)
             if match:
                 disks.append(match.group(1))
     return disks