

def _file_gen(dname, fmatch=bool, dmatch=None):
    'A generator returning files under the given directory, with optional\n    file and directory filtering.\n\n    Args\n    ----\n    fmatch : predicate funct\n        A predicate function that returns True on a match.\n        This is used to match files only.\n\n    dmatch : predicate funct\n        A predicate function that returns True on a match.\n        This is used to match directories only.\n    '
    if ((dmatch is not None) and (not dmatch(dname))):
        return
    for (path, dirlist, filelist) in os.walk(dname):
        if (dmatch is not None):
            newdl = [d for d in dirlist if dmatch(d)]
            if (len(newdl) != len(dirlist)):
                dirlist[:] = newdl
        for name in [f for f in filelist if fmatch(f)]:
            (yield join(path, name))

dataset/ETHPy150Open OpenMDAO/OpenMDAO/openmdao/util/file_util.py _file_gen/original