MCPcopy Index your code
hub / github.com/commitizen-tools/commitizen / set_key

Method set_key

commitizen/config/json_config.py:42–49  ·  view source on GitHub ↗
(self, key: str, value: object)

Source from the content-addressed store, hash-verified

40 json.dump({"commitizen": {}}, json_file)
41
42 def set_key(self, key: str, value: object) -> Self:
43 with self.path.open("rb") as f:
44 config_doc = json.load(f)
45
46 config_doc["commitizen"][key] = value
47 with smart_open(self.path, "w", encoding=self._settings["encoding"]) as f:
48 json.dump(config_doc, f, indent=2)
49 return self
50
51 def _parse_setting(self, data: bytes | str) -> None:
52 """We expect to have a section in .cz.json looking like

Callers 3

test_set_keyFunction · 0.45
set_versionMethod · 0.45
_write_config_to_fileFunction · 0.45

Calls 1

smart_openFunction · 0.90

Tested by 1

test_set_keyFunction · 0.36