mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-22 22:30:45 -07:00
ci(M01): set __file__ on stub modules for inspect.getfile
Made-with: Cursor
This commit is contained in:
parent
267de8c5ca
commit
45ea430d40
1 changed files with 2 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ class _StubModule(types.ModuleType):
|
|||
else:
|
||||
m = _StubModule(module_name)
|
||||
m.__path__ = [] # package for nested imports
|
||||
m.__file__ = f"<stub:{module_name}>"
|
||||
m.__call__ = lambda *a, **k: None
|
||||
sys.modules[module_name] = m
|
||||
return sys.modules[module_name]
|
||||
|
|
@ -84,6 +85,7 @@ class _StubLoader(importlib.abc.Loader):
|
|||
def create_module(self, spec):
|
||||
m = _StubModule(spec.name)
|
||||
m.__path__ = []
|
||||
m.__file__ = f"<stub:{spec.name}>" # satisfy inspect.getfile
|
||||
return m
|
||||
|
||||
def exec_module(self, module):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue