20 lines
482 B
Python
20 lines
482 B
Python
"""YAML parser — simple wrapper around yaml.safe_load for configuration files."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
import yaml
|
|
|
|
|
|
class YamlParser:
|
|
"""Load a YAML file and return its contents as a Python dict/list."""
|
|
|
|
def load(self, file_path: Path) -> Any:
|
|
try:
|
|
with open(file_path, encoding="utf-8") as f:
|
|
return yaml.safe_load(f)
|
|
except Exception:
|
|
return None
|