Coverage for src / ezqt_app / domain / ports / config_service.py: 100.00%

3 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-06 13:12 +0000

1# /////////////////////////////////////////////////////////////// 

2# DOMAIN.PORTS.CONFIG_SERVICE - Config service port 

3# Project: ezqt_app 

4# /////////////////////////////////////////////////////////////// 

5 

6"""Protocol definitions for configuration services.""" 

7 

8from __future__ import annotations 

9 

10# /////////////////////////////////////////////////////////////// 

11# IMPORTS 

12# /////////////////////////////////////////////////////////////// 

13# Standard library imports 

14from pathlib import Path 

15from typing import Any, Protocol 

16 

17 

18# /////////////////////////////////////////////////////////////// 

19# PROTOCOLS 

20# /////////////////////////////////////////////////////////////// 

21class ConfigServiceProtocol(Protocol): 

22 """Technical contract for configuration services.""" 

23 

24 def set_project_root(self, project_root: Path | str) -> None: 

25 """Set the active project root directory.""" 

26 

27 def load_config( 

28 self, config_name: str, force_reload: bool = False 

29 ) -> dict[str, Any]: 

30 """Load a named configuration.""" 

31 

32 def get_config_value( 

33 self, config_name: str, key_path: str, default: Any = None 

34 ) -> Any: 

35 """Read a specific value from a configuration.""" 

36 

37 def save_config(self, config_name: str, config_data: dict[str, Any]) -> bool: 

38 """Persist a named configuration."""