def walker(top, names):
global packages, extensions<EOL>if any(exc in top for exc in excludes):<EOL><INDENT>return<EOL><DEDENT>package = top[top.rfind('<STR_LIT>'):].replace(os.path.sep, '<STR_LIT:.>')<EOL>packages.append(package)<EOL>for name in names:<EOL><INDENT>ext = '<STR_LIT:.>'.join(name.split('<STR_LIT:.>')[<NUM_LIT:1>:])<EOL>ext_str = '<STR_LIT>' % ext<EOL>if ext and ext not in excludes and ext_str not in extensions[package]:<EOL><INDENT>extensions[package].append(ext_str)<EOL><DEDENT><DEDENT>
Walks a directory and records all packages and file extensions.