Load the base configuration from a YAML file. Args: file_path (str): Path to the YAML configuration file. Returns: Dict[str, Any]: The loaded configuration as a dictionary.
(file_path: str)
| 48 | |
| 49 | |
| 50 | def load_base_config(file_path: str) -> Dict[str, Any]: |
| 51 | """ |
| 52 | Load the base configuration from a YAML file. |
| 53 | |
| 54 | Args: |
| 55 | file_path (str): Path to the YAML configuration file. |
| 56 | |
| 57 | Returns: |
| 58 | Dict[str, Any]: The loaded configuration as a dictionary. |
| 59 | """ |
| 60 | # Load environment variables from .env file if it exists |
| 61 | if not load_dotenv(os.path.join(os.getcwd(), '.env')): |
| 62 | Env.load_env() |
| 63 | |
| 64 | if not os.path.exists(file_path): |
| 65 | logger.warning( |
| 66 | f'Config file {file_path} does not exist. Using default config (ArxivSearch).' |
| 67 | ) |
| 68 | return {} |
| 69 | |
| 70 | import yaml |
| 71 | with open(file_path, 'r') as file: |
| 72 | config = yaml.safe_load(file) |
| 73 | |
| 74 | return process_dict(config) |
| 75 | |
| 76 | |
| 77 | def process_dict(config: Dict[str, Any]) -> Dict[str, Any]: |
no test coverage detected