Coverage for src / local_deep_research / defaults / __init__.py: 26%
19 statements
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
« prev ^ index » next coverage.py v7.12.0, created at 2026-01-11 00:51 +0000
1"""
2Default configuration module for Local Deep Research.
4This module is responsible for loading and initializing default
5configuration files and resources used throughout the application.
6"""
8from loguru import logger
9from pathlib import Path
12# Define the path to the package's defaults directory
13DEFAULTS_DIR = Path(__file__).parent
15# Default files available in this package
16DEFAULT_FILES = {
17 "main.toml": DEFAULTS_DIR / "main.toml",
18 "local_collections.toml": DEFAULTS_DIR / "local_collections.toml",
19 "search_engines.toml": DEFAULTS_DIR / "search_engines.toml",
20}
23def get_default_file_path(filename):
24 """Get the path to a default configuration file."""
25 if filename in DEFAULT_FILES:
26 return DEFAULT_FILES[filename]
27 return None
30def list_default_files():
31 """List all available default configuration files."""
32 return list(DEFAULT_FILES.keys())
35def ensure_defaults_exist():
36 """Verify that all expected default files exist in the package."""
37 missing = []
38 for filename, filepath in DEFAULT_FILES.items():
39 if not filepath.exists():
40 missing.append(filename)
42 if missing:
43 logger.warning(
44 f"The following default files are missing from the package: {', '.join(missing)}"
45 )
46 return False
47 return True