forked from VimPlug/jedi
Try to use yield from instead of yield, if possible
This commit is contained in:
@@ -25,8 +25,7 @@ class _BoundTypeVarName(AbstractNameDefinition):
|
||||
# Replace any with the constraints if they are there.
|
||||
from jedi.inference.gradual.typing import AnyClass
|
||||
if isinstance(value, AnyClass):
|
||||
for constraint in self._type_var.constraints:
|
||||
yield constraint
|
||||
yield from self._type_var.constraints
|
||||
else:
|
||||
yield value
|
||||
return ValueSet(iter_())
|
||||
@@ -73,8 +72,7 @@ class _AnnotatedClassContext(ClassContext):
|
||||
filters = super().get_filters(
|
||||
*args, **kwargs
|
||||
)
|
||||
for f in filters:
|
||||
yield f
|
||||
yield from filters
|
||||
|
||||
# The type vars can only be looked up if it's a global search and
|
||||
# not a direct lookup on the class.
|
||||
|
||||
@@ -135,8 +135,7 @@ def _python_to_stub_names(names, fallback_to_python=False):
|
||||
if converted:
|
||||
converted_names = converted.goto(name.get_public_name())
|
||||
if converted_names:
|
||||
for n in converted_names:
|
||||
yield n
|
||||
yield from converted_names
|
||||
continue
|
||||
if fallback_to_python:
|
||||
# This is the part where if we haven't found anything, just return
|
||||
|
||||
@@ -43,11 +43,8 @@ class StubModuleValue(ModuleValue):
|
||||
filters = super().get_filters(origin_scope)
|
||||
next(filters, None) # Ignore the first filter and replace it with our own
|
||||
stub_filters = self._get_stub_filters(origin_scope=origin_scope)
|
||||
for f in stub_filters:
|
||||
yield f
|
||||
|
||||
for f in filters:
|
||||
yield f
|
||||
yield from stub_filters
|
||||
yield from filters
|
||||
|
||||
def _as_context(self):
|
||||
return StubModuleContext(self)
|
||||
@@ -66,8 +63,7 @@ class TypingModuleWrapper(StubModuleValue):
|
||||
f = next(filters, None)
|
||||
assert f is not None
|
||||
yield TypingModuleFilterWrapper(f)
|
||||
for f in filters:
|
||||
yield f
|
||||
yield from filters
|
||||
|
||||
def _as_context(self):
|
||||
return TypingModuleContext(self)
|
||||
@@ -77,8 +73,7 @@ class TypingModuleContext(ModuleContext):
|
||||
def get_filters(self, *args, **kwargs):
|
||||
filters = super().get_filters(*args, **kwargs)
|
||||
yield TypingModuleFilterWrapper(next(filters, None))
|
||||
for f in filters:
|
||||
yield f
|
||||
yield from filters
|
||||
|
||||
|
||||
class StubFilter(ParserTreeFilter):
|
||||
|
||||
Reference in New Issue
Block a user