From 7c165e0c83338d6ef17e235a15b4174b4523839b Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Tue, 9 Jul 2024 12:18:05 +0800 Subject: [PATCH] Fix W605 F841 for publistbuilder.py and stylers.py --- regolith/builders/publistbuilder.py | 6 +----- regolith/stylers.py | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/regolith/builders/publistbuilder.py b/regolith/builders/publistbuilder.py index a54c2bba8..90d6af3df 100644 --- a/regolith/builders/publistbuilder.py +++ b/regolith/builders/publistbuilder.py @@ -1,6 +1,5 @@ """Builder for publication lists.""" -import os try: from bibtexparser.bwriter import BibTexWriter @@ -44,7 +43,6 @@ def construct_global_ctx(self): gtx["all_docs_from_collection"] = all_docs_from_collection def latex(self): - fd = gr = kw = False facility = None filestub, qualifiers = "", "" if self.rc.from_date: @@ -60,7 +58,6 @@ def latex(self): else: from_date, to_date = None, None if self.rc.grants: - gr = True grants = self.rc.grants if isinstance(grants, str): grants = [grants] @@ -73,13 +70,12 @@ def latex(self): elif len(grants) == 1: text_grants = grants[0] pl = "" - cat_grants, all_grants = "", "" + cat_grants = "" for g in grants: cat_grants = cat_grants + "_" + g filestub = f"{filestub}{cat_grants}" qualifiers = f"{qualifiers} from Grant{pl} {text_grants}" if self.rc.kwargs: - kw = True key, value = self.rc.kwargs[0].split(":", 1) if key == "facility": facility = value diff --git a/regolith/stylers.py b/regolith/stylers.py index 565a672bc..9435d7fe5 100644 --- a/regolith/stylers.py +++ b/regolith/stylers.py @@ -48,9 +48,9 @@ def sentencecase(sentence): ----- tbd or n/a are returned lower case, not sentence case. """ - freezecaps = re.findall("\{[^{}]+\}", sentence) + freezecaps = re.findall("\\{[^{}]+\\}", sentence) datalow = sentence.capitalize() - sentencecase = re.split("\{[^{}]+\}", datalow) + sentencecase = re.split("\\{[^{}]+\\}", datalow) title = "" freezecaps.reverse() for word in sentencecase: