summaryrefslogtreecommitdiff
path: root/test/CheckComments.py
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2024-02-25 17:40:19 +0100
committerJohn Wiegley <johnw@newartisans.com>2024-07-08 10:12:07 -0700
commit815305b94864556c994934c7a7c830da7de1d94e (patch)
tree6d85f089b05520416eee1f51f80636b357cda73d /test/CheckComments.py
parent0b561c7304ec82807212bd070fc6a1684c67607b (diff)
downloadfork-ledger-815305b94864556c994934c7a7c830da7de1d94e.tar.gz
fork-ledger-815305b94864556c994934c7a7c830da7de1d94e.tar.bz2
fork-ledger-815305b94864556c994934c7a7c830da7de1d94e.zip
Use Python raw strings for regex methods argument
Diffstat (limited to 'test/CheckComments.py')
-rw-r--r--test/CheckComments.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/CheckComments.py b/test/CheckComments.py
index 9bcfcbb3..edc4aed1 100644
--- a/test/CheckComments.py
+++ b/test/CheckComments.py
@@ -30,34 +30,34 @@ for path in args.path:
for line in fd.readlines():
linenum += 1
- match = re.search('/\*\*(.*)', line)
+ match = re.search(r'/\*\*(.*)', line)
if match:
- long_comment = re.sub('\s+', '', match.group(1))
+ long_comment = re.sub(r'\s+', '', match.group(1))
continue
elif long_comment:
- match = re.search('(.*)\*/', line)
+ match = re.search(r'(.*)\*/', line)
if match:
- long_comment += re.sub('\s+', '', match.group(1))
+ long_comment += re.sub(r'\s+', '', match.group(1))
comment_count = len(long_comment)
long_comment = None
else:
- long_comment += re.sub('\s+', '', line[:-1])
+ long_comment += re.sub(r'\s+', '', line[:-1])
continue
if brace_depth == 0:
- match = re.search('(namespace|enum|class|struct|union)', line)
+ match = re.search(r'(namespace|enum|class|struct|union)', line)
if match:
kind = match.group(1)
if args.debug: print("kind =", kind)
elif kind == "function":
- match = re.search('(\S+)\(', line)
+ match = re.search(r'(\S+)\(', line)
if match:
function_name = match.group(1)
long_comments[function_name] = comment_count
comment_count = 0
if args.debug: print("name found %s" % function_name)
- if re.search('{', line) and not re.search('@{', line):
+ if re.search(r'{', line) and not re.search('@{', line):
if kind == "function":
brace_depth += 1
if args.debug: print("brace_depth =", brace_depth)
@@ -66,7 +66,7 @@ for path in args.path:
kind = "function"
if args.debug: print("other_depth =", other_depth)
- if re.search('}', line) and not re.search('@}', line):
+ if re.search(r'}', line) and not re.search('@}', line):
if brace_depth > 0:
brace_depth -= 1
if args.debug: print("brace_depth =", brace_depth)
@@ -101,15 +101,15 @@ for path in args.path:
if args.debug: print("other_depth =", other_depth)
if brace_depth > 0:
- if re.search("TRACE_[CD]TOR", line):
+ if re.search(r'TRACE_[CD]TOR', line):
ctor_dtor = True
- line = re.sub('\s+', '', line[:-1])
+ line = re.sub(r'\s+', '', line[:-1])
- match = re.search('//(.*)', line)
+ match = re.search(r'//(.*)', line)
if match:
comment = match.group(1)
- line = re.sub('//.*', '', line)
+ line = re.sub(r'//.*', '', line)
else:
comment = None