1
0
forked from VimPlug/jedi

Introduce py__next__ to have more clear way to use __next__

This commit is contained in:
Dave Halter
2020-07-17 12:05:59 +02:00
parent d63fbd8624
commit d1851c369c
4 changed files with 24 additions and 18 deletions

View File

@@ -23,6 +23,9 @@ from jedi.inference.value.dynamic_arrays import check_array_additions
class IterableMixin(object):
def py__next__(self, contextualized_node=None):
return self.py__iter__(contextualized_node)
def py__stop_iteration_returns(self):
return ValueSet([compiled.builtin_from_name(self.inference_state, u'None')])
@@ -64,7 +67,7 @@ class GeneratorBase(LazyAttributeOverwrite, IterableMixin):
@publish_method('send')
@publish_method('next', python_version_match=2)
@publish_method('__next__', python_version_match=3)
def py__next__(self, arguments):
def _next(self, arguments):
return ValueSet.from_sets(lazy_value.infer() for lazy_value in self.py__iter__())
def py__stop_iteration_returns(self):