equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python |
|
2 |
|
3 # Filters traceback lines from stdin. |
|
4 |
|
5 from __future__ import absolute_import, print_function |
|
6 |
|
7 import sys |
|
8 |
|
9 state = 'none' |
|
10 |
|
11 for line in sys.stdin: |
|
12 if state == 'none': |
|
13 if line.startswith('Traceback '): |
|
14 state = 'tb' |
|
15 |
|
16 elif state == 'tb': |
|
17 if line.startswith(' File '): |
|
18 state = 'file' |
|
19 continue |
|
20 |
|
21 elif not line.startswith(' '): |
|
22 state = 'none' |
|
23 |
|
24 elif state == 'file': |
|
25 # Ignore lines after " File " |
|
26 state = 'tb' |
|
27 continue |
|
28 |
|
29 print(line, end='') |