Source code for stdlibx.config.loaders.yaml

 1from __future__ import annotations
 2
 3from typing import TYPE_CHECKING, Literal
 4
 5from ruamel.yaml import YAML
 6from stdlibx.config.loaders.file import FileLoader
 7
 8if TYPE_CHECKING:
 9    from os import PathLike
10
11
[docs] 12class YamlLoader(FileLoader): 13 def __init__( 14 self, 15 path: str | PathLike[str], 16 *, 17 missing_ok: bool = False, 18 yaml_typ: Literal["rt", "safe", "unsafe", "full", "base"] | None = None, 19 yaml_pure: bool = False, 20 ) -> None: 21 super().__init__( 22 path, YAML(typ=yaml_typ, pure=yaml_pure).load, missing_ok=missing_ok 23 )