From a793fc20298d61c755f30803efe9ab42fb6b33a0 Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Mon, 25 Nov 2024 10:54:38 +1100 Subject: [PATCH] Use r-strings And run black to keep things tidy Closes #284. --- mk-appendix.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mk-appendix.py b/mk-appendix.py index 6949967..4a77d10 100644 --- a/mk-appendix.py +++ b/mk-appendix.py @@ -7,6 +7,7 @@ IN_APPENDIX = None CURRENT = "" + def print_syntax(val): vl = val.split("\n") last_empty = False @@ -24,24 +25,24 @@ def print_syntax(val): for l in sys.stdin: if not IN_APPENDIX: - m = re.match('%%% (.*)$', l) + m = re.match(r"%%% (.*)$", l) if m is not None: IN_APPENDIX = m.group(1) else: - m = re.match('%%(#+|!) (.*)$', l) + m = re.match(r"%%(#+|!) (.*)$", l) if m is not None: - if m.group(1) != '!': + if m.group(1) != "!": print("%s %s" % (m.group(1), m.group(2))) print_syntax(APPENDICES[m.group(2)]) del APPENDICES[m.group(2)] print() else: - print(l, end='') + print(l, end="") else: # Strip out everything marked as RESERVED if l.find("RESERVED") == -1: - print(l, end='') - m = re.match("\S", l) + print(l, end="") + m = re.match(r"\S", l) if m is None: CURRENT += l else: