Skip to content

Commit 4a3be39

Browse files
committed
TYP: Adjust yaml load arguments
1 parent 77651d1 commit 4a3be39

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/fmu/config/utilities.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Module with some simple functions, e.g. for parsing for YAML into RMS"""
22

3-
from __future__ import annotations
3+
from pathlib import Path
4+
from typing import Any
45

56
from yaml.loader import Loader
67

@@ -9,16 +10,19 @@
910

1011

1112
def yaml_load(
12-
filename: str, safe: bool = True, tool: str | None = None, loader: str = "standard"
13-
) -> dict | None:
13+
filename: str | Path,
14+
safe: bool = True,
15+
tool: str | None = None,
16+
loader: str = "standard",
17+
) -> dict[str, Any] | None:
1418
"""Load as YAML file, return a dictionary of type OrderedDict which is the config.
1519
1620
Returning an ordered dictionary is a main feature of this loader. It makes it much
1721
easier to compare the dictionaries returned. In addition, it allows for reading the
1822
input (extended) YAML format, if key ``allow_extended`` is True.
1923
2024
Args:
21-
filename (str): Name of file (YAML formatted)
25+
filename (str, Path): Name of file (YAML formatted)
2226
safe (bool): If True (default), then use `safe_load` when allow_extended is
2327
set to False. Not applied if loader is "fmu".
2428
tool (str): Refers to a particular main section in the config.

0 commit comments

Comments
 (0)