From fbd5f3ad0a0a02fdb54cd0c75e847c4f31ee9bdb Mon Sep 17 00:00:00 2001 From: Jayasimha Raghavan <87547684+jayasimha-raghavan-unskript@users.noreply.github.com> Date: Tue, 18 Jun 2024 21:32:04 -0700 Subject: [PATCH] Refactoring output after merge function (#1077) Co-authored-by: Jayasimha Raghavan --- unskript-ctl/unskript_ctl_run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unskript-ctl/unskript_ctl_run.py b/unskript-ctl/unskript_ctl_run.py index 7a5ab66fd..2002c67f8 100644 --- a/unskript-ctl/unskript_ctl_run.py +++ b/unskript-ctl/unskript_ctl_run.py @@ -290,8 +290,6 @@ def display_check_result(self, checks_output): print('\x1B[1;4m', '\x1B[0m') return - - def output_after_merging_checks(self, outputs: list, ids: list) -> list: """output_after_merging_checks: this function combines the output from duplicated checks and stores the combined output. @@ -318,11 +316,13 @@ def output_after_merging_checks(self, outputs: list, ids: list) -> list: if current_output['status'] < output['status']: # If the new status is more severe, overwrite the old status current_output['status'] = output['status'] - current_output['objects'] = output.get('objects') + current_output['objects'] = output.get('objects', []) if output['status'] == 2 and output.get('objects'): # Append objects if status is FAILED and objects are non-empty - current_output.setdefault('objects', []).extend(output.get('objects', [])) + if 'objects' not in current_output or not isinstance(current_output['objects'], list): + current_output['objects'] = [] + current_output['objects'].extend(output.get('objects', [])) # Update error message if there's a new one and it's non-empty if 'error' in output and output['error']: