forked from VimPlug/jedi
Fix some more things to get async working
This commit is contained in:
@@ -132,10 +132,10 @@ class FunctionContext(use_metaclass(CachedMetaClass, FunctionMixin, TreeContext)
|
||||
class MethodContext(FunctionContext):
|
||||
def __init__(self, evaluator, class_context, *args, **kwargs):
|
||||
super(MethodContext, self).__init__(evaluator, *args, **kwargs)
|
||||
self._class_context = class_context
|
||||
self.class_context = class_context
|
||||
|
||||
def get_default_param_context(self):
|
||||
return self._class_context
|
||||
return self.class_context
|
||||
|
||||
|
||||
class FunctionExecutionContext(TreeContext):
|
||||
|
||||
@@ -11,7 +11,7 @@ from jedi.evaluate.cache import evaluator_method_cache
|
||||
from jedi.evaluate.arguments import AbstractArguments, AnonymousArguments, \
|
||||
ValuesArguments, TreeArgumentsWrapper
|
||||
from jedi.evaluate.context.function import FunctionExecutionContext, \
|
||||
FunctionContext, FunctionMixin, OverloadedFunctionContext
|
||||
FunctionContext, FunctionMixin, OverloadedFunctionContext, MethodContext
|
||||
from jedi.evaluate.context.klass import ClassContext, apply_py__get__, \
|
||||
py__mro__, ClassFilter
|
||||
from jedi.evaluate.context import iterable
|
||||
@@ -271,7 +271,10 @@ class TreeInstance(AbstractInstanceContext):
|
||||
for func in self._get_annotation_init_functions():
|
||||
# Just take the first result, it should always be one, because we
|
||||
# control the typeshed code.
|
||||
bound = BoundMethod(self, self.class_context, func)
|
||||
c = self.class_context
|
||||
if isinstance(func, MethodContext):
|
||||
c = func.class_context
|
||||
bound = BoundMethod(self, c, func)
|
||||
execution = bound.get_function_execution(self.var_args)
|
||||
if not execution.matches_signature():
|
||||
# First check if the signature even matches, if not we don't
|
||||
@@ -382,6 +385,11 @@ class BoundMethod(FunctionMixin, ContextWrapper):
|
||||
|
||||
return super(BoundMethod, self).get_function_execution(arguments)
|
||||
|
||||
def get_default_param_context(self):
|
||||
if isinstance(self._wrapped_context, MethodContext):
|
||||
return self.class_context
|
||||
return self._wrapped_context.get_default_param_context()
|
||||
|
||||
def py__call__(self, arguments):
|
||||
if isinstance(self._wrapped_context, OverloadedFunctionContext):
|
||||
return self._wrapped_context.py__call__(self._get_arguments(arguments))
|
||||
|
||||
@@ -52,6 +52,9 @@ class ModuleContext(TreeContext):
|
||||
self._string_names = string_names
|
||||
self.code_lines = code_lines
|
||||
|
||||
def is_module(self):
|
||||
return True
|
||||
|
||||
def iter_star_filters(self, search_global=False):
|
||||
for star_module in self.star_imports():
|
||||
yield next(star_module.get_filters(search_global))
|
||||
|
||||
@@ -508,6 +508,7 @@ class AbstractAnnotatedClass(ClassMixin, ContextWrapper):
|
||||
return stub_context.get_stub_only_filter(
|
||||
# Take the first filter, which is here to filter module contents
|
||||
# and wrap it.
|
||||
self.parent_context,
|
||||
[filter_],
|
||||
search_global=False,
|
||||
origin_scope=origin_scope,
|
||||
|
||||
Reference in New Issue
Block a user