Revision 1684
Added by Aaron Marcuse-Kubitza almost 13 years ago
inputs/REMIB/src/nodes.make | ||
---|---|---|
64 | 64 |
profiler = profiling.ItersProfiler(start_now=True, iter_text='row') |
65 | 65 |
|
66 | 66 |
filename = 'node.'+str(node_id)+'.specimens.csv' |
67 |
out = streams.LineCountOutputStream(open(filename, 'w'))
|
|
67 |
out = streams.LineCountStream(open(filename, 'w')) |
|
68 | 68 |
def log_ex(e): |
69 | 69 |
clear_line() |
70 | 70 |
log('! Output line '+str(out.line_num)+': '+exc.str_(e)) |
lib/streams.py | ||
---|---|---|
54 | 54 |
self.trace(str_) |
55 | 55 |
return self.stream.write(str_) |
56 | 56 |
|
57 |
class LineCountOutputStream(TracedStream):
|
|
58 |
'''Wraps an output stream, making the current line number available.
|
|
57 |
class LineCountStream(TracedStream): |
|
58 |
'''Wraps a unidirectional stream, making the current line number available.
|
|
59 | 59 |
Lines start counting from 1.''' |
60 | 60 |
def __init__(self, stream): |
61 | 61 |
self.line_num = 1 |
Also available in: Unified diff
streams.py: Renamed LineCountOutputStream to LineCountStream since TracedStream now works on both input and output streams