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