aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorBen Woosley <ben.woosley@gmail.com>2019-02-01 17:00:02 -0800
committerBen Woosley <ben.woosley@gmail.com>2019-09-03 14:38:38 -0400
commitb21680baf5391a602b295b9d7d0ef66553661cb9 (patch)
tree014dde0638aa584215f4855341606de65ed1fb89 /contrib/devtools
parent6e431296daceee604f48e9e3e87fa84cfd44bef2 (diff)
downloadbitcoin-b21680baf5391a602b295b9d7d0ef66553661cb9.tar.xz
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 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/clang-format-diff.py4
-rwxr-xr-xcontrib/devtools/copyright_header.py30
-rwxr-xr-xcontrib/devtools/symbol-check.py4
3 files changed, 18 insertions, 20 deletions
diff --git a/contrib/devtools/clang-format-diff.py b/contrib/devtools/clang-format-diff.py
index f322b3a880..98eee67f43 100755
--- a/contrib/devtools/clang-format-diff.py
+++ b/contrib/devtools/clang-format-diff.py
@@ -106,7 +106,7 @@ def main():
filename = None
lines_by_file = {}
for line in sys.stdin:
- match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
+ match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
if match:
filename = match.group(2)
if filename is None:
@@ -119,7 +119,7 @@ def main():
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
continue
- match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
+ match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line)
if match:
start_line = int(match.group(1))
line_count = 1
diff --git a/contrib/devtools/copyright_header.py b/contrib/devtools/copyright_header.py
index fc01e570aa..f1bd910892 100755
--- a/contrib/devtools/copyright_header.py
+++ b/contrib/devtools/copyright_header.py
@@ -71,7 +71,7 @@ def get_filenames_to_examine(base_directory):
################################################################################
-COPYRIGHT_WITH_C = 'Copyright \(c\)'
+COPYRIGHT_WITH_C = r'Copyright \(c\)'
COPYRIGHT_WITHOUT_C = 'Copyright'
ANY_COPYRIGHT_STYLE = '(%s|%s)' % (COPYRIGHT_WITH_C, COPYRIGHT_WITHOUT_C)
@@ -85,21 +85,21 @@ ANY_COPYRIGHT_STYLE_OR_YEAR_STYLE = ("%s %s" % (ANY_COPYRIGHT_STYLE,
ANY_COPYRIGHT_COMPILED = re.compile(ANY_COPYRIGHT_STYLE_OR_YEAR_STYLE)
def compile_copyright_regex(copyright_style, year_style, name):
- return re.compile('%s %s,? %s' % (copyright_style, year_style, name))
+ return re.compile('%s %s,? %s\n' % (copyright_style, year_style, name))
EXPECTED_HOLDER_NAMES = [
- "Satoshi Nakamoto\n",
- "The Bitcoin Core developers\n",
- "BitPay Inc\.\n",
- "University of Illinois at Urbana-Champaign\.\n",
- "Pieter Wuille\n",
- "Wladimir J. van der Laan\n",
- "Jeff Garzik\n",
- "Jan-Klaas Kollhof\n",
- "ArtForz -- public domain half-a-node\n",
- "Intel Corporation",
- "The Zcash developers",
- "Jeremy Rubin",
+ r"Satoshi Nakamoto",
+ r"The Bitcoin Core developers",
+ r"BitPay Inc\.",
+ r"University of Illinois at Urbana-Champaign\.",
+ r"Pieter Wuille",
+ r"Wladimir J\. van der Laan",
+ r"Jeff Garzik",
+ r"Jan-Klaas Kollhof",
+ r"ArtForz -- public domain half-a-node",
+ r"Intel Corporation ?",
+ r"The Zcash developers",
+ r"Jeremy Rubin",
]
DOMINANT_STYLE_COMPILED = {}
@@ -329,7 +329,7 @@ def write_file_lines(filename, file_lines):
# update header years execution
################################################################################
-COPYRIGHT = 'Copyright \(c\)'
+COPYRIGHT = r'Copyright \(c\)'
YEAR = "20[0-9][0-9]"
YEAR_RANGE = '(%s)(-%s)?' % (YEAR, YEAR)
HOLDER = 'The Bitcoin Core developers'
diff --git a/contrib/devtools/symbol-check.py b/contrib/devtools/symbol-check.py
index dd35d862c9..d8b684026c 100755
--- a/contrib/devtools/symbol-check.py
+++ b/contrib/devtools/symbol-check.py
@@ -141,7 +141,7 @@ def read_libraries(filename):
for line in stdout.splitlines():
tokens = line.split()
if len(tokens)>2 and tokens[1] == '(NEEDED)':
- match = re.match('^Shared library: \[(.*)\]$', ' '.join(tokens[2:]))
+ match = re.match(r'^Shared library: \[(.*)\]$', ' '.join(tokens[2:]))
if match:
libraries.append(match.group(1))
else:
@@ -171,5 +171,3 @@ if __name__ == '__main__':
retval = 1
sys.exit(retval)
-
-