Better convey intent

This commit is contained in:
Loïc Simon 2025-10-02 01:48:15 +02:00
parent 48fd43f8e8
commit 7ac428e9c4

View file

@ -110,7 +110,7 @@ def _find_modules(self, path: str, prefix: str) -> list[str]:
modules: Iterable[pkgutil.ModuleInfo]
imported_module = sys.modules.get(path.split('.')[0])
if imported_module:
# Module already imported: only look for its submodules,
# Module already imported: only look in its location,
# even if a module with the same name would be higher in path
imported_path = (imported_module.__spec__
and imported_module.__spec__.origin)
@ -122,7 +122,7 @@ def _find_modules(self, path: str, prefix: str) -> list[str]:
else:
# Module already imported but without spec/origin:
# propose no suggestions
modules = []
return []
else:
modules = self.global_cache