File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,15 @@ def exec_module(self, module):
7575class DummyModuleFinder (importlib .abc .MetaPathFinder ):
7676 def find_spec (self , fullname , path , target = None ):
7777 if fullname in DUMMY_MODULE_NAMES :
78+ logging .warning (f"[DUMMY IMPORT] '{ fullname } ' is being replaced with DummyModule. "
79+ f"To clean up: remove or replace imports of '{ fullname } ' in your codebase." )
80+ return importlib .util .spec_from_loader (fullname , DummyModuleLoader ())
81+ # If the import fails for any other reason, log it for manual cleanup
82+ try :
83+ return None # Let the normal import machinery try next
84+ except Exception as e :
85+ logging .error (f"[IMPORT FAILURE] Could not import '{ fullname } ': { e } " )
7886 return importlib .util .spec_from_loader (fullname , DummyModuleLoader ())
79- return None
8087
8188sys .meta_path .insert (0 , DummyModuleFinder ())
8289# --- End Dynamic Dummy Import Hook ---
You can’t perform that action at this time.
0 commit comments