mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix a return type for py__iter__()
This commit is contained in:
@@ -155,23 +155,25 @@ 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)
|
||||||
|
|
||||||
for generator in self.execute_function_slots(iter_slot_names):
|
def iterate():
|
||||||
if generator.is_instance():
|
for generator in self.execute_function_slots(iter_slot_names):
|
||||||
# `__next__` logic.
|
if generator.is_instance():
|
||||||
if self.evaluator.environment.version_info.major == 2:
|
# `__next__` logic.
|
||||||
name = u'next'
|
if self.evaluator.environment.version_info.major == 2:
|
||||||
|
name = u'next'
|
||||||
|
else:
|
||||||
|
name = u'__next__'
|
||||||
|
next_slot_names = generator.get_function_slot_names(name)
|
||||||
|
if next_slot_names:
|
||||||
|
yield LazyKnownContexts(
|
||||||
|
generator.execute_function_slots(next_slot_names)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
debug.warning('Instance has no __next__ function in %s.', generator)
|
||||||
else:
|
else:
|
||||||
name = u'__next__'
|
for lazy_context in generator.py__iter__():
|
||||||
iter_slot_names = generator.get_function_slot_names(name)
|
yield lazy_context
|
||||||
if iter_slot_names:
|
return iterate()
|
||||||
yield LazyKnownContexts(
|
|
||||||
generator.execute_function_slots(iter_slot_names)
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
debug.warning('Instance has no __next__ function in %s.', generator)
|
|
||||||
else:
|
|
||||||
for lazy_context in generator.py__iter__():
|
|
||||||
yield lazy_context
|
|
||||||
|
|
||||||
@abstractproperty
|
@abstractproperty
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user