

def _scan_directory(directory, sentinel, depth=0):
    'Basically os.listdir with some filtering.\n    '
    directory = os.path.abspath(directory)
    real_directory = os.path.realpath(directory)
    if ((depth < max_directory_depth) and (real_directory not in sentinel) and os.path.isdir(directory)):
        sentinel.add(real_directory)
        for item in os.listdir(directory):
            if (item in ('.', '..')):
                continue
            p = os.path.abspath(os.path.join(directory, item))
            if ((os.path.isdir(p) and _dir_ignore.search(p)) or (os.path.isfile(p) and _ext_ignore.search(p))):
                continue
            (yield p)

dataset/ETHPy150Open tweekmonster/moult/moult/filesystem_scanner.py _scan_directory/original