1
0
forked from VimPlug/jedi

When searching submodules, use all of __path__, fixes #1105

This commit is contained in:
Dave Halter
2018-05-01 23:15:54 +02:00
parent 91499565a9
commit 8d48e7453a

View File

@@ -186,13 +186,17 @@ class ModuleContext(TreeContext):
Lists modules in the directory of this module (if this module is a
package).
"""
path = self._path
names = {}
if path is not None and path.endswith(os.path.sep + '__init__.py'):
mods = iter_modules([os.path.dirname(path)])
for module_loader, name, is_pkg in mods:
# It's obviously a relative import to the current module.
names[name] = SubModuleName(self, name)
try:
method = self.py__path__
except AttributeError:
pass
else:
for path in method():
mods = iter_modules([path])
for module_loader, name, is_pkg in mods:
# It's obviously a relative import to the current module.
names[name] = SubModuleName(self, name)
# TODO add something like this in the future, its cleaner than the
# import hacks.