def flatten(self): r''' Combine a sequence of strings (containing newlines) into a sequence of lines. >>> list(Stream(["a\nb\nc","d\ne"]).flatten()) ['a', 'b', 'c', 'd', 'e'] ''' return self._replace( chain.from_iterable(map(lambda x: Line(x).splitlines(), self.src)))
def __str__(self): return Line("\n".join(list(self.src)))
def make_stream(f): return Stream(imap(lambda x: Line(x.rstrip('\n\r')), iter(f)))
def __getattr__(self, attr): return getattr(Line(self), attr)