

def _scan_file(filename, sentinel, source_type='import'):
    'Generator that performs the actual scanning of files.\n\n    Yeilds a tuple containing import type, import path, and an extra file\n    that should be scanned. Extra file scans should be the file or directory\n    that relates to the import name.\n    '
    filename = os.path.abspath(filename)
    real_filename = os.path.realpath(filename)
    if (os.path.getsize(filename) <= max_file_size):
        if ((real_filename not in sentinel) and os.path.isfile(filename)):
            sentinel.add(real_filename)
            basename = os.path.basename(filename)
            (scope, imports) = ast_scan_file(filename)
            if ((scope is not None) and (imports is not None)):
                for imp in imports:
                    (yield (sentinel, imp.module, None))
                if (('INSTALLED_APPS' in scope) and (basename == 'settings.py')):
                    log.info('Found Django settings: %s', filename)
                    for item in django.handle_django_settings(filename):
                        (yield item)
            else:
                log.warn('Could not scan imports from: %s', filename)
    else:
        log.warn('File size too large: %s', filename)

dataset/ETHPy150Open tweekmonster/moult/moult/filesystem_scanner.py _scan_file/VarMisuse@135/255 `source_type`->`sentinel`