mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Refactor some of the import logic so it's possible to load typeshed modules
This commit is contained in:
@@ -78,14 +78,14 @@ class StdlibPlugin(BasePlugin):
|
||||
return wrapper
|
||||
|
||||
def import_module(self, callback):
|
||||
def wrapper(evaluator, import_names, sys_path):
|
||||
def wrapper(evaluator, import_names, module_context, sys_path):
|
||||
# This is a huge exception, we follow a nested import
|
||||
# ``os.path``, because it's a very important one in Python
|
||||
# that is being achieved by messing with ``sys.modules`` in
|
||||
# ``os``.
|
||||
if import_names == ('os', 'path'):
|
||||
return callback(evaluator, ('os',), sys_path).py__getattribute__('path')
|
||||
return callback(evaluator, import_names, sys_path)
|
||||
return module_context.py__getattribute__('path')
|
||||
return callback(evaluator, import_names, module_context, sys_path)
|
||||
|
||||
|
||||
return wrapper
|
||||
|
||||
Reference in New Issue
Block a user