mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Move py__getattribute__ to typeshed imports
This commit is contained in:
@@ -74,17 +74,6 @@ class StdlibPlugin(BasePlugin):
|
|||||||
|
|
||||||
return wrapper
|
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):
|
def _follow_param(evaluator, arguments, index):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -122,12 +122,15 @@ class TypeshedPlugin(BasePlugin):
|
|||||||
# ``os.path``, because it's a very important one in Python
|
# ``os.path``, because it's a very important one in Python
|
||||||
# that is being achieved by messing with ``sys.modules`` in
|
# that is being achieved by messing with ``sys.modules`` in
|
||||||
# ``os``.
|
# ``os``.
|
||||||
context_set = callback(
|
if import_names == ('os', 'path'):
|
||||||
evaluator,
|
context_set = parent_module_context.py__getattribute__('path')
|
||||||
import_names,
|
else:
|
||||||
parent_module_context,
|
context_set = callback(
|
||||||
sys_path
|
evaluator,
|
||||||
)
|
import_names,
|
||||||
|
parent_module_context,
|
||||||
|
sys_path
|
||||||
|
)
|
||||||
# Don't use CompiledObjects, they are just annoying and don't
|
# Don't use CompiledObjects, they are just annoying and don't
|
||||||
# really help with anything. Just use the stub files instead.
|
# really help with anything. Just use the stub files instead.
|
||||||
context_set = ContextSet.from_iterable(
|
context_set = ContextSet.from_iterable(
|
||||||
|
|||||||
Reference in New Issue
Block a user