Revision 1962
Added by Aaron Marcuse-Kubitza over 12 years ago
streams.py | ||
---|---|---|
59 | 59 |
|
60 | 60 |
##### Filtered/traced streams |
61 | 61 |
|
62 |
class FilterStream(WrapStream):
|
|
62 |
class FilterStream(StreamIter):
|
|
63 | 63 |
'''Wraps a stream, filtering each string read or written''' |
64 | 64 |
def __init__(self, filter_, stream): |
65 |
WrapStream.__init__(self, stream)
|
|
65 |
StreamIter.__init__(self, stream)
|
|
66 | 66 |
self.filter = filter_ |
67 | 67 |
|
68 | 68 |
def readline(self): return self.filter(self.stream.readline()) |
Also available in: Unified diff
streams.py: FilterStream: Inherit from StreamIter so that all descendants automatically have StreamIter functionality