Revision 14586
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/lib/csvs.py | ||
---|---|---|
183 | 183 |
try: return self.reader.next() |
184 | 184 |
except StopIteration: return '' # EOF |
185 | 185 |
|
186 |
class ProgressInputFilter(streams.ProgressInputStream): # is also a reader |
|
187 |
# ProgressInputStream extends StreamIter, so this can be used as a reader |
|
188 |
'''wraps a reader, reporting the # rows read every n rows and after the last |
|
189 |
row is read |
|
190 |
@param log the output stream for progress messages |
|
191 |
''' |
|
192 |
def __init__(self, reader, log, msg='Read %d row(s)', n=100): |
|
193 |
streams.ProgressInputStream.__init__(self, StreamFilter(reader), log, |
|
194 |
msg, n) |
|
195 |
|
|
186 | 196 |
class ColInsertFilter(Filter): |
187 | 197 |
'''Adds column(s) to each row |
188 | 198 |
@param mk_value(row, row_num) | literal_value |
Also available in: Unified diff
lib/csvs.py: added ProgressInputFilter, analogous to streams.ProgressInputStream