mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-25 01:38:36 +08:00
parent_module is not needed for loading modules
This commit is contained in:
@@ -355,7 +355,6 @@ class Importer(object):
|
|||||||
_add_error(self.module_context, import_path[-1])
|
_add_error(self.module_context, import_path[-1])
|
||||||
return NO_CONTEXTS
|
return NO_CONTEXTS
|
||||||
else:
|
else:
|
||||||
parent_module = None
|
|
||||||
debug.dbg('search_module %s in %s', import_parts[-1], self.file_path)
|
debug.dbg('search_module %s in %s', import_parts[-1], self.file_path)
|
||||||
# Override the sys.path. It works only good that way.
|
# Override the sys.path. It works only good that way.
|
||||||
# Injecting the path directly into `find_module` did not work.
|
# Injecting the path directly into `find_module` did not work.
|
||||||
@@ -370,7 +369,7 @@ class Importer(object):
|
|||||||
return NO_CONTEXTS
|
return NO_CONTEXTS
|
||||||
|
|
||||||
module = _load_module(
|
module = _load_module(
|
||||||
self._evaluator, module_path, code, sys_path, parent_module,
|
self._evaluator, module_path, code, sys_path,
|
||||||
module_name=module_name,
|
module_name=module_name,
|
||||||
safe_module_name=True,
|
safe_module_name=True,
|
||||||
)
|
)
|
||||||
@@ -470,7 +469,7 @@ class Importer(object):
|
|||||||
|
|
||||||
|
|
||||||
def _load_module(evaluator, path=None, code=None, sys_path=None,
|
def _load_module(evaluator, path=None, code=None, sys_path=None,
|
||||||
parent_module=None, module_name=None, safe_module_name=False):
|
module_name=None, safe_module_name=False):
|
||||||
try:
|
try:
|
||||||
return evaluator.module_cache.get(module_name)
|
return evaluator.module_cache.get(module_name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@@ -522,7 +521,6 @@ def get_modules_containing_name(evaluator, modules, name):
|
|||||||
"""
|
"""
|
||||||
Search a name in the directories of modules.
|
Search a name in the directories of modules.
|
||||||
"""
|
"""
|
||||||
from jedi.evaluate.context import ModuleContext
|
|
||||||
def check_directories(paths):
|
def check_directories(paths):
|
||||||
for p in paths:
|
for p in paths:
|
||||||
if p is not None:
|
if p is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user