Move py__getattribute__ to typeshed imports

This commit is contained in:
Dave Halter
2018-09-01 17:17:39 +02:00
parent ab4e415aec
commit ecda9cc746
2 changed files with 9 additions and 17 deletions

View File

@@ -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:

View File

@@ -122,6 +122,9 @@ 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``.
if import_names == ('os', 'path'):
context_set = parent_module_context.py__getattribute__('path')
else:
context_set = callback(
evaluator,
import_names,