From 8f4ddde401490f5f64aafd8d72f62c857d6bc7db Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 07:59:43 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/anemoi/utils/config.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/anemoi/utils/config.py b/src/anemoi/utils/config.py index 1796dc5..adbf054 100644 --- a/src/anemoi/utils/config.py +++ b/src/anemoi/utils/config.py @@ -208,6 +208,7 @@ def load_any_dict_format(path) -> dict: if path == "-": import sys + config = sys.stdin.read() parsers = [(yaml.safe_load, "yaml"), (json.loads, "json"), (tomllib.loads, "toml")] @@ -216,10 +217,10 @@ def load_any_dict_format(path) -> dict: try: LOG.debug(f"Trying {parser_type} parser for stdin") return parser(config) - except Exception as e: + except Exception: pass - raise ValueError(f"Failed to parse configuration from stdin") + raise ValueError("Failed to parse configuration from stdin") except (json.JSONDecodeError, yaml.YAMLError, tomllib.TOMLDecodeError) as e: LOG.warning(f"Failed to parse config file {path}", exc_info=e)