Skip to content

Commit edaf507

Browse files
committed
[IMP] runbot_merge: make space characters in regexes clearer
pycharm is a bit dumb so it considers `[ ]` to be unnecessary even in `re.VERBOSE` regexes. But it has a bit of a point in that it's not super clear, so inject the space characters by (unicode) name, the behaviour should be the exact same but the regexes should be slightly less opaque.
1 parent 60b8449 commit edaf507

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

runbot_merge/models/stagings_create.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ def add_self_references(
691691
))
692692

693693
BREAK = re.compile(r'''
694-
[ ]{0,3} # 0-3 spaces of indentation
694+
\N{SPACE}{0,3} # 0-3 spaces of indentation
695695
# followed by a sequence of three or more matching -, _, or * characters,
696696
# each followed optionally by any number of spaces or tabs
697697
# so needs to start with a _, - or *, then have at least 2 more such
@@ -701,9 +701,9 @@ def add_self_references(
701701
[ \t]*
702702
''', flags=re.VERBOSE)
703703
SETEX_UNDERLINE = re.compile(r'''
704-
[ ]{0,3} # no more than 3 spaces indentation
704+
\N{SPACE}{0,3} # no more than 3 spaces indentation
705705
[-=]+ # a sequence of = characters or a sequence of - characters
706-
[ ]* # any number of trailing spaces
706+
\N{SPACE}* # any number of trailing spaces
707707
# we don't care about "a line containing a single -" because we want to
708708
# disambiguate SETEX headings from thematic breaks, and thematic breaks have
709709
# 3+ -. Doesn't look like GH interprets `- - -` as a line so yay...

0 commit comments

Comments
 (0)