You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
264 B

  1. def pparent(paths):
  2. paths = sorted(paths,key=len)
  3. first = True
  4. ret = []
  5. while len(paths) > 0:
  6. el1 = old_paths[0]
  7. old_paths = paths[1:]
  8. paths = []
  9. for path in old_paths:
  10. if not paths.startswith(el1):
  11. paths.insert(0,path)
  12. return ret