Skip to content

Commit ad6e64c

Browse files
committed
Missed the writeln_decorator file while updating from hg
1 parent a742dca commit ad6e64c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

python 3/runner/writeln_decorator.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
import sys
5+
import os
6+
7+
# Taken from legacy python unittest
8+
class WritelnDecorator:
9+
"""Used to decorate file-like objects with a handy 'writeln' method"""
10+
def __init__(self,stream):
11+
self.stream = stream
12+
13+
def __getattr__(self, attr):
14+
return getattr(self.stream,attr)
15+
16+
def writeln(self, arg=None):
17+
if arg: self.write(arg)
18+
self.write('\n') # text-mode streams translate to \r\n if needed
19+

0 commit comments

Comments
 (0)