From 4044e3bd9375200505d4ee4883c22df602effb3f Mon Sep 17 00:00:00 2001 From: stevenhua0320 Date: Fri, 5 Jul 2024 14:05:04 +0800 Subject: [PATCH] Fix E231 E501 F541 issues. --- regolith/helpers/l_progressreporthelper.py | 19 +++++++++++-------- regolith/helpers/l_projectahelper.py | 15 ++++++++------- regolith/helpers/reimbstatushelper.py | 3 ++- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/regolith/helpers/l_progressreporthelper.py b/regolith/helpers/l_progressreporthelper.py index 5b9c74d79..ba50b0c0a 100644 --- a/regolith/helpers/l_progressreporthelper.py +++ b/regolith/helpers/l_progressreporthelper.py @@ -36,7 +36,7 @@ def subparser(subpi): nargs="+", choices=PROJECTUM_STATI, help=f"Filter projecta for these stati." - f" Default is {*(PROJECTUM_ACTIVE_STATI+PROJECTUM_FINISHED_STATI),}", + f" Default is {*(PROJECTUM_ACTIVE_STATI+PROJECTUM_FINISHED_STATI), }", default=PROJECTUM_ACTIVE_STATI + PROJECTUM_FINISHED_STATI, **listbox_kwargs, ) @@ -92,7 +92,8 @@ def print_projectum(self, selected_projecta): print(f"{p.get('_id')}") if p.get("deliverable"): print( - f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, due_date: {p.get('deliverable').get('due_date')}" + f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, " + f"due_date: {p.get('deliverable').get('due_date')}" ) if p.get("status") == "finished": print(f" finished: {p.get('end_date')}") @@ -128,7 +129,8 @@ def print_projectum(self, selected_projecta): print(f"{p.get('_id')}") if p.get("deliverable"): print( - f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, due_date: {p.get('deliverable').get('due_date')}" + f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, " + f"due_date: {p.get('deliverable').get('due_date')}" ) print(f" description: {p.get('description')}") if p.get("status") == "finished": @@ -139,7 +141,8 @@ def print_projectum(self, selected_projecta): print(" milestones:") for m in p.get("milestones"): print( - f" due: {m.get('due_date')}, {m.get('name')}, type: {m.get('type')}, status: {m.get('status')}" + f" due: {m.get('due_date')}, {m.get('name')}, " + f"type: {m.get('type')}, status: {m.get('status')}" ) print(f" objective: {m.get('objective')}") @@ -173,15 +176,15 @@ def sout(self): startedp.append(prum) else: otherp.append(prum) - print(f"*************************[Orphan Projecta]*************************") + print("*************************[Orphan Projecta]*************************") for prum in otherp: print(f"{prum.get('_id')}, status: {prum.get('status')}") - print(f"*************************[Finished Projecta]*************************") + print("*************************[Finished Projecta]*************************") for prum in finishedp: print(f"{prum.get('_id')}, grant: {prum.get('grants')}") print(f" description: {prum.get('description')}") print(f" finished: {prum.get('end_date')}") - print(f"*************************[Proposed Projecta]*************************") + print("*************************[Proposed Projecta]*************************") self.print_projectum(proposedp) - print(f"*************************[In Progress Projecta]*************************") + print("*************************[In Progress Projecta]*************************") self.print_projectum(startedp) diff --git a/regolith/helpers/l_projectahelper.py b/regolith/helpers/l_projectahelper.py index 098b4df68..1d873150e 100644 --- a/regolith/helpers/l_projectahelper.py +++ b/regolith/helpers/l_projectahelper.py @@ -43,7 +43,7 @@ def subparser(subpi): "-c", "--current", action="store_true", - help=f"Lists only active projecta. If not specified, will be active and paused but not cancelled", + help="Lists only active projecta. If not specified, will be active and paused but not cancelled", ) subpi.add_argument("-v", "--verbose", action="store_true", help="increase verbosity of output") subpi.add_argument("--grp_by_lead", action="store_true", help="Lists all projecta by their lead") @@ -57,7 +57,7 @@ def subparser(subpi): "--all", action="store_true", help=f"Lists all projecta including those with statuses " - f"in {*PROJECTUM_CANCELLED_STATI,} that are excluded by default", + f"in {*PROJECTUM_CANCELLED_STATI, } that are excluded by default", ) subpi.add_argument( "-e", @@ -158,7 +158,7 @@ def sout(self): collection = [prum for prum in collection if rc.grant in prum.get("grants", [])] if rc.orphans: if rc.person or rc.lead: - raise RuntimeError(f"you cannot specify lead or person with orphans") + raise RuntimeError("you cannot specify lead or person with orphans") dead_parents = [person.get("_id") for person in self.gtx["people"] if not person.get("active")] collection = [ prum @@ -169,11 +169,11 @@ def sout(self): ] if rc.lead: if rc.person or rc.orphans: - raise RuntimeError(f"please specify either lead or person, not both") + raise RuntimeError("please specify either lead or person, not both") collection = [prum for prum in collection if prum.get("lead") == rc.lead] if rc.person: if rc.orphans: - raise RuntimeError(f"please specify either lead or person, not both") + raise RuntimeError("please specify either lead or person, not both") if isinstance(rc.person, str): rc.person = [rc.person] collection = [ @@ -220,10 +220,11 @@ def sout(self): if p.get("status") == "finished": ended = f", end_date: {p.get('end_date')}" else: - ended = f"" + ended = "" print(p.get("_id")) print( - f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, due_date: {p.get('deliverable', {}).get('due_date')}{ended}, grant: {grants}" + f" status: {p.get('status')}, begin_date: {p.get('begin_date')}, " + f"due_date: {p.get('deliverable', {}).get('due_date')}{ended}, grant: {grants}" ) print(f" description: {p.get('description')}") print(" team:") diff --git a/regolith/helpers/reimbstatushelper.py b/regolith/helpers/reimbstatushelper.py index 3afe5dc56..23828d390 100644 --- a/regolith/helpers/reimbstatushelper.py +++ b/regolith/helpers/reimbstatushelper.py @@ -94,7 +94,8 @@ def sout(self): print( f" Requested: {unseg}, " f"Reimbursed: {j.get('amount')}, Date: " - f"{reimb_dates.get('date',dt.date(1900,1,1).isoformat())}, Grants: {grantstring}" + f"{reimb_dates.get('date', dt.date(1900, 1, 1).isoformat())}, " + f"Grants: {grantstring}" ) print("\nSubmitted expenses:") for i in sorted_sub: