Fix invalid escape syntax warnings

Additionally use rawstrings with all regex calls
This commit is contained in:
wereii
2024-09-10 15:15:24 +02:00
committed by Tomas
parent 1ea6136cb2
commit 954a164922
17 changed files with 43 additions and 43 deletions

View File

@@ -117,7 +117,7 @@ class PyfaJsonWriter(BaseWriter):
# Prefer safe way - replace any characters besides
# alphanumeric and few special characters with
# underscore
writer_safe_name = re.sub('[^\w\-.,() ]', '_', name, flags=re.UNICODE)
writer_safe_name = re.sub(r'[^\w\-.,() ]', '_', name, flags=re.UNICODE)
return writer_safe_name

View File

@@ -395,7 +395,7 @@ effectids_eos = set()
with open(effects_path) as f:
for line in f:
m = re.match("class Effect(\d+)\(", line)
m = re.match(r"class Effect(\d+)\(", line)
if m:
effectid = int(m.group(1))
effectids_eos.add(effectid)

View File

@@ -57,7 +57,7 @@ def main(old, new, groups=True, effects=True, attributes=True, renames=True):
with open(effectspath) as f:
for line in f:
for m in re.finditer('class Effect(?P<eid>\d+)\(BaseEffect\):', line):
for m in re.finditer(r'class Effect(?P<eid>\d+)\(BaseEffect\):', line):
effectid = int(m.group('eid'))
implemented.add(effectid)