forked from VimPlug/jedi
Try to put all module loading in one place including namespace packages
This commit is contained in:
@@ -367,15 +367,9 @@ class Importer(object):
|
||||
_add_error(self.module_context, import_path[-1])
|
||||
return NO_CONTEXTS
|
||||
|
||||
if isinstance(module_path, ImplicitNSInfo):
|
||||
from jedi.evaluate.context.namespace import ImplicitNamespaceContext
|
||||
module = ImplicitNamespaceContext(
|
||||
self._evaluator,
|
||||
fullname=module_path.name,
|
||||
paths=module_path.paths,
|
||||
module = _load_module(
|
||||
self._evaluator, module_path, code, sys_path, parent_module
|
||||
)
|
||||
else:
|
||||
module = _load_module(self._evaluator, module_path, code, sys_path, parent_module)
|
||||
|
||||
if module is None:
|
||||
# The file might raise an ImportError e.g. and therefore not be
|
||||
@@ -473,6 +467,14 @@ class Importer(object):
|
||||
|
||||
|
||||
def _load_module(evaluator, path=None, code=None, sys_path=None, parent_module=None):
|
||||
if isinstance(path, ImplicitNSInfo):
|
||||
from jedi.evaluate.context.namespace import ImplicitNamespaceContext
|
||||
module = ImplicitNamespaceContext(
|
||||
evaluator,
|
||||
fullname=path.name,
|
||||
paths=path.paths,
|
||||
)
|
||||
else:
|
||||
if sys_path is None:
|
||||
sys_path = evaluator.get_sys_path()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user