mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-27 17:52:17 +08:00
Get rid of get_exact_index_types.
This commit is contained in:
@@ -72,14 +72,6 @@ class Generator(use_metaclass(CachedMetaClass, IterableWrapper, GeneratorMixin))
|
|||||||
f = FunctionExecution(self._evaluator, self.func, self.var_args)
|
f = FunctionExecution(self._evaluator, self.func, self.var_args)
|
||||||
return f.get_yield_types()
|
return f.get_yield_types()
|
||||||
|
|
||||||
def get_exact_index_types(self, index):
|
|
||||||
"""
|
|
||||||
Exact lookups are used for tuple lookups, which are perfectly fine if
|
|
||||||
used with generators.
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
||||||
return list(self.py__iter__())[index]
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name not in ['start_pos', 'end_pos', 'parent', 'get_imports',
|
if name not in ['start_pos', 'end_pos', 'parent', 'get_imports',
|
||||||
'doc', 'docstr', 'get_parent_until',
|
'doc', 'docstr', 'get_parent_until',
|
||||||
@@ -163,10 +155,6 @@ class Comprehension(IterableWrapper):
|
|||||||
for result in nested(comp_fors):
|
for result in nested(comp_fors):
|
||||||
yield result
|
yield result
|
||||||
|
|
||||||
def get_exact_index_types(self, index):
|
|
||||||
return list(self.py__iter__())[index]
|
|
||||||
return set([list(self._evaluator.eval_element(self.eval_node()))[index]])
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s of %s>" % (type(self).__name__, self._atom)
|
return "<%s of %s>" % (type(self).__name__, self._atom)
|
||||||
|
|
||||||
@@ -343,10 +331,6 @@ class FakeSequence(_FakeArray):
|
|||||||
def _items(self):
|
def _items(self):
|
||||||
return self._sequence_values
|
return self._sequence_values
|
||||||
|
|
||||||
def get_exact_index_types(self, index):
|
|
||||||
value = self._sequence_values[index]
|
|
||||||
return self._evaluator.eval_element(value)
|
|
||||||
|
|
||||||
|
|
||||||
class AlreadyEvaluated(frozenset):
|
class AlreadyEvaluated(frozenset):
|
||||||
"""A simple container to add already evaluated objects to an array."""
|
"""A simple container to add already evaluated objects to an array."""
|
||||||
@@ -379,9 +363,6 @@ class MergedArray(_FakeArray):
|
|||||||
super(MergedArray, self).__init__(evaluator, arrays, arrays[-1].type)
|
super(MergedArray, self).__init__(evaluator, arrays, arrays[-1].type)
|
||||||
self._arrays = arrays
|
self._arrays = arrays
|
||||||
|
|
||||||
def get_exact_index_types(self, mixed_index):
|
|
||||||
raise IndexError
|
|
||||||
|
|
||||||
def py__iter__(self):
|
def py__iter__(self):
|
||||||
for array in self._arrays:
|
for array in self._arrays:
|
||||||
for types in array.py__iter__():
|
for types in array.py__iter__():
|
||||||
|
|||||||
Reference in New Issue
Block a user