def umount_all(root_path):
 def is_under_root(path):
  try:
   FilePath(path).segmentsFrom(root_path)
  except ValueError:
   return False
  return True
 partitions_under_root = list((p for p in psutil.disk_partitions() if is_under_root(p.mountpoint)))
 for partition in partitions_under_root:
  umount(FilePath(partition.mountpoint))

def umount_all ( root_path ) : def is_under_root ( path ) : try : FilePath ( path ) . segmentsFrom ( root_path ) except ValueError : return False return True partitions_under_root = list ( ( p for p in psutil . disk_partitions ( ) if is_under_root ( p . mountpoint ) ) ) for partition in partitions_under_root : umount ( FilePath ( partition . mountpoint ) )
unmount all devices with mount points contained in root_path .