#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ # @Version : Python 3.11.4 # @Software : Sublime Text 4 # @Author : StudentCWZ # @Email : StudentCWZ@outlook.com # @Date : 2023/10/28 15:07 # @File : local.py # @Description : """ import os from typing import Any import yaml class LocalConfig: def __init__(self, config_dir: str): self.config_dir = config_dir def load(self, filename: str) -> Any: filepath = os.path.join(self.config_dir, filename) if not os.path.exists(filepath): raise FileNotFoundError(f'No such file or directory: {filepath}') with open(filepath, 'r') as file: cfg = yaml.safe_load(file) return cfg