mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-26 20:17:15 +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.
|
# The contravariant doesn't seem to be defined.
|
||||||
generics = (yield_contexts.py__class__(), NO_CONTEXTS)
|
generics = (yield_contexts.py__class__(), NO_CONTEXTS)
|
||||||
return ContextSet(
|
return ContextSet(
|
||||||
AnnotatedSubClass(c, generics) for c in async_generator_classes
|
AnnotatedSubClass(c.stub_context, generics) for c in async_generator_classes
|
||||||
).execute_annotation()
|
).execute_annotation()
|
||||||
else:
|
else:
|
||||||
if evaluator.environment.version_info < (3, 5):
|
if evaluator.environment.version_info < (3, 5):
|
||||||
@@ -337,7 +337,7 @@ class FunctionExecutionContext(TreeContext):
|
|||||||
# Only the first generic is relevant.
|
# Only the first generic is relevant.
|
||||||
generics = (return_contexts.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
|
generics = (return_contexts.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
|
||||||
return ContextSet(
|
return ContextSet(
|
||||||
AnnotatedSubClass(c, generics) for c in async_classes
|
AnnotatedSubClass(c.stub_context, generics) for c in async_classes
|
||||||
).execute_annotation()
|
).execute_annotation()
|
||||||
else:
|
else:
|
||||||
if is_generator:
|
if is_generator:
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ class TreeInstance(AbstractInstanceContext):
|
|||||||
)
|
)
|
||||||
debug.dbg('Inferred instance context as %s', defined, color='BLUE')
|
debug.dbg('Inferred instance context as %s', defined, color='BLUE')
|
||||||
return defined
|
return defined
|
||||||
|
return None
|
||||||
|
|
||||||
def get_annotated_class_object(self):
|
def get_annotated_class_object(self):
|
||||||
return self._get_annotated_class_object() or self.class_context
|
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)
|
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):
|
def py__call__(self, arguments):
|
||||||
if isinstance(self._wrapped_context, OverloadedFunctionContext):
|
if isinstance(self._wrapped_context, OverloadedFunctionContext):
|
||||||
return self._wrapped_context.py__call__(self._get_arguments(arguments))
|
return self._wrapped_context.py__call__(self._get_arguments(arguments))
|
||||||
|
|||||||
Reference in New Issue
Block a user