def get_files(root, cache=None, keep_top=False):
    if cache is not None:
        try:
            return cache[root]
        except __HOLE__:
            pass

    ignore_files = re.compile('.*({})$'.format(
        '|'.join(r'\.{}'.format(r)
                 for r in get_dvar('vial_ignore_extensions'))))

    ignore_dirs = re.compile('({})'.format('|'.join(
        get_dvar('vial_ignore_dirs'))))

    fcache = []
    if keep_top:
        root, top = split(root)
    else:
        root, top = root, ''

    def filler():
        for r in _walk(root, top, ignore_files, ignore_dirs):
            fcache.append(r)
            yield r

        if cache is not None:
            cache[root] = fcache

    return filler()
dataset/ETHPy150Open baverman/vial/vial/fsearch.py/get_files