Skip to content

Commit 8523f45

Browse files
committed
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.
1 parent d797352 commit 8523f45

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libs/colorama/ansitowin32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class AnsiToWin32(object):
4040
sequences from the text, and if outputting to a tty, will convert them into
4141
win32 function calls.
4242
'''
43-
ANSI_RE = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
43+
ANSI_RE = re.compile(r'\033\[((?:\d|;)*)([a-zA-Z])')
4444

4545
def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
4646
# The wrapped stream (normally sys.stdout or sys.stderr)

runner/sensei.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def sortFailures(self, testClassName):
6060
table = list()
6161
for test, err in self.failures:
6262
if helper.cls_name(test) == testClassName:
63-
m = re.search("(?<= line )\d+" ,err)
63+
m = re.search(r"(?<= line )\d+" ,err)
6464
if m:
6565
tup = (int(m.group(0)), test, err)
6666
table.append(tup)
@@ -146,7 +146,7 @@ def scrapeInterestingStackDump(self, err):
146146
if m and m.group(0):
147147
stack_text += '\n' + line
148148

149-
m = re.search("^ \w(\w)+.*$",line)
149+
m = re.search(r"^ \w(\w)+.*$",line)
150150
if m and m.group(0):
151151
stack_text += sep + line
152152

0 commit comments

Comments
 (0)