|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | from pathlib import Path |
4 | | -from typing import TYPE_CHECKING, Any |
| 4 | +from typing import TYPE_CHECKING |
5 | 5 |
|
6 | 6 | import yaml |
7 | 7 |
|
@@ -52,19 +52,14 @@ def _parse_setting(self, data: bytes | str) -> None: |
52 | 52 | except (KeyError, TypeError): |
53 | 53 | self.is_empty_config = True |
54 | 54 |
|
55 | | - def set_key(self, key: str, value: Any) -> Self: |
56 | | - """Set or update a key in the conf. |
57 | | -
|
58 | | - For now only strings are supported. |
59 | | - We use to update the version number. |
60 | | - """ |
| 55 | + def set_key(self, key: str, value: object) -> Self: |
61 | 56 | with open(self.path, "rb") as yaml_file: |
62 | | - parser = yaml.load(yaml_file, Loader=yaml.FullLoader) |
| 57 | + config_doc = yaml.load(yaml_file, Loader=yaml.FullLoader) |
63 | 58 |
|
64 | | - parser["commitizen"][key] = value |
| 59 | + config_doc["commitizen"][key] = value |
65 | 60 | with smart_open( |
66 | 61 | self.path, "w", encoding=self._settings["encoding"] |
67 | 62 | ) as yaml_file: |
68 | | - yaml.dump(parser, yaml_file, explicit_start=True) |
| 63 | + yaml.dump(config_doc, yaml_file, explicit_start=True) |
69 | 64 |
|
70 | 65 | return self |
0 commit comments