From 37ae75f27dcf1505a991fe6da70b9f28f29709d6 Mon Sep 17 00:00:00 2001 From: Daniel Kutik Date: Tue, 13 Dec 2022 10:01:45 +0100 Subject: [PATCH] update_manpages.py: treat regex as raw string Treat the values in the regex map as raw strings to fix Invalid escape sequence 'g' (W605). Change-Id: I53bf5d6bd1e1d6a1d1293e4f55640b6513bf3075 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354698 Tested-by: Daniel Kutik Reviewed-by: Mike Frysinger --- release/update_manpages.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release/update_manpages.py b/release/update_manpages.py index 9cbb43b6..d1bf8928 100644 --- a/release/update_manpages.py +++ b/release/update_manpages.py @@ -109,10 +109,10 @@ def replace_regex(data): Updated manpage text. """ regex = ( - (r'(It was generated by help2man) [0-9.]+', '\g<1>.'), - (r'^\033\[[0-9;]*m([^\033]*)\033\[m', '\g<1>'), - (r'^\.IP\n(.*:)\n', '.SS \g<1>\n'), - (r'^\.PP\nDescription', '.SH DETAILS'), + (r'(It was generated by help2man) [0-9.]+', r'\g<1>.'), + (r'^\033\[[0-9;]*m([^\033]*)\033\[m', r'\g<1>'), + (r'^\.IP\n(.*:)\n', r'.SS \g<1>\n'), + (r'^\.PP\nDescription', r'.SH DETAILS'), ) for pattern, replacement in regex: data = re.sub(pattern, replacement, data, flags=re.M)