Lines Matching refs:stream

79     def _set_valid_stream(self, stream):  argument
80 if stream is None:
82 return stream
84 def _write(self, text, stream): argument
111 stream = self._set_valid_stream(stream)
112 stream.py.write(text.replace(r'\>', '>'))
145 self._stack[-1](before, lock=_null_lock, stream=stream)
151 colors[color](within, lock=_null_lock, stream=stream)
156 self._stack[-1](after, lock=_null_lock, stream=stream)
158 def flush(self, stream): argument
159 stream = self._set_valid_stream(stream)
160 stream.py.flush()
162 def auto(self, text, stream=None, lock=_lock): argument
164 stream = self._set_valid_stream(stream)
182 fn(line, stream=stream, lock=_null_lock)
185 self.default(line, stream=stream, lock=_null_lock)
195 def red_impl(self, text, stream=None, **kwargs): argument
202 def yellow_impl(self, text, stream=None, **kwargs): argument
210 def green_impl(self, text, stream=None, **kwargs): argument
218 def blue_impl(self, text, stream=None, **kwargs): argument
226 def default_impl(self, text, stream=None, **kwargs): argument
242 for stream in (None, self.__class__.stderr):
244 if stream is None else 'stderr ', stream)
246 fn(string, stream)
247 self.default('\n', stream)
267 for stream in (None, self.__class__.stderr):
268 stream_name = 'stdout' if stream is None else 'stderr'
269 fn('{} {}\n'.format(stream_name, text), stream)
274 def red_impl(self, text, stream=None, **kwargs): argument
275 self._write('[R]{}[/R]'.format(text), stream)
277 def yellow_impl(self, text, stream=None, **kwargs): argument
278 self._write('[Y]{}[/Y]'.format(text), stream)
280 def green_impl(self, text, stream=None, **kwargs): argument
281 self._write('[G]{}[/G]'.format(text), stream)
283 def blue_impl(self, text, stream=None, **kwargs): argument
284 self._write('[B]{}[/B]'.format(text), stream)
286 def default_impl(self, text, stream=None, **kwargs): argument
287 self._write('[D]{}[/D]'.format(text), stream)
291 stream = Stream(StringIO())
292 o.red('hello', stream)
293 self.assertEqual(stream.py.getvalue(), '[R]hello[/R]')
297 stream = Stream(StringIO())
298 o.yellow('hello', stream)
299 self.assertEqual(stream.py.getvalue(), '[Y]hello[/Y]')
303 stream = Stream(StringIO())
304 o.green('hello', stream)
305 self.assertEqual(stream.py.getvalue(), '[G]hello[/G]')
309 stream = Stream(StringIO())
310 o.blue('hello', stream)
311 self.assertEqual(stream.py.getvalue(), '[B]hello[/B]')
315 stream = Stream(StringIO())
316 o.default('hello', stream)
317 self.assertEqual(stream.py.getvalue(), '[D]hello[/D]')
321 stream = Stream(StringIO())
323 o.auto('bar\n', stream)
324 o.auto('foo\n', stream)
325 o.auto('baz\n', stream)
326 self.assertEqual(stream.py.getvalue(),
329 stream = Stream(StringIO())
330 o.auto('bar\nfoo\nbaz\n', stream)
331 self.assertEqual(stream.py.getvalue(),
334 stream = Stream(StringIO())
335 o.auto('barfoobaz\nbardoobaz\n', stream)
336 self.assertEqual(stream.py.getvalue(),
340 stream = Stream(StringIO())
341 o.auto('barfoobaz\nbardoobaz\n', stream)
342 self.assertEqual(stream.py.getvalue(),
350 stream = Stream(StringIO())
351 o.auto('foo\nbar\nbaz\n', stream)
352 self.assertEqual(stream.py.getvalue(),
355 stream = Stream(StringIO())
356 o.auto('foo\nbar\nbaz\n', stream)
357 self.assertEqual(stream.py.getvalue(),
360 stream = Stream(StringIO())
361 o.yellow('<a>foo</>bar<a>baz</>', stream)
363 stream.py.getvalue(),
368 stream = Stream(StringIO())
369 o.auto('<r>hi</>', stream)
370 self.assertEqual(stream.py.getvalue(),
373 stream = Stream(StringIO())
374 o.auto('<r><y>a</>b</>c', stream)
376 stream.py.getvalue(),
380 o.auto('<r>hi', stream)
383 o.auto('hi</>', stream)
386 o.auto('<r><y>hi</>', stream)
389 o.auto('<r><y>hi</><r></>', stream)
392 o.auto('</>hi<r>', stream)