mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Make Importer.module_context Importer._module_context
This commit is contained in:
@@ -202,7 +202,7 @@ class Importer(object):
|
|||||||
debug.speed('import %s %s' % (import_path, module_context))
|
debug.speed('import %s %s' % (import_path, module_context))
|
||||||
self._inference_state = inference_state
|
self._inference_state = inference_state
|
||||||
self.level = level
|
self.level = level
|
||||||
self.module_context = module_context
|
self._module_context = module_context
|
||||||
|
|
||||||
self._fixed_sys_path = None
|
self._fixed_sys_path = None
|
||||||
self._infer_possible = True
|
self._infer_possible = True
|
||||||
@@ -269,11 +269,11 @@ class Importer(object):
|
|||||||
|
|
||||||
sys_path_mod = (
|
sys_path_mod = (
|
||||||
self._inference_state.get_sys_path()
|
self._inference_state.get_sys_path()
|
||||||
+ sys_path.check_sys_path_modifications(self.module_context)
|
+ sys_path.check_sys_path_modifications(self._module_context)
|
||||||
)
|
)
|
||||||
|
|
||||||
if self._inference_state.environment.version_info.major == 2:
|
if self._inference_state.environment.version_info.major == 2:
|
||||||
file_path = self.module_context.py__file__()
|
file_path = self._module_context.py__file__()
|
||||||
if file_path is not None:
|
if file_path is not None:
|
||||||
# Python2 uses an old strange way of importing relative imports.
|
# Python2 uses an old strange way of importing relative imports.
|
||||||
sys_path_mod.append(force_unicode(os.path.dirname(file_path)))
|
sys_path_mod.append(force_unicode(os.path.dirname(file_path)))
|
||||||
@@ -301,7 +301,7 @@ class Importer(object):
|
|||||||
])
|
])
|
||||||
if not value_set:
|
if not value_set:
|
||||||
message = 'No module named ' + '.'.join(import_names)
|
message = 'No module named ' + '.'.join(import_names)
|
||||||
_add_error(self.module_context, name, message)
|
_add_error(self._module_context, name, message)
|
||||||
return NO_VALUES
|
return NO_VALUES
|
||||||
return value_set
|
return value_set
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ class Importer(object):
|
|||||||
names = []
|
names = []
|
||||||
# add builtin module names
|
# add builtin module names
|
||||||
if search_path is None and in_module is None:
|
if search_path is None and in_module is None:
|
||||||
names += [ImportName(self.module_context, name)
|
names += [ImportName(self._module_context, name)
|
||||||
for name in self._inference_state.compiled_subprocess.get_builtin_module_names()]
|
for name in self._inference_state.compiled_subprocess.get_builtin_module_names()]
|
||||||
|
|
||||||
if search_path is None:
|
if search_path is None:
|
||||||
@@ -321,7 +321,7 @@ class Importer(object):
|
|||||||
|
|
||||||
for name in iter_module_names(self._inference_state, search_path):
|
for name in iter_module_names(self._inference_state, search_path):
|
||||||
if in_module is None:
|
if in_module is None:
|
||||||
n = ImportName(self.module_context, name)
|
n = ImportName(self._module_context, name)
|
||||||
else:
|
else:
|
||||||
n = SubModuleName(in_module, name)
|
n = SubModuleName(in_module, name)
|
||||||
names.append(n)
|
names.append(n)
|
||||||
@@ -344,7 +344,7 @@ class Importer(object):
|
|||||||
modname = mod.string_name
|
modname = mod.string_name
|
||||||
if modname.startswith('flask_'):
|
if modname.startswith('flask_'):
|
||||||
extname = modname[len('flask_'):]
|
extname = modname[len('flask_'):]
|
||||||
names.append(ImportName(self.module_context, extname))
|
names.append(ImportName(self._module_context, extname))
|
||||||
# Now the old style: ``flaskext.foo``
|
# Now the old style: ``flaskext.foo``
|
||||||
for dir in self._sys_path_with_modifications():
|
for dir in self._sys_path_with_modifications():
|
||||||
flaskext = os.path.join(dir, 'flaskext')
|
flaskext = os.path.join(dir, 'flaskext')
|
||||||
|
|||||||
Reference in New Issue
Block a user