From e866585add16094a34bd871b852a34c9afba08da Mon Sep 17 00:00:00 2001 From: kuba-mazurkiewicz Date: Wed, 13 Nov 2024 21:24:15 +0100 Subject: [PATCH] fix #270 SyntaxWarnings in python3.12 --- 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: