From bc31b98b328546a1f941029fb053161d8b5ed262 Mon Sep 17 00:00:00 2001 From: JoeLametta Date: Wed, 4 Dec 2019 13:14:24 +0000 Subject: [PATCH] Fix offsets.py output Every line, except the last one, of the output was missing a double quote character at the end. Additional changes: - Specify parser to avoid BeautifulSoup warning - Use single quotes only Signed-off-by: JoeLametta --- misc/offsets.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/misc/offsets.py b/misc/offsets.py index 5dac793..73fd2bc 100644 --- a/misc/offsets.py +++ b/misc/offsets.py @@ -11,7 +11,7 @@ from bs4 import BeautifulSoup with open(sys.argv[1]) as f: doc = f.read() -soup = BeautifulSoup(doc) +soup = BeautifulSoup(doc, features='html.parser') offsets = {} # offset -> total count @@ -52,8 +52,9 @@ lines = [] line = 'OFFSETS = ("' for offset in offsets: - line += offset + ", " + line += offset + ', ' if len(line) > 60: + line += '"' lines.append(line) line = ' "' @@ -62,4 +63,4 @@ if len(line) > 11: line = line[:-2] + '")' lines.append(line) -print("\n".join(lines)) +print('\n'.join(lines))