mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Move py__getattribute__ to typeshed imports
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user