mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-24 17:28:36 +08:00
Get completely rid of iter_content.
This commit is contained in:
@@ -70,15 +70,6 @@ class Generator(use_metaclass(CachedMetaClass, IterableWrapper, GeneratorMixin))
|
|||||||
self.func = func
|
self.func = func
|
||||||
self.var_args = var_args
|
self.var_args = var_args
|
||||||
|
|
||||||
def iter_content(self):
|
|
||||||
""" returns the content of __iter__ """
|
|
||||||
# Directly execute it, because with a normal call to py__call__ a
|
|
||||||
# Generator will be returned.
|
|
||||||
raise NotImplementedError
|
|
||||||
from jedi.evaluate.representation import FunctionExecution
|
|
||||||
f = FunctionExecution(self._evaluator, self.func, self.var_args)
|
|
||||||
return f.get_return_types(check_yields=True)
|
|
||||||
|
|
||||||
def py__iter__(self):
|
def py__iter__(self):
|
||||||
from jedi.evaluate.representation import FunctionExecution
|
from jedi.evaluate.representation import FunctionExecution
|
||||||
f = FunctionExecution(self._evaluator, self.func, self.var_args)
|
f = FunctionExecution(self._evaluator, self.func, self.var_args)
|
||||||
@@ -204,11 +195,6 @@ class ListComprehension(Comprehension, ArrayMixin):
|
|||||||
|
|
||||||
def get_index_types(self, evaluator, index):
|
def get_index_types(self, evaluator, index):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
return self.iter_content()
|
|
||||||
|
|
||||||
def iter_content(self):
|
|
||||||
raise NotImplementedError
|
|
||||||
return self._evaluator.eval_element(self.eval_node())
|
|
||||||
|
|
||||||
def py__getitem__(self, index):
|
def py__getitem__(self, index):
|
||||||
all_types = list(self.py__iter__())
|
all_types = list(self.py__iter__())
|
||||||
@@ -220,9 +206,7 @@ class ListComprehension(Comprehension, ArrayMixin):
|
|||||||
|
|
||||||
|
|
||||||
class GeneratorComprehension(Comprehension, GeneratorMixin):
|
class GeneratorComprehension(Comprehension, GeneratorMixin):
|
||||||
def iter_content(self):
|
pass
|
||||||
raise NotImplementedError
|
|
||||||
return self._evaluator.eval_element(self.eval_node())
|
|
||||||
|
|
||||||
|
|
||||||
class Array(IterableWrapper, ArrayMixin):
|
class Array(IterableWrapper, ArrayMixin):
|
||||||
@@ -299,10 +283,6 @@ class Array(IterableWrapper, ArrayMixin):
|
|||||||
else:
|
else:
|
||||||
return self._evaluator.eval_element(self._items()[index])
|
return self._evaluator.eval_element(self._items()[index])
|
||||||
|
|
||||||
def iter_content(self):
|
|
||||||
raise NotImplementedError
|
|
||||||
return self.values()
|
|
||||||
|
|
||||||
@safe_property
|
@safe_property
|
||||||
def parent(self):
|
def parent(self):
|
||||||
return self._evaluator.BUILTINS
|
return self._evaluator.BUILTINS
|
||||||
@@ -701,23 +681,6 @@ class _ArrayInstance(IterableWrapper):
|
|||||||
self.instance = instance
|
self.instance = instance
|
||||||
self.var_args = instance.var_args
|
self.var_args = instance.var_args
|
||||||
|
|
||||||
def iter_content(self):
|
|
||||||
"""
|
|
||||||
The index is here just ignored, because of all the appends, etc.
|
|
||||||
lists/sets are too complicated too handle that.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
items = set()
|
|
||||||
for key, nodes in self.var_args.unpack():
|
|
||||||
for node in nodes:
|
|
||||||
types = self._evaluator.eval_element(node)
|
|
||||||
items |= py__iter__types(self._evaluator, types, node)
|
|
||||||
|
|
||||||
module = self.var_args.get_parent_until()
|
|
||||||
is_list = str(self.instance.name) == 'list'
|
|
||||||
items |= _check_array_additions(self._evaluator, self.instance, module, is_list)
|
|
||||||
return items
|
|
||||||
|
|
||||||
def py__iter__(self):
|
def py__iter__(self):
|
||||||
try:
|
try:
|
||||||
_, first_nodes = next(self.var_args.unpack())
|
_, first_nodes = next(self.var_args.unpack())
|
||||||
|
|||||||
Reference in New Issue
Block a user