From 61a0917526b01b9fcf4dde816cc4dacab15db3cb Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Tue, 29 Oct 2024 22:44:53 +0100 Subject: [PATCH] pass regular expressions as raw strings in Python scripts (#1450) --- graphics/text/config.py | 4 ++-- scripts/simplecpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphics/text/config.py b/graphics/text/config.py index bca9fca5..4c5a164e 100644 --- a/graphics/text/config.py +++ b/graphics/text/config.py @@ -103,7 +103,7 @@ freedoom_bex = read_bex_lump("../../lumps/p2_deh.lmp") freedm_bex = read_bex_lump("../../lumps/fdm_deh.lmp") def read_bex_string(whichbex,defn): - return re.sub("^\w*\d:\s*", "", whichbex[defn]) + return re.sub(r"^\w*\d:\s*", "", whichbex[defn]) white_graphics = { @@ -252,7 +252,7 @@ def update_level_name(lumpname, bexdata, bexname): "Level name %s not defined in " "DEHACKED lump!" % bexname ) # Strip "MAP01: " or "E1M2: " etc. from start, if present: - levelname = re.sub("^\w*\d:\s*", "", bexdata[bexname]) + levelname = re.sub(r"^\w*\d:\s*", "", bexdata[bexname]) white_graphics[lumpname] = levelname for e in range(4): diff --git a/scripts/simplecpp b/scripts/simplecpp index 7ba9aeb0..a0c2fb3d 100755 --- a/scripts/simplecpp +++ b/scripts/simplecpp @@ -34,8 +34,8 @@ import re debug = False defines = {} -command_re = re.compile("\#(\w+)(\s+(.*))?") -include_re = re.compile('\s*"(.*)"\s*') +command_re = re.compile(r"\#(\w+)(\s+(.*))?") +include_re = re.compile(r'\s*"(.*)"\s*') def debug_msg(message):