def list_directory(path, ignore_directories, ignore_extensions):
    for root, dirs, files in os.walk(path):
        # skip over directories to ignore
        for dir in ignore_directories:
            try:
                dirs.remove(dir)
            except __HOLE__:
                pass
        # we are interested in the directory itself
        yield root
        for file in files:
            _, ext = os.path.splitext(file)
            if ext in ignore_extensions:
                continue
            yield os.path.join(root, file)
dataset/ETHPy150Open faassen/bowerstatic/bowerstatic/autoversion.py/list_directory