예제 #1
0
파일: sequence.py 프로젝트: joycse06/piep
    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)))
예제 #2
0
파일: sequence.py 프로젝트: john9631/piep
 def __str__(self):
     return Line("\n".join(list(self.src)))
예제 #3
0
 def make_stream(f):
     return Stream(imap(lambda x: Line(x.rstrip('\n\r')), iter(f)))
예제 #4
0
	def __getattr__(self, attr):
		return getattr(Line(self), attr)