diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2019-02-01 17:00:02 -0800 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2019-09-03 14:38:38 -0400 |
commit | b21680baf5391a602b295b9d7d0ef66553661cb9 (patch) | |
tree | 014dde0638aa584215f4855341606de65ed1fb89 /test/lint/check-rpc-mappings.py | |
parent | 6e431296daceee604f48e9e3e87fa84cfd44bef2 (diff) |
test/contrib: Fix invalid escapes in regex strings
Flagged by flake8 v3.6.0, as W605, plus a few others identified
incidentally, e.g. 59ffecf66cf4d08c4b431e457b083878d66a3fd6.
Note that r"\n" matches to "\n" under re.match/search.
Diffstat (limited to 'test/lint/check-rpc-mappings.py')
-rwxr-xr-x | test/lint/check-rpc-mappings.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/lint/check-rpc-mappings.py b/test/lint/check-rpc-mappings.py index 137cc82b5d..a33ab17f3f 100755 --- a/test/lint/check-rpc-mappings.py +++ b/test/lint/check-rpc-mappings.py @@ -48,13 +48,13 @@ def process_commands(fname): for line in f: line = line.rstrip() if not in_rpcs: - if re.match("static const CRPCCommand .*\[\] =", line): + if re.match(r"static const CRPCCommand .*\[\] =", line): in_rpcs = True else: if line.startswith('};'): in_rpcs = False elif '{' in line and '"' in line: - m = re.search('{ *("[^"]*"), *("[^"]*"), *&([^,]*), *{([^}]*)} *},', line) + m = re.search(r'{ *("[^"]*"), *("[^"]*"), *&([^,]*), *{([^}]*)} *},', line) assert m, 'No match to table expression: %s' % line name = parse_string(m.group(2)) args_str = m.group(4).strip() @@ -80,7 +80,7 @@ def process_mapping(fname): if line.startswith('};'): in_rpcs = False elif '{' in line and '"' in line: - m = re.search('{ *("[^"]*"), *([0-9]+) *, *("[^"]*") *},', line) + m = re.search(r'{ *("[^"]*"), *([0-9]+) *, *("[^"]*") *},', line) assert m, 'No match to table expression: %s' % line name = parse_string(m.group(1)) idx = int(m.group(2)) |