From 73eb21e85072caa482670824313c6ae533e86b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 3 Nov 2019 23:23:00 +0100 Subject: [PATCH] fix log analyzer --- benchmark/classic/data/log_analyze.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/benchmark/classic/data/log_analyze.py b/benchmark/classic/data/log_analyze.py index 1c100ab..2049890 100644 --- a/benchmark/classic/data/log_analyze.py +++ b/benchmark/classic/data/log_analyze.py @@ -22,26 +22,27 @@ def readfile() -> list: with open("log.txt", 'r') as inputFile: line = inputFile.readline() while line: - line = inputFile.readline() try: linedict = json.loads(line) lines.append(linedict) except json.JSONDecodeError: continue + finally: + line = inputFile.readline() return lines def readconfigdates() -> dict: dates = {} with open("dates.txt", 'r') as inputFile: - line = inputFile.readline() + line = inputFile.readline().rstrip() currline = 0 while line: - line = inputFile.readline() - currline += 1 dateformatted = datetime.datetime.strptime( line, '%Y-%m-%d %H:%M:%S') dates[currline] = dateformatted + line = inputFile.readline().rstrip() + currline += 1 return dates