From d7b2d922d141a23d2fae8d7a8c416d957897b614 Mon Sep 17 00:00:00 2001 From: Harvey Lynden Date: Mon, 23 Mar 2026 16:00:39 +0100 Subject: [PATCH] html: replace deprecated codecs.open with builtin open codecs.open() is deprecated in favor of the builtin open() with an encoding parameter. This triggers pylint W4902 (deprecated-method) which causes the pre-commit pylint hook to fail for all commits since the check-lint script lints the entire repo. Assisted-By: Cursor-Claude-4-Sonnet Signed-off-by: Harvey Lynden --- optional_plugins/html/avocado_result_html/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/optional_plugins/html/avocado_result_html/__init__.py b/optional_plugins/html/avocado_result_html/__init__.py index 049902b29d..b6b979913c 100644 --- a/optional_plugins/html/avocado_result_html/__init__.py +++ b/optional_plugins/html/avocado_result_html/__init__.py @@ -16,7 +16,6 @@ """ import base64 -import codecs import os import platform import subprocess @@ -163,7 +162,7 @@ def _sysinfo_phase(self, phase): sysinfo_dict["element_id"] = f"{phase}_heading_{s_id}" sysinfo_dict["collapse_id"] = f"{phase}_collapse_{s_id}" try: - with codecs.open(sysinfo_path, "r", encoding="utf-8") as sysinfo_file: + with open(sysinfo_path, "r", encoding="utf-8") as sysinfo_file: sysinfo_dict["contents"] = sysinfo_file.read() except (OSError, UnicodeDecodeError) as details: path = os.path.relpath(sysinfo_path, self.html_output_dir) @@ -236,7 +235,7 @@ def _render(result, output_path): template = env.get_template("results.html") report_contents = template.render({"data": ReportModel(result, output_path)}) - with codecs.open(output_path, "w", "utf-8") as report_file: + with open(output_path, "w", encoding="utf-8") as report_file: report_file.write(report_contents) def render(self, result, job):