Skip to content

Commit 4050e97

Browse files
fix bug in append_line in TextFile, fix bug in JsonLineFile.read_line
1 parent f7413a2 commit 4050e97

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pysenal/io/file.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,12 @@ def append_line(self, line):
379379
self._to_append()
380380
if not line.endswith('\n'):
381381
line += '\n'
382+
self._file.write(line)
382383

383384
def append_lines(self, lines):
384385
self._to_append()
385386
for line in lines:
386-
if not line.endswith('\n'):
387-
line += '\n'
388-
self._file.write(line)
387+
self.append_line(line)
389388

390389

391390
class JsonLineFile(TextFile):
@@ -402,7 +401,7 @@ def read(self):
402401
def read_line(self):
403402
self._to_read()
404403
for line in self._file:
405-
yield line
404+
yield json.loads(line)
406405

407406
def write(self, data):
408407
super().write(data)

0 commit comments

Comments
 (0)