From 304bbd230a1b801069cfce259c6ad0f25d48116c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 13 Apr 2021 00:18:30 +0100 Subject: [PATCH] deprecated non-raw regex --- core/utils.py | 2 +- parsers/logbooks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/utils.py b/core/utils.py index deca124..84a8191 100644 --- a/core/utils.py +++ b/core/utils.py @@ -40,7 +40,7 @@ TROG = { } } -# This is module-level executable. This is a Bad Thing. +# This is module-level executable. This is a Bad Thing. Especially when it touches the file system. try: logging.basicConfig(level=logging.DEBUG, filename=settings.LOGFILE, diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 7a334d6..b6a326c 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -281,7 +281,7 @@ def Parseloghtml01(year, expedition, txt): logbook_entry_count += 1 try: tripentry = year + "." + str(logbook_entry_count) - s = re.match("(?s)\s*(?:

)?(.*?)(.*)$(?i)", trippara) + s = re.match(r"(?s)\s*(?:

)?(.*?)(.*)$(?i)", trippara) if not s: message = " ! - Skipping logentry on failure to parse header: " + tripentry + trippara[:300] + "..." DataIssue.objects.create(parser='logbooks', message=message) @@ -351,7 +351,7 @@ def Parseloghtml03(year, expedition, txt): for trippara in tripparas: logbook_entry_count += 1 - s = re.match("(?s)\s*

(.*?)

(.*)$", trippara) + s = re.match(r"(?s)\s*

(.*?)

(.*)$", trippara) #assert s, trippara if not ( s ) : message = " ! - Skipping logentry on failure to parse Parseloghtml03: {} {} {}...".format(tripentry,s,trippara[:300])