forked from VimPlug/jedi
Small improvements to generator/async completions
This commit is contained in:
@@ -139,6 +139,12 @@ class InferenceState:
|
||||
typing_module, = self.import_module(('typing',))
|
||||
return typing_module
|
||||
|
||||
@property
|
||||
@inference_state_function_cache()
|
||||
def types_module(self):
|
||||
typing_module, = self.import_module(('types',))
|
||||
return typing_module
|
||||
|
||||
def reset_recursion_limitations(self):
|
||||
self.recursion_detector = recursion.RecursionDetector()
|
||||
self.execution_recursion_detector = recursion.ExecutionRecursionDetector(self)
|
||||
|
||||
@@ -340,10 +340,10 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
||||
for c in async_generator_classes
|
||||
).execute_annotation(None)
|
||||
else:
|
||||
async_classes = inference_state.typing_module.py__getattribute__('Coroutine')
|
||||
async_classes = inference_state.types_module.py__getattribute__('CoroutineType')
|
||||
return_values = self.get_return_values()
|
||||
# Only the first generic is relevant.
|
||||
generics = (return_values.py__class__(), NO_VALUES, NO_VALUES)
|
||||
generics = (NO_VALUES, NO_VALUES, return_values.py__class__())
|
||||
return ValueSet(
|
||||
GenericClass(c, TupleGenericManager(generics)) for c in async_classes
|
||||
).execute_annotation(None)
|
||||
|
||||
@@ -48,7 +48,7 @@ class GeneratorBase(LazyAttributeOverwrite, IterableMixin):
|
||||
return instance
|
||||
|
||||
def _get_cls(self):
|
||||
generator, = self.inference_state.typing_module.py__getattribute__('Generator')
|
||||
generator, = self.inference_state.types_module.py__getattribute__('GeneratorType')
|
||||
return generator
|
||||
|
||||
def py__bool__(self):
|
||||
|
||||
Reference in New Issue
Block a user