mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-31 01:05:22 +08:00
Use AnnotatedSubClass for Async classes like everywhere else as stubs
This commit is contained in:
@@ -327,7 +327,7 @@ class FunctionExecutionContext(TreeContext):
|
||||
# The contravariant doesn't seem to be defined.
|
||||
generics = (yield_contexts.py__class__(), NO_CONTEXTS)
|
||||
return ContextSet(
|
||||
AnnotatedSubClass(c, generics) for c in async_generator_classes
|
||||
AnnotatedSubClass(c.stub_context, generics) for c in async_generator_classes
|
||||
).execute_annotation()
|
||||
else:
|
||||
if evaluator.environment.version_info < (3, 5):
|
||||
@@ -337,7 +337,7 @@ class FunctionExecutionContext(TreeContext):
|
||||
# Only the first generic is relevant.
|
||||
generics = (return_contexts.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
|
||||
return ContextSet(
|
||||
AnnotatedSubClass(c, generics) for c in async_classes
|
||||
AnnotatedSubClass(c.stub_context, generics) for c in async_classes
|
||||
).execute_annotation()
|
||||
else:
|
||||
if is_generator:
|
||||
|
||||
@@ -295,6 +295,7 @@ class TreeInstance(AbstractInstanceContext):
|
||||
)
|
||||
debug.dbg('Inferred instance context as %s', defined, color='BLUE')
|
||||
return defined
|
||||
return None
|
||||
|
||||
def get_annotated_class_object(self):
|
||||
return self._get_annotated_class_object() or self.class_context
|
||||
@@ -396,11 +397,6 @@ 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))
|
||||
|
||||
Reference in New Issue
Block a user