mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-24 09:18:36 +08:00
When searching submodules, use all of __path__, fixes #1105
This commit is contained in:
@@ -186,13 +186,17 @@ class ModuleContext(TreeContext):
|
|||||||
Lists modules in the directory of this module (if this module is a
|
Lists modules in the directory of this module (if this module is a
|
||||||
package).
|
package).
|
||||||
"""
|
"""
|
||||||
path = self._path
|
|
||||||
names = {}
|
names = {}
|
||||||
if path is not None and path.endswith(os.path.sep + '__init__.py'):
|
try:
|
||||||
mods = iter_modules([os.path.dirname(path)])
|
method = self.py__path__
|
||||||
for module_loader, name, is_pkg in mods:
|
except AttributeError:
|
||||||
# It's obviously a relative import to the current module.
|
pass
|
||||||
names[name] = SubModuleName(self, name)
|
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
|
# TODO add something like this in the future, its cleaner than the
|
||||||
# import hacks.
|
# import hacks.
|
||||||
|
|||||||
Reference in New Issue
Block a user