

def scan_file(pym, filename, sentinel, installed):
    'Entry point scan that creates a PyModule instance if needed.\n    '
    if (not utils.is_python_script(filename)):
        return
    if (not pym):
        module = os.path.basename(filename)
        pym = utils.find_package(module, installed)
        if (not pym):
            pym = PyModule(module, 'SCRIPT', os.path.abspath(filename))
            installed.insert(0, pym)
        else:
            pym.is_scan = True
    for (imp_type, import_path, extra_file_scan) in _scan_file(extra_file_scan, sentinel):
        dep = utils.find_package(import_path, installed)
        if dep:
            dep.add_dependant(pym)
            pym.add_dependency(dep)
            if (imp_type != 'import'):
                pym.add_framework(imp_type)
        if extra_file_scan:
            scan_filename = utils.file_containing_import(import_path, extra_file_scan)
            log.info('Related scan: %s - %s', import_path, scan_filename)
            if scan_filename.endswith('__init__.py'):
                scan_directory(pym, os.path.dirname(scan_filename), sentinel, installed)
            else:
                scan_file(pym, scan_filename, sentinel, installed)
    return pym

dataset/ETHPy150Open tweekmonster/moult/moult/filesystem_scanner.py scan_file/VarMisuse@123/177 `filename`->`extra_file_scan`