1
0
forked from VimPlug/jedi

remove close_brackets - not needed anymore

This commit is contained in:
David Halter
2013-02-08 02:43:05 +01:00
parent 5737e3ad1d
commit d82b8d5e19
2 changed files with 4 additions and 14 deletions

View File

@@ -767,11 +767,11 @@ class Array(use_metaclass(cache.CachedMetaClass, pr.Base)):
""" Get the types of a specific index or all, if not given """ """ Get the types of a specific index or all, if not given """
# array slicing # array slicing
if index_call_list is not None: 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] return [self]
index_possibilities = list(evaluate.follow_call_list( index_possibilities = [evaluate.follow_statement(i) for i in index_call_list]
index_call_list))
if len(index_possibilities) == 1: if len(index_possibilities) == 1:
# This is indexing only one element, with a fixed index number, # This is indexing only one element, with a fixed index number,
# otherwise it just ignores the index (e.g. [1+1]). # otherwise it just ignores the index (e.g. [1+1]).

View File

@@ -816,7 +816,6 @@ class Statement(Simple):
self._assignment_details = [] self._assignment_details = []
result = [] result = []
is_chain = False is_chain = False
close_brackets = False
brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET} brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET}
closing_brackets = ')', '}', ']' closing_brackets = ')', '}', ']'
@@ -835,9 +834,7 @@ class Statement(Simple):
# This means, there is an assignment here. # This means, there is an assignment here.
# Add assignments, which can be more than one # Add assignments, which can be more than one
self._assignment_details.append((tok, result)) self._assignment_details.append((tok, result))
# nonlocal plz!
result = [] result = []
close_brackets = False
is_chain = False is_chain = False
continue continue
elif tok == 'as': # just ignore as elif tok == 'as': # just ignore as
@@ -860,31 +857,24 @@ class Statement(Simple):
else: else:
result.append(call) result.append(call)
is_chain = False is_chain = False
close_brackets = False
elif tok in brackets.keys(): elif tok in brackets.keys():
arr = parse_array(token_iterator, brackets[tok], start_pos) arr = parse_array(token_iterator, brackets[tok], start_pos)
if result and (isinstance(result[-1], Call) or close_brackets): if result and isinstance(result[-1], Call):
print 'x', arr
result[-1].set_execution(arr) result[-1].set_execution(arr)
else: else:
print arr
arr.parent = self arr.parent = self
result.append(arr) result.append(arr)
#print(tok, result) #print(tok, result)
close_brackets = True
elif tok == '.': elif tok == '.':
close_brackets = False
if result and isinstance(result[-1], Call): if result and isinstance(result[-1], Call):
is_chain = True is_chain = True
elif tok == ',': # implies a tuple elif tok == ',': # implies a tuple
close_brackets = False
# rewrite `result`, because now the whole thing is a tuple # rewrite `result`, because now the whole thing is a tuple
add_el, t = parse_array_el(enumerate(result), start_pos) add_el, t = parse_array_el(enumerate(result), start_pos)
arr = parse_array(token_iterator, Array.TUPLE, start_pos, arr = parse_array(token_iterator, Array.TUPLE, start_pos,
add_el) add_el)
result = [arr] result = [arr]
else: else:
close_brackets = False
if tok != '\n': if tok != '\n':
result.append(tok) result.append(tok)
return result return result