From 500b655efe82c41592f645c82d24d06eebc95600 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sun, 8 Dec 2024 21:37:58 +0000 Subject: [PATCH] Use ast_parse_module --- script/hassfest/quality_scale_validation/test_before_setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/hassfest/quality_scale_validation/test_before_setup.py b/script/hassfest/quality_scale_validation/test_before_setup.py index 890931def22ee..58a8e2475198b 100644 --- a/script/hassfest/quality_scale_validation/test_before_setup.py +++ b/script/hassfest/quality_scale_validation/test_before_setup.py @@ -5,6 +5,7 @@ import ast +from script.hassfest import ast_parse_module from script.hassfest.model import Integration _VALID_EXCEPTIONS = { @@ -50,7 +51,7 @@ def _get_setup_entry_function(module: ast.Module) -> ast.AsyncFunctionDef | None def validate(integration: Integration) -> list[str] | None: """Validate correct use of ConfigEntry.runtime_data.""" init_file = integration.path / "__init__.py" - init = ast.parse(init_file.read_text()) + init = ast_parse_module(init_file) # Should not happen, but better to be safe if not (async_setup_entry := _get_setup_entry_function(init)):