MCPcopy Create free account
hub / github.com/libgit2/pygit2 / __setitem__

Method __setitem__

pygit2/config.py:150–161  ·  view source on GitHub ↗
(self, key: str | bytes, value: bool | int | str | bytes)

Source from the content-addressed store, hash-verified

148 return entry.value
149
150 def __setitem__(self, key: str | bytes, value: bool | int | str | bytes) -> None:
151 key = str_to_bytes(key, 'key')
152
153 err = 0
154 if isinstance(value, bool):
155 err = C.git_config_set_bool(self._config, key, value)
156 elif isinstance(value, int):
157 err = C.git_config_set_int64(self._config, key, value)
158 else:
159 err = C.git_config_set_string(self._config, key, to_bytes(value))
160
161 check_error(err)
162
163 def __delitem__(self, key: str | bytes) -> None:
164 key = str_to_bytes(key, 'key')

Callers 1

test_writeFunction · 0.45

Calls 3

str_to_bytesFunction · 0.85
to_bytesFunction · 0.85
check_errorFunction · 0.85

Tested by 1

test_writeFunction · 0.36