Skip to content

Commit 05de381

Browse files
website: local_replace.py: Using raw strings for clarity (suggested by Thomas Arendsen Hein). One test fixed.
1 parent 559f8c7 commit 05de381

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

website/issues/extensions/local_replace.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import re
22

3-
substitutions = [ (re.compile('debian:\#(?P<id>\d+)'),
4-
'<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\g<id>">debian#\g<id></a>' ),
5-
(re.compile('\#(?P<ws>\s*)(?P<id>\d+)'),
6-
"<a href='issue\g<id>'>#\g<ws>\g<id></a>" ),
7-
(re.compile('(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'),
8-
"\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ),
3+
substitutions = [ (re.compile(r'debian:\#(?P<id>\d+)'),
4+
r'<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\g<id>">debian#\g<id></a>' ),
5+
(re.compile(r'\#(?P<ws>\s*)(?P<id>\d+)'),
6+
r"<a href='issue\g<id>'>#\g<ws>\g<id></a>" ),
7+
(re.compile(r'(?P<prews>^|\s+)issue(?P<ws>\s*)(?P<id>\d+)'),
8+
r"\g<prews><a href='issue\g<id>'>issue\g<ws>\g<id></a>" ),
99
# matching hg revison number or hash
10-
(re.compile('(?P<prews>^|\s+)(?P<revstr>(revision|rev|r)\s?)(?P<revision>([1-9][0-9]*)|[0-9a-fA-F]{4,40})(?P<post>\W+|$)'),
11-
"\g<prews><a href='http://sourceforge.net/p/roundup/code/ci/\g<revision>'>\g<revstr>\g<revision></a>\g<post>"),
10+
(re.compile(r'(?P<prews>^|\s+)(?P<revstr>(revision|rev|r)\s?)(?P<revision>([1-9][0-9]*)|[0-9a-fA-F]{4,40})(?P<post>\W+|$)'),
11+
r"\g<prews><a href='http://sourceforge.net/p/roundup/code/ci/\g<revision>'>\g<revstr>\g<revision></a>\g<post>"),
1212
]
1313

1414
def local_replace(message):
@@ -40,7 +40,7 @@ def quicktest(msgstr, should_replace = True):
4040
quicktest("re-evaluate", False)
4141
quicktest("rex140eb", False)
4242
quicktest("rev 012", False) # too short for a hg hash
43-
quicktest("rev 0123", False) # too short for a hg hash
43+
quicktest("rev 0123")
4444
quicktest("re140eb")
4545
quicktest(" r7140eb")
4646
quicktest(" rev7140eb ")

0 commit comments

Comments
 (0)