# HG changeset patch # User Matt Harbison # Date 1577514905 18000 # Node ID 6d3b67a837a6729247407bd6bcdb7b5c2f016f17 # Parent ac3cb5e05a38d68b2ea68af3c95d865d4e030e6f cleanup: drop redundant character escapes from `[]` character sets Flagged by PyCharm. Most special characters lose their special meaning inside square brackets. The `-` in util.py doesn't need to be escaped because it is the last character in the set. Differential Revision: https://phab.mercurial-scm.org/D7766 diff -r ac3cb5e05a38 -r 6d3b67a837a6 hgext/convert/cvs.py --- a/hgext/convert/cvs.py Sat Dec 28 01:12:19 2019 -0500 +++ b/hgext/convert/cvs.py Sat Dec 28 01:35:05 2019 -0500 @@ -144,9 +144,7 @@ if root.startswith(b":pserver:"): root = root[9:] - m = re.match( - r'(?:(.*?)(?::(.*?))?@)?([^:\/]*)(?::(\d*))?(.*)', root - ) + m = re.match(r'(?:(.*?)(?::(.*?))?@)?([^:/]*)(?::(\d*))?(.*)', root) if m: conntype = b"pserver" user, passw, serv, port, root = m.groups() diff -r ac3cb5e05a38 -r 6d3b67a837a6 mercurial/hgweb/wsgiheaders.py --- a/mercurial/hgweb/wsgiheaders.py Sat Dec 28 01:12:19 2019 -0500 +++ b/mercurial/hgweb/wsgiheaders.py Sat Dec 28 01:35:05 2019 -0500 @@ -13,7 +13,7 @@ import re -tspecials = re.compile(br'[ \(\)<>@,;:\\"/\[\]\?=]') +tspecials = re.compile(br'[ ()<>@,;:\\"/\[\]?=]') def _formatparam(param, value=None, quote=1): diff -r ac3cb5e05a38 -r 6d3b67a837a6 mercurial/ui.py --- a/mercurial/ui.py Sat Dec 28 01:12:19 2019 -0500 +++ b/mercurial/ui.py Sat Dec 28 01:35:05 2019 -0500 @@ -1626,7 +1626,7 @@ # prompt to start parsing. Sadly, we also can't rely on # choices containing spaces, ASCII, or basically anything # except an ampersand followed by a character. - m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt) + m = re.match(br'(?s)(.+?)\$\$([^$]*&[^ $].*)', prompt) msg = m.group(1) choices = [p.strip(b' ') for p in m.group(2).split(b'$$')] diff -r ac3cb5e05a38 -r 6d3b67a837a6 mercurial/util.py --- a/mercurial/util.py Sat Dec 28 01:12:19 2019 -0500 +++ b/mercurial/util.py Sat Dec 28 01:35:05 2019 -0500 @@ -1165,7 +1165,7 @@ """ if not v: v = version() - m = remod.match(br'(\d+(?:\.\d+){,2})[\+-]?(.*)', v) + m = remod.match(br'(\d+(?:\.\d+){,2})[+-]?(.*)', v) if not m: vparts, extra = b'', v elif m.group(2): diff -r ac3cb5e05a38 -r 6d3b67a837a6 tests/run-tests.py --- a/tests/run-tests.py Sat Dec 28 01:12:19 2019 -0500 +++ b/tests/run-tests.py Sat Dec 28 01:35:05 2019 -0500 @@ -3179,9 +3179,7 @@ expanded_args.append(arg) args = expanded_args - testcasepattern = re.compile( - br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-\.#]+))' - ) + testcasepattern = re.compile(br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-.#]+))') tests = [] for t in args: case = []