From 97d7b499f1e919bb1d80c308f50ee26961a6681d Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:52:10 +0000 Subject: [PATCH] Fix type annotation & tidy --- cylc/flow/rundb.py | 24 +++++++++++------------- cylc/flow/task_pool.py | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/cylc/flow/rundb.py b/cylc/flow/rundb.py index 929ec4192a4..7d32a1cfcb8 100644 --- a/cylc/flow/rundb.py +++ b/cylc/flow/rundb.py @@ -787,7 +787,7 @@ def select_task_job_platforms(self): def select_prev_instances( self, name: str, point: str - ) -> List[Tuple[int, bool, Set[int], int]]: + ) -> List[Tuple[int, bool, Set[int], str]]: """Select task_states table info about previous instances of a task. Flow merge results in multiple entries for the same submit number. @@ -799,19 +799,17 @@ def select_prev_instances( r"SELECT flow_nums,submit_num,flow_wait,status FROM %(name)s" r" WHERE name==? AND cycle==?" ) % {"name": self.TABLE_TASK_STATES} - ret = [] - for flow_nums_str, submit_num, flow_wait, status in ( - self.connect().execute(stmt, (name, point,)) - ): - ret.append( - ( - submit_num, - flow_wait == 1, - deserialise(flow_nums_str), - status - ) + return [ + ( + submit_num, + flow_wait == 1, + deserialise(flow_nums_str), + status ) - return ret + for flow_nums_str, submit_num, flow_wait, status in ( + self.connect().execute(stmt, (name, point,)) + ) + ] def select_latest_flow_nums(self): """Return a list of the most recent previous flow numbers.""" diff --git a/cylc/flow/task_pool.py b/cylc/flow/task_pool.py index a1528ec963b..1e97d3c3034 100644 --- a/cylc/flow/task_pool.py +++ b/cylc/flow/task_pool.py @@ -1505,7 +1505,7 @@ def _get_task_history( # never spawned before in any flow submit_num = 0 - prev_status = TASK_STATUS_WAITING + prev_status: str = TASK_STATUS_WAITING prev_flow_wait = False for _snum, f_wait, old_fnums, status in info: