def get_path_parts(path):
 if (not path):
  return []
 parent = os.path.split(path)[0]
 parent_parts = parent.split(u'/')
 if ((len(parent_parts) == 1) and (parent_parts[0] == u'')):
  parts = []
 else:
  parts = [u'/'.join((parent_parts[:(parent_parts.index(part) + 1)] + [''])) for part in parent_parts]
 if (path not in parts):
  parts.append(path)
 parts.insert(0, u'')
 return parts

def get_path_parts ( path ) : if ( not path ) : return [ ] parent = os . path . split ( path ) [ 0 ] parent_parts = parent . split ( u'/' ) if ( ( len ( parent_parts ) == 1 ) and ( parent_parts [ 0 ] == u'' ) ) : parts = [ ] else : parts = [ u'/' . join ( ( parent_parts [ : ( parent_parts . index ( part ) + 1 ) ] + [ '' ] ) ) for part in parent_parts ] if ( path not in parts ) : parts . append ( path ) parts . insert ( 0 , u'' ) return parts
returns a list of paths parent paths plus path .