Skip to content

Commit ee1666e

Browse files
committed
Fix regex SyntaxWarning about invalid escape sequences
Use raw strings for regex patterns to avoid Python warnings about invalid escape sequences like \d and \w. Fixed warnings like: SyntaxWarning: invalid escape sequence '\d' plan = re.search('^(\d+)..(\d+)', string) Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 560d870 commit ee1666e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

9pm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ def execute(args, test, output_log):
7676
string = line.rstrip()
7777
stamp = time.strftime("%Y-%m-%d %H:%M:%S")
7878

79-
plan = re.search('^(\d+)..(\d+)$', string)
80-
ok = re.search('^ok (\d+) -', string)
81-
not_ok = re.search('^not ok (\d+) -', string)
82-
skip = re.search('^ok (\d+) # skip', string)
83-
skip_suite = re.search('^ok (\d+) # skip suite', string)
84-
comment = re.search('^\w*#', string)
79+
plan = re.search(r'^(\d+)..(\d+)$', string)
80+
ok = re.search(r'^ok (\d+) -', string)
81+
not_ok = re.search(r'^not ok (\d+) -', string)
82+
skip = re.search(r'^ok (\d+) # skip', string)
83+
skip_suite = re.search(r'^ok (\d+) # skip suite', string)
84+
comment = re.search(r'^\w*#', string)
8585

8686
output_log.write(f"{stamp} {string}\n")
8787

0 commit comments

Comments
 (0)