treewide: make regex patterns raw strings

This is necessary for escape sequences to be properly recognized.
This commit is contained in:
Martin Weinelt 2023-05-24 01:58:01 +02:00
parent bc4071dde8
commit b50868bf30
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 5 additions and 5 deletions

View File

@ -13,9 +13,9 @@ BTBN_PATH = "/usr/lib/btbn-ffmpeg"
# Regex Consts
REGEX_CAMERA_NAME = "^[a-zA-Z0-9_-]+$"
REGEX_RTSP_CAMERA_USER_PASS = ":\/\/[a-zA-Z0-9_-]+:[\S]+@"
REGEX_HTTP_CAMERA_USER_PASS = "user=[a-zA-Z0-9_-]+&password=[\S]+"
REGEX_CAMERA_NAME = r"^[a-zA-Z0-9_-]+$"
REGEX_RTSP_CAMERA_USER_PASS = r":\/\/[a-zA-Z0-9_-]+:[\S]+@"
REGEX_HTTP_CAMERA_USER_PASS = r"user=[a-zA-Z0-9_-]+&password=[\S]+"
# Known Driver Names

View File

@ -863,7 +863,7 @@ def get_bandwidth_stats() -> dict[str, dict]:
stats = list(filter(lambda a: a != "", line.strip().split("\t")))
try:
if re.search(
"(^ffmpeg|\/go2rtc|frigate\.detector\.[a-z]+)/([0-9]+)/", stats[0]
r"(^ffmpeg|\/go2rtc|frigate\.detector\.[a-z]+)/([0-9]+)/", stats[0]
):
process = stats[0].split("/")
usages[process[len(process) - 2]] = {
@ -930,7 +930,7 @@ def get_intel_gpu_stats() -> dict[str, str]:
# render is used for qsv
render = []
for result in re.findall('"Render/3D/0":{[a-z":\d.,%]+}', reading):
for result in re.findall(r'"Render/3D/0":{[a-z":\d.,%]+}', reading):
packet = json.loads(result[14:])
single = packet.get("busy", 0.0)
render.append(float(single))