1
0
forked from VimPlug/jedi

per_index_values is now a method that all the iterable objects should support. however its name is confusing and it should soon be refactored.

This commit is contained in:
Dave Halter
2015-11-03 17:35:45 +01:00
parent 84c43bf2dc
commit 99739aa640

View File

@@ -395,18 +395,18 @@ class MergedArray(_FakeArray):
def ordered_elements_of_iterable(evaluator, iterable_type, all_values): def ordered_elements_of_iterable(evaluator, iterable_type, all_values):
""" """
This function returns the ordered types of an iterable. If the input is not This function returns the ordered types of an iterable.
an Array, we just return all types as the first and only item of the
output list.
""" """
ordered = [] ordered = []
# Unpack the iterator values # Unpack the iterator values
for sequence in iterable_type: for sequence in iterable_type:
if not isinstance(sequence, Array): try:
per_index_values = sequence.per_index_values
except AttributeError:
ordered = [literals_to_types(evaluator, all_values)] ordered = [literals_to_types(evaluator, all_values)]
break break
else: else:
for i, types in enumerate(sequence.per_index_values()): for i, types in enumerate(per_index_values()):
try: try:
ordered[i] |= types ordered[i] |= types
except IndexError: except IndexError: