Unverified Commit 70363bcc authored by Jie Fu (傅杰)'s avatar Jie Fu (傅杰) Committed by GitHub
Browse files

Fix syntaxWarning: invalid escape sequence '\s' (#16532)


Signed-off-by: default avatarJie Fu <jiefu@tencent.com>
parent 3cdc5766
......@@ -1233,8 +1233,8 @@ class SortedHelpFormatter(ArgumentDefaultsHelpFormatter):
3. Each line is wrapped to the specified width (width of terminal).
"""
# The patterns also include whitespace after the newline
single_newline = re.compile("(?<!\n)\n(?!\n)\s*")
multiple_newlines = re.compile("\n{2,}\s*")
single_newline = re.compile(r"(?<!\n)\n(?!\n)\s*")
multiple_newlines = re.compile(r"\n{2,}\s*")
text = single_newline.sub(' ', text)
lines = re.split(multiple_newlines, text)
return sum([textwrap.wrap(line, width) for line in lines], [])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment