forked from VimPlug/jedi
Reindent some code
This commit is contained in:
@@ -500,31 +500,33 @@ def get_modules_containing_name(evaluator, modules, name):
|
||||
try:
|
||||
f = open(path, 'rb')
|
||||
except FileNotFoundError:
|
||||
return
|
||||
return None
|
||||
with f:
|
||||
code = python_bytes_to_unicode(f.read(), errors='replace')
|
||||
if name in code:
|
||||
e_sys_path = evaluator.get_sys_path()
|
||||
if base_names:
|
||||
module_name = os.path.basename(path)
|
||||
module_name = sys_path.remove_python_path_suffix(module_name)
|
||||
is_package = module_name == '__init__'
|
||||
if is_package:
|
||||
raise NotImplementedError(
|
||||
"This is probably not possible yet, please add a failing test first")
|
||||
module_name = os.path.basename(os.path.dirname(path))
|
||||
import_names = base_names + (module_name,)
|
||||
else:
|
||||
import_names, is_package = sys_path.transform_path_to_dotted(e_sys_path, path)
|
||||
if name not in code:
|
||||
return None
|
||||
|
||||
module = _load_python_module(
|
||||
evaluator, KnownContentFileIO(path, code),
|
||||
sys_path=e_sys_path,
|
||||
import_names=import_names,
|
||||
is_package=is_package,
|
||||
)
|
||||
evaluator.module_cache.add(import_names, ContextSet([module]))
|
||||
return module
|
||||
e_sys_path = evaluator.get_sys_path()
|
||||
if base_names:
|
||||
module_name = os.path.basename(path)
|
||||
module_name = sys_path.remove_python_path_suffix(module_name)
|
||||
is_package = module_name == '__init__'
|
||||
if is_package:
|
||||
raise NotImplementedError(
|
||||
"This is probably not possible yet, please add a failing test first")
|
||||
module_name = os.path.basename(os.path.dirname(path))
|
||||
import_names = base_names + (module_name,)
|
||||
else:
|
||||
import_names, is_package = sys_path.transform_path_to_dotted(e_sys_path, path)
|
||||
|
||||
module = _load_python_module(
|
||||
evaluator, KnownContentFileIO(path, code),
|
||||
sys_path=e_sys_path,
|
||||
import_names=import_names,
|
||||
is_package=is_package,
|
||||
)
|
||||
evaluator.module_cache.add(import_names, ContextSet([module]))
|
||||
return module
|
||||
|
||||
# skip non python modules
|
||||
used_mod_paths = set()
|
||||
|
||||
Reference in New Issue
Block a user