scripts/tracetool: Fix SyntaxWarning invalid escape sequence

Since python 3.12 an invalid escape sequence generates a SyntaxWarning
and it will generate a SyntaxError in the future.

Ref https://docs.python.org/3/whatsnew/3.12.html#other-language-changes
This commit is contained in:
Sertonix 2024-08-07 00:58:58 +02:00
parent 7f8341ddf9
commit 29ea0c86a4
1 changed files with 8 additions and 8 deletions

View File

@ -92,7 +92,7 @@ ALLOWED_TYPES = [
def validate_type(name):
bits = name.split(" ")
for bit in bits:
bit = re.sub("\*", "", bit)
bit = re.sub(r"\*", "", bit)
if bit == "":
continue
if bit == "const":
@ -223,12 +223,12 @@ class Event(object):
"""
_CRE = re.compile("((?P<props>[\w\s]+)\s+)?"
"(?P<name>\w+)"
"\((?P<args>[^)]*)\)"
"\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
"\s*")
_CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?"
r"(?P<name>\w+)"
r"\((?P<args>[^)]*)\)"
r"\s*"
r"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
r"\s*")
_VALID_PROPS = set(["disable", "vcpu"])
@ -339,7 +339,7 @@ class Event(object):
fmt)
# Star matching on PRI is dangerous as one might have multiple
# arguments with that format, hence the non-greedy version of it.
_FMT = re.compile("(%[\d\.]*\w+|%.*?PRI\S+)")
_FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")
def formats(self):
"""List conversion specifiers in the argument print format string."""