From b2458ec354c5f58483c2fef63803593553949c5f Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Thu, 16 Apr 2026 14:17:54 -0300 Subject: [PATCH] refactor: simplify load_html_from_file function and add debug prints in Reports class - Removed exception handling in load_html_from_file for cleaner code. - Added debug print statements in the Reports class to log output directory, report path, and base path for better traceability during report generation. --- model_manager/sientia/reports.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/model_manager/sientia/reports.py b/model_manager/sientia/reports.py index 0d9b657..56296b0 100644 --- a/model_manager/sientia/reports.py +++ b/model_manager/sientia/reports.py @@ -33,14 +33,8 @@ COLOR_DISCRETE_SEQUENCE = ( def load_html_from_file(file_path): - try: - with open(file_path, encoding='utf-8') as file: - return file.read() - except FileNotFoundError: - return None - except OSError: # noqa: BLE001 - return None - + with open(file_path, encoding='utf-8') as file: + return file.read() def inject_content(main_html, section_id, content): soup = BeautifulSoup(main_html, 'html.parser') @@ -249,6 +243,10 @@ class Reports: if output_dir and not os.path.exists(output_dir): os.makedirs(output_dir, exist_ok=True) + print(f"Output directory: {output_dir}") + print(f"Report path: {report_path}") + print(f"Base path: {self.base_path}") + # Load main HTML template main_html_path = os.path.join(self.base_path, 'header.html') main_html = load_html_from_file(main_html_path)