def compact(paths):
sep = os.path.sep<EOL>short_paths = set()<EOL>for path in sorted(paths, key=len):<EOL><INDENT>should_skip = any(<EOL>path.startswith(shortpath.rstrip("<STR_LIT:*>")) and<EOL>path[len(shortpath.rstrip("<STR_LIT:*>").rstrip(sep))] == sep<EOL>for shortpath in short_paths<EOL>)<EOL>if not should_skip:<EOL><INDENT>short_paths.add(path)<EOL><DEDENT><DEDENT>return short_paths<EOL>
Compact a path set to contain the minimal number of paths
    necessary to contain all paths in the set. If /a/path/ and
    /a/path/to/a/file.txt are both in the set, leave only the
    shorter path.