Loads a YAML file and returns its content. Args: file_path: Path to the YAML file. Returns: The content of the YAML file. Raises: FileNotFoundError: If the file_path does not exist.
(file_path: Union[str, Path])
| 28 | |
| 29 | |
| 30 | def load_yaml_file(file_path: Union[str, Path]) -> Any: |
| 31 | """Loads a YAML file and returns its content. |
| 32 | |
| 33 | Args: |
| 34 | file_path: Path to the YAML file. |
| 35 | |
| 36 | Returns: |
| 37 | The content of the YAML file. |
| 38 | |
| 39 | Raises: |
| 40 | FileNotFoundError: If the file_path does not exist. |
| 41 | """ |
| 42 | file_path = Path(file_path) |
| 43 | if not file_path.is_file(): |
| 44 | raise FileNotFoundError(f'YAML file not found: {file_path}') |
| 45 | with file_path.open('r', encoding='utf-8') as f: |
| 46 | return yaml.safe_load(f) |
| 47 | |
| 48 | |
| 49 | def dump_pydantic_to_yaml( |