From 8d65a8b561672d38e034955d99abf049ded70233 Mon Sep 17 00:00:00 2001 From: David Grigg Date: Fri, 15 Dec 2023 15:27:11 +1100 Subject: [PATCH] Fixed pylint issue --- se/formatting.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/se/formatting.py b/se/formatting.py index 91a64bd8..fc561535 100644 --- a/se/formatting.py +++ b/se/formatting.py @@ -1356,20 +1356,20 @@ def tagged_titlecase(text: str) -> str: """ if "<" not in text: # if no tags, process normally return titlecase(text) - else: - cased_string = process_tagged_string(text) # treat it specially + + cased_string = process_tagged_string(text) # treat it specially - # now we have to check for book, play, etc titles and process them again as separate units - # this patternlooks for book/play/vessel etc. names - regex_pattern = regex.compile(r'(.*?)') + # now we have to check for book, play, etc titles and process them again as separate units + # this patternlooks for book/play/vessel etc. names + regex_pattern = regex.compile(r'(.*?)') - for match in regex_pattern.finditer(cased_string): # we iterate because there may be more than one such - # we make a recursive call because the book title may contain tags of its own such as - titled_semantic = tagged_titlecase(match.group(3)) - replacement = f'{titled_semantic}' - cased_string = cased_string.replace(match.group(0), replacement) + for match in regex_pattern.finditer(cased_string): # we iterate because there may be more than one such + # we make a recursive call because the book title may contain tags of its own such as + titled_semantic = tagged_titlecase(match.group(3)) + replacement = f'{titled_semantic}' + cased_string = cased_string.replace(match.group(0), replacement) - return cased_string + return cased_string def make_url_safe(text: str) -> str: """