Show More
@@ -81,7 +81,7 b' def cell_magic(lines):' | |||||
81 | # ----- |
|
81 | # ----- | |
82 |
|
82 | |||
83 | def _find_assign_op(token_line): |
|
83 | def _find_assign_op(token_line): | |
84 |
# |
|
84 | # Get the index of the first assignment in the line ('=' not inside brackets) | |
85 | # We don't try to support multiple special assignment (a = b = %foo) |
|
85 | # We don't try to support multiple special assignment (a = b = %foo) | |
86 | paren_level = 0 |
|
86 | paren_level = 0 | |
87 | for i, ti in enumerate(token_line): |
|
87 | for i, ti in enumerate(token_line): | |
@@ -91,6 +91,7 b' def _find_assign_op(token_line):' | |||||
91 | if s in '([{': |
|
91 | if s in '([{': | |
92 | paren_level += 1 |
|
92 | paren_level += 1 | |
93 | elif s in ')]}': |
|
93 | elif s in ')]}': | |
|
94 | if paren_level > 0: | |||
94 | paren_level -= 1 |
|
95 | paren_level -= 1 | |
95 |
|
96 | |||
96 | def find_end_of_continued_line(lines, start_line: int): |
|
97 | def find_end_of_continued_line(lines, start_line: int): | |
@@ -386,6 +387,7 b' def make_tokens_by_line(lines):' | |||||
386 | elif token.string in {'(', '[', '{'}: |
|
387 | elif token.string in {'(', '[', '{'}: | |
387 | parenlev += 1 |
|
388 | parenlev += 1 | |
388 | elif token.string in {')', ']', '}'}: |
|
389 | elif token.string in {')', ']', '}'}: | |
|
390 | if parenlev > 0: | |||
389 | parenlev -= 1 |
|
391 | parenlev -= 1 | |
390 | except tokenize.TokenError: |
|
392 | except tokenize.TokenError: | |
391 | # Input ended in a multiline string or expression. That's OK for us. |
|
393 | # Input ended in a multiline string or expression. That's OK for us. |
General Comments 0
You need to be logged in to leave comments.
Login now