Show More
@@ -189,11 +189,11 b' def findsource(object):' | |||
|
189 | 189 | # use the one with the least indentation, which is the one |
|
190 | 190 | # that's most probably not inside a function definition. |
|
191 | 191 | candidates = [] |
|
192 |
for i in |
|
|
193 |
match = pat.match(line |
|
|
192 | for i, line in enumerate(lines): | |
|
193 | match = pat.match(line) | |
|
194 | 194 | if match: |
|
195 | 195 | # if it's at toplevel, it's already the best one |
|
196 |
if line |
|
|
196 | if line[0] == 'c': | |
|
197 | 197 | return lines, i |
|
198 | 198 | # else add whitespace to candidate list |
|
199 | 199 | candidates.append((match.group(1), i)) |
@@ -358,7 +358,7 b' def _fixed_getinnerframes(etb, context=1, tb_offset=0):' | |||
|
358 | 358 | |
|
359 | 359 | aux = traceback.extract_tb(etb) |
|
360 | 360 | assert len(records) == len(aux) |
|
361 |
for i, (file, lnum, _, _) in |
|
|
361 | for i, (file, lnum, _, _) in enumerate(aux): | |
|
362 | 362 | maybeStart = lnum - 1 - context // 2 |
|
363 | 363 | start = max(maybeStart, 0) |
|
364 | 364 | end = start + context |
@@ -84,7 +84,7 b' def token_at_cursor(cell, cursor_pos=0):' | |||
|
84 | 84 | if end_line + 1 not in offsets: |
|
85 | 85 | # keep track of offsets for each line |
|
86 | 86 | lines = tok.line.splitlines(True) |
|
87 |
for lineno, line in |
|
|
87 | for lineno, line in enumerate(lines, start_line + 1): | |
|
88 | 88 | if lineno not in offsets: |
|
89 | 89 | offsets[lineno] = offsets[lineno-1] + len(line) |
|
90 | 90 |
General Comments 0
You need to be logged in to leave comments.
Login now