| 16 | |
| 17 | |
| 18 | class BaseConfig: |
| 19 | def __init__(self) -> None: |
| 20 | self._settings: Settings = DEFAULT_SETTINGS.copy() |
| 21 | self._path: Path | None = None |
| 22 | |
| 23 | def contains_commitizen_section(self) -> bool: |
| 24 | """Check if the config file contains a commitizen section. |
| 25 | |
| 26 | The implementation is different for each config file type. |
| 27 | """ |
| 28 | raise NotImplementedError() |
| 29 | |
| 30 | @property |
| 31 | def settings(self) -> Settings: |
| 32 | return self._settings |
| 33 | |
| 34 | @property |
| 35 | def path(self) -> Path: |
| 36 | return self._path # type: ignore[return-value] |
| 37 | |
| 38 | @path.setter |
| 39 | def path(self, path: Path) -> None: |
| 40 | self._path = Path(path) |
| 41 | |
| 42 | def set_key(self, key: str, value: object) -> Self: |
| 43 | """Set or update a key in the config file. |
| 44 | |
| 45 | Currently, only strings are supported for the parameter key. |
| 46 | """ |
| 47 | raise NotImplementedError() |
| 48 | |
| 49 | def update(self, data: Settings) -> None: |
| 50 | self._settings.update(data) |
| 51 | |
| 52 | def _parse_setting(self, data: bytes | str) -> None: |
| 53 | raise NotImplementedError() |
| 54 | |
| 55 | def init_empty_config_content(self) -> None: |
| 56 | """Create a config file with the empty config content. |
| 57 | |
| 58 | The implementation is different for each config file type. |
| 59 | """ |
| 60 | raise NotImplementedError() |
no outgoing calls
searching dependent graphs…