MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / _write_text

Method _write_text

commitizen/providers/base_provider.py:57–64  ·  view source on GitHub ↗

Write `content` to `path` with the configured encoding. The file is opened with `smart_open`, so the line ending follows `git config core.eol`, as it does for `version_files` and the changelog.

(self, path: Path, content: str)

Source from the content-addressed store, hash-verified

55 return self.config.settings["encoding"]
56
57 def _write_text(self, path: Path, content: str) -> None:
58 """Write `content` to `path` with the configured encoding.
59
60 The file is opened with `smart_open`, so the line ending follows
61 `git config core.eol`, as it does for `version_files` and the changelog.
62 """
63 with smart_open(path, "w", encoding=self._get_encoding()) as file:
64 file.write(content)
65
66
67class JsonProvider(FileProvider):

Callers 5

set_lock_versionMethod · 0.80
set_versionMethod · 0.80
set_versionMethod · 0.80
set_versionMethod · 0.80
set_lock_versionMethod · 0.80

Calls 2

_get_encodingMethod · 0.95
smart_openFunction · 0.90

Tested by

no test coverage detected