(
*, cwd: Path, profile_layer_path: Path | None
)
| 259 | |
| 260 | |
| 261 | def discover_config_paths( |
| 262 | *, cwd: Path, profile_layer_path: Path | None |
| 263 | ) -> tuple[list[Path], dict[str, Any]]: |
| 264 | resolved_cwd = cwd.expanduser().resolve() |
| 265 | if not resolved_cwd.is_dir(): |
| 266 | raise ValueError(f"cwd must be a directory, got {str(resolved_cwd)!r}") |
| 267 | |
| 268 | base_paths = [SYSTEM_CONFIG, DEFAULT_CONFIG] |
| 269 | if profile_layer_path is not None: |
| 270 | base_paths.append(profile_layer_path) |
| 271 | base_layers = [(path, read_toml(path, required=False)) for path in base_paths] |
| 272 | project_root = resolve_project_root(resolved_cwd, base_layers) |
| 273 | trust_level = project_trust_level(base_layers, project_root) |
| 274 | paths = [*base_paths] |
| 275 | if trust_level == "trusted": |
| 276 | paths.extend(project_config_paths(project_root, resolved_cwd)) |
| 277 | return paths, { |
| 278 | "cwd": str(resolved_cwd), |
| 279 | "project_root": str(project_root), |
| 280 | "project_trust_level": trust_level, |
| 281 | "project_layers_loaded": trust_level == "trusted", |
| 282 | } |
| 283 | |
| 284 | |
| 285 | def compare(actual: Any, op: str, expected: Any) -> bool: |
no test coverage detected