Ejemplo n.º 1
0
    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)))
Ejemplo n.º 2
0
 def __str__(self):
     return Line("\n".join(list(self.src)))
Ejemplo n.º 3
0
 def make_stream(f):
     return Stream(imap(lambda x: Line(x.rstrip('\n\r')), iter(f)))
Ejemplo n.º 4
0
	def __getattr__(self, attr):
		return getattr(Line(self), attr)