From 1cabcc21d7283b8c953659b0b095c6994debd834 Mon Sep 17 00:00:00 2001 From: Eugene Clark Date: Tue, 10 Dec 2024 08:02:52 -0500 Subject: [PATCH] Suppress Pydantic warnings by default (#110) * Suppress warnings in model_dump() when called after put_object() * Revert "Suppress warnings in model_dump() when called after put_object()" This reverts commit e69019afb4d7092b4c6bf6b95607855b6c24fb46. * Suppress Pydantic warnings by default --- src/anyvar/anyvar.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/anyvar/anyvar.py b/src/anyvar/anyvar.py index 604ba07..841fe42 100644 --- a/src/anyvar/anyvar.py +++ b/src/anyvar/anyvar.py @@ -8,6 +8,7 @@ import logging.config import os import pathlib +import warnings from collections.abc import MutableMapping from urllib.parse import urlparse @@ -19,6 +20,10 @@ from anyvar.translate.vrs_python import VrsPythonTranslator from anyvar.utils.types import VrsObject +# Suppress pydantic warnings unless otherwise indicated +if os.environ.get("ANYVAR_SHOW_PYDANTIC_WARNINGS", None) is None: + warnings.filterwarnings("ignore", module="pydantic") + # Configure logging from file or use default logging_config_file = os.environ.get("ANYVAR_LOGGING_CONFIG", None) if logging_config_file and pathlib.Path(logging_config_file).is_file():