From 8523f45a43261e0fd394a49445fafbe1dfc7182d Mon Sep 17 00:00:00 2001 From: Miller Abel Date: Tue, 11 Nov 2025 21:34:11 -0800 Subject: [PATCH] Update sensei.py to use raw strings for regular expressions Update ansitowin32.py to fix re pattern literal string The pattern should be a raw string, to preserve the special meaning of backslash escape sequences within the re parser and suppress the normal parsing in literal strings. --- libs/colorama/ansitowin32.py | 2 +- runner/sensei.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/colorama/ansitowin32.py b/libs/colorama/ansitowin32.py index ea0a6c15f..09e2cc23d 100644 --- a/libs/colorama/ansitowin32.py +++ b/libs/colorama/ansitowin32.py @@ -40,7 +40,7 @@ class AnsiToWin32(object): sequences from the text, and if outputting to a tty, will convert them into win32 function calls. ''' - ANSI_RE = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') + ANSI_RE = re.compile(r'\033\[((?:\d|;)*)([a-zA-Z])') def __init__(self, wrapped, convert=None, strip=None, autoreset=False): # The wrapped stream (normally sys.stdout or sys.stderr) diff --git a/runner/sensei.py b/runner/sensei.py index 4a8d5cd96..05cbe75f0 100644 --- a/runner/sensei.py +++ b/runner/sensei.py @@ -60,7 +60,7 @@ def sortFailures(self, testClassName): table = list() for test, err in self.failures: if helper.cls_name(test) == testClassName: - m = re.search("(?<= line )\d+" ,err) + m = re.search(r"(?<= line )\d+" ,err) if m: tup = (int(m.group(0)), test, err) table.append(tup) @@ -146,7 +146,7 @@ def scrapeInterestingStackDump(self, err): if m and m.group(0): stack_text += '\n' + line - m = re.search("^ \w(\w)+.*$",line) + m = re.search(r"^ \w(\w)+.*$",line) if m and m.group(0): stack_text += sep + line