mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Fix a return type for py__iter__()
This commit is contained in:
@@ -155,6 +155,7 @@ class AbstractInstanceContext(Context):
|
|||||||
if not iter_slot_names:
|
if not iter_slot_names:
|
||||||
return super(AbstractInstanceContext, self).py__iter__(contextualized_node)
|
return super(AbstractInstanceContext, self).py__iter__(contextualized_node)
|
||||||
|
|
||||||
|
def iterate():
|
||||||
for generator in self.execute_function_slots(iter_slot_names):
|
for generator in self.execute_function_slots(iter_slot_names):
|
||||||
if generator.is_instance():
|
if generator.is_instance():
|
||||||
# `__next__` logic.
|
# `__next__` logic.
|
||||||
@@ -162,16 +163,17 @@ class AbstractInstanceContext(Context):
|
|||||||
name = u'next'
|
name = u'next'
|
||||||
else:
|
else:
|
||||||
name = u'__next__'
|
name = u'__next__'
|
||||||
iter_slot_names = generator.get_function_slot_names(name)
|
next_slot_names = generator.get_function_slot_names(name)
|
||||||
if iter_slot_names:
|
if next_slot_names:
|
||||||
yield LazyKnownContexts(
|
yield LazyKnownContexts(
|
||||||
generator.execute_function_slots(iter_slot_names)
|
generator.execute_function_slots(next_slot_names)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
debug.warning('Instance has no __next__ function in %s.', generator)
|
debug.warning('Instance has no __next__ function in %s.', generator)
|
||||||
else:
|
else:
|
||||||
for lazy_context in generator.py__iter__():
|
for lazy_context in generator.py__iter__():
|
||||||
yield lazy_context
|
yield lazy_context
|
||||||
|
return iterate()
|
||||||
|
|
||||||
@abstractproperty
|
@abstractproperty
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user