From bde25f576272edc6610707ebf02fbb7f9ffd255f Mon Sep 17 00:00:00 2001 From: j Date: Mon, 20 Oct 2025 10:33:34 +0100 Subject: [PATCH] tag regexp strings --- install.py | 2 +- management/commands/generate_clips.py | 8 ++++---- render.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/install.py b/install.py index 1ad6f4d..20a4484 100755 --- a/install.py +++ b/install.py @@ -100,7 +100,7 @@ if os.path.exists('__init__.py'): local_settings += '\nLOCAL_APPS = ["%s"]\n' % name local_settings_changed = True else: - apps = re.compile('(LOCAL_APPS.*?)\]', re.DOTALL).findall(local_settings)[0] + apps = re.compile(r'(LOCAL_APPS.*?)\]', re.DOTALL).findall(local_settings)[0] if name not in apps: new_apps = apps.strip() + ',\n"%s"\n' % name local_settings = local_settings.replace(apps, new_apps) diff --git a/management/commands/generate_clips.py b/management/commands/generate_clips.py index 4c96377..1be54fa 100644 --- a/management/commands/generate_clips.py +++ b/management/commands/generate_clips.py @@ -14,7 +14,7 @@ from ...render import get_srt def resolve_roman(s): - extra = re.compile('^\d+(.*?)$').findall(s) + extra = re.compile(r'^\d+(.*?)$').findall(s) if extra: extra = extra[0].lower() new = { @@ -88,9 +88,9 @@ class Command(BaseCommand): clip['tags'] = i.data.get('tags', []) clip['editingtags'] = i.data.get('editingtags', []) name = os.path.basename(original_target) - seqid = re.sub("Hotel Aporia_(\d+)", "S\\1_", name) - seqid = re.sub("Night March_(\d+)", "S\\1_", seqid) - seqid = re.sub("_(\d+)H_(\d+)", "_S\\1\\2_", seqid) + seqid = re.sub(r"Hotel Aporia_(\d+)", "S\\1_", name) + seqid = re.sub(r"Night March_(\d+)", "S\\1_", seqid) + seqid = re.sub(r"_(\d+)H_(\d+)", "_S\\1\\2_", seqid) seqid = seqid.split('_')[:2] seqid = [b[1:] if b[0] in ('B', 'S') else '0' for b in seqid] seqid[1] = resolve_roman(seqid[1]) diff --git a/render.py b/render.py index 56fc94a..f97a60a 100644 --- a/render.py +++ b/render.py @@ -61,7 +61,7 @@ def write_if_new(path, data, mode=''): old = "" is_new = data != old if path.endswith(".kdenlive"): - is_new = re.sub('\{.{36}\}', '', data) != re.sub('\{.{36}\}', '', old) + is_new = re.sub(r'\{.{36}\}', '', data) != re.sub(r'\{.{36}\}', '', old) if is_new: with open(path, write_mode) as fd: fd.write(data)