diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index d824d2b2..6ba4effc 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -767,11 +767,11 @@ class Array(use_metaclass(cache.CachedMetaClass, pr.Base)): """ Get the types of a specific index or all, if not given """ # array slicing if index_call_list is not None: - if index_call_list and [x for x in index_call_list if ':' in x]: + print index_call_list + if index_call_list and [x for x in index_call_list if ':' in x.token_list]: return [self] - index_possibilities = list(evaluate.follow_call_list( - index_call_list)) + index_possibilities = [evaluate.follow_statement(i) for i in index_call_list] if len(index_possibilities) == 1: # This is indexing only one element, with a fixed index number, # otherwise it just ignores the index (e.g. [1+1]). diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 7cf3e965..f9a0bb66 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -816,7 +816,6 @@ class Statement(Simple): self._assignment_details = [] result = [] is_chain = False - close_brackets = False brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET} closing_brackets = ')', '}', ']' @@ -835,9 +834,7 @@ class Statement(Simple): # This means, there is an assignment here. # Add assignments, which can be more than one self._assignment_details.append((tok, result)) - # nonlocal plz! result = [] - close_brackets = False is_chain = False continue elif tok == 'as': # just ignore as @@ -860,31 +857,24 @@ class Statement(Simple): else: result.append(call) is_chain = False - close_brackets = False elif tok in brackets.keys(): arr = parse_array(token_iterator, brackets[tok], start_pos) - if result and (isinstance(result[-1], Call) or close_brackets): - print 'x', arr + if result and isinstance(result[-1], Call): result[-1].set_execution(arr) else: - print arr arr.parent = self result.append(arr) #print(tok, result) - close_brackets = True elif tok == '.': - close_brackets = False if result and isinstance(result[-1], Call): is_chain = True elif tok == ',': # implies a tuple - close_brackets = False # rewrite `result`, because now the whole thing is a tuple add_el, t = parse_array_el(enumerate(result), start_pos) arr = parse_array(token_iterator, Array.TUPLE, start_pos, add_el) result = [arr] else: - close_brackets = False if tok != '\n': result.append(tok) return result