From 385a46fc164201d43620e46debaadb57cb79df7a Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sat, 22 Jun 2024 20:41:15 -0700 Subject: [PATCH] Simplify regexes and use logger.warning --- comicapi/filenameparser.py | 4 ++-- comictaggerlib/ui/talkeruigenerator.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index 660bd98..7a3e2c2 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -74,7 +74,7 @@ class FileNameParser: # replace any name separators with spaces tmpstr = self.fix_spaces(filename) - match = re.search(r"(?:\s\(?of\s)(\d+)(?: |\))", tmpstr, re.IGNORECASE) + match = re.search(r"\s\(?of\s(\d+)[ )]", tmpstr, re.IGNORECASE) if match: count = match.group(1) @@ -264,7 +264,7 @@ class FileNameParser: remainder = self.fix_spaces(remainder, remove_dashes=False) if volume != "": - remainder = re.sub(r"(?i)(.+)((?:v(?:|ol|olume))\.?\s?)" + volume, "", remainder, count=1) + remainder = re.sub(r"(?i)(.+)(v(?:|ol|olume)\.?\s?)" + volume, "", remainder, count=1) if year != "": remainder = remainder.replace(year, "", 1) if count != "": diff --git a/comictaggerlib/ui/talkeruigenerator.py b/comictaggerlib/ui/talkeruigenerator.py index 46f78f6..18630e5 100644 --- a/comictaggerlib/ui/talkeruigenerator.py +++ b/comictaggerlib/ui/talkeruigenerator.py @@ -316,7 +316,7 @@ def get_config_from_tab(tab: TalkerTab, definitions: settngs.Group) -> dict[str, and guessed_type not in (None, "Any") and (isinstance(guessed_type, type) and not isinstance(value, guessed_type)) ): - logger.warn( + logger.warning( "Guessed type is wrong on for '%s': expected: %s got: %s", setting_name, guessed_type,