[nodes/io] adds support for encoding kwarg to all file readers/writers (tests needed!).

This commit is contained in:
Romain Dorgueil
2017-05-25 12:42:10 +02:00
parent 33498b2311
commit 046b65aa2f

View File

@ -18,6 +18,7 @@ class FileHandler(Configurable):
path = Option(str, required=True, positional=True) # type: str
eol = Option(str, default='\n') # type: str
mode = Option(str) # type: str
encoding = Option(str, default='utf-8') # type: str
fs = Service('fs') # type: str
@ -27,7 +28,7 @@ class FileHandler(Configurable):
yield file
def open(self, fs):
return fs.open(self.path, self.mode)
return fs.open(self.path, self.mode, encoding=self.encoding)
class Reader(FileHandler):