Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 21, 2024
1 parent 6981014 commit 8f4ddde
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/anemoi/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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)
Expand Down

0 comments on commit 8f4ddde

Please sign in to comment.