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

Function create_config

commitizen/config/factory.py:15–26  ·  view source on GitHub ↗
(*, data: bytes | str | None = None, path: Path)

Source from the content-addressed store, hash-verified

13
14
15def create_config(*, data: bytes | str | None = None, path: Path) -> BaseConfig:
16 if "toml" in path.suffix:
17 return TomlConfig(data=data or "", path=path)
18 if "json" in path.suffix:
19 return JsonConfig(data=data or "{}", path=path)
20 if "yaml" in path.suffix:
21 return YAMLConfig(data=data or "", path=path)
22
23 # Should be unreachable. See the constant CONFIG_FILES.
24 raise ValueError(
25 f"Unsupported config file: {path.name} due to unknown file extension"
26 )

Callers 2

_write_config_to_fileFunction · 0.90
_create_config_from_pathFunction · 0.90

Calls 3

TomlConfigClass · 0.90
JsonConfigClass · 0.90
YAMLConfigClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…