From e498e1d9f3b4ead66d0ec74f8be96c4ee193ad7d Mon Sep 17 00:00:00 2001 From: Kuba Mazurkiewicz <132581633+kuba-mazurkiewicz@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:22:46 +0100 Subject: [PATCH] Fix yamale syntax warnings in python 3.12 #270 (#284) --- iac_validate/validator.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/iac_validate/validator.py b/iac_validate/validator.py index 08498e6..46421f1 100644 --- a/iac_validate/validator.py +++ b/iac_validate/validator.py @@ -5,6 +5,7 @@ import importlib import importlib.util import logging +import warnings import os import sys from typing import Any, Dict, List, Optional @@ -25,7 +26,13 @@ def __init__(self, schema_path: str, rules_path: str): self.schema = None if os.path.exists(schema_path): logger.info("Loading schema") - self.schema = yamale.make_schema(schema_path, parser="ruamel") + with warnings.catch_warnings(): + warnings.filterwarnings( + action="ignore", + category=SyntaxWarning, + message="invalid escape sequence", + ) + self.schema = yamale.make_schema(schema_path, parser="ruamel") elif schema_path == DEFAULT_SCHEMA: logger.info("No schema file found") else: