@memoize
def InvertRelativePath(path, toplevel_dir=None):
 if (not path):
  return path
 toplevel_dir = ('.' if (toplevel_dir is None) else toplevel_dir)
 return RelativePath(toplevel_dir, os.path.join(toplevel_dir, path))

@ memoize def InvertRelativePath ( path , toplevel_dir = None ) : if ( not path ) : return path toplevel_dir = ( '.' if ( toplevel_dir is None ) else toplevel_dir ) return RelativePath ( toplevel_dir , os . path . join ( toplevel_dir , path ) )
given a path like foo/bar that is relative to toplevel_dir .