From 3ba48a2c9001817fa6c62c4da268a6a0a46c887c Mon Sep 17 00:00:00 2001 From: Ivan Ruiz Manuel <72193617+irm-codebase@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:48:25 +0100 Subject: [PATCH] Remove unused load function in attrdict --- src/calliope/attrdict.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/calliope/attrdict.py b/src/calliope/attrdict.py index 3c171090..02e2ad28 100644 --- a/src/calliope/attrdict.py +++ b/src/calliope/attrdict.py @@ -21,29 +21,6 @@ def __nonzero__(self): _MISSING = __Missing() -def _yaml_load(src): - """Load YAML from a file object or path with useful parser errors.""" - yaml = ruamel_yaml.YAML(typ="safe") - if not isinstance(src, str): - try: - src_name = src.name - except AttributeError: - src_name = "" - # Force-load file streams as that allows the parser to print - # much more context when it encounters an error - src = src.read() - else: - src_name = "" - try: - result = yaml.load(src) - if not isinstance(result, dict): - raise ValueError(f"Could not parse {src_name} as YAML") - return result - except ruamel_yaml.YAMLError: - logger.error(f"Parser error when reading YAML from {src_name}.") - raise - - class AttrDict(dict): """Extended `dict` class."""