diff --git a/jedi/plugins/stdlib.py b/jedi/plugins/stdlib.py index 7735fcfd..651facf9 100644 --- a/jedi/plugins/stdlib.py +++ b/jedi/plugins/stdlib.py @@ -74,17 +74,6 @@ class StdlibPlugin(BasePlugin): return wrapper - def import_module(self, callback): - def wrapper(evaluator, import_names, parent_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 parent_module_context.py__getattribute__('path') - return callback(evaluator, import_names, parent_module_context, sys_path) - return wrapper - def _follow_param(evaluator, arguments, index): try: diff --git a/jedi/plugins/typeshed.py b/jedi/plugins/typeshed.py index 239791a8..426300d7 100644 --- a/jedi/plugins/typeshed.py +++ b/jedi/plugins/typeshed.py @@ -122,12 +122,15 @@ class TypeshedPlugin(BasePlugin): # ``os.path``, because it's a very important one in Python # that is being achieved by messing with ``sys.modules`` in # ``os``. - context_set = callback( - evaluator, - import_names, - parent_module_context, - sys_path - ) + if import_names == ('os', 'path'): + context_set = parent_module_context.py__getattribute__('path') + else: + context_set = callback( + evaluator, + import_names, + parent_module_context, + sys_path + ) # Don't use CompiledObjects, they are just annoying and don't # really help with anything. Just use the stub files instead. context_set = ContextSet.from_iterable(