def _walk(root, top, ignore_files=None, ignore_dirs=None):
    dirs_to_visit = []

    try:
        dir_list = sorted(listdir(join(root, top)), key=lambda r: (len(r), r))
    except __HOLE__:
        pass
    else:
        for name in dir_list:
            path = join(top, name)
            fullpath = join(root, top, name)
            if isdir(fullpath):
                if not ignore_dirs or not ignore_dirs.match(path):
                    dirs_to_visit.append(path)
            else:
                if not ignore_files or not ignore_files.match(path):
                    yield name, path, root, top, fullpath

    for path in dirs_to_visit:
        for p in _walk(root, path, ignore_files, ignore_dirs):
            yield p
dataset/ETHPy150Open baverman/vial/vial/fsearch.py/_walk