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

Method get_int

pygit2/config.py:237–250  ·  view source on GitHub ↗

Look up *key* and parse its value as an integer as per the git-config rules. Return an integer. A value can have a suffix 'k', 'm' or 'g' which stand for 'kilo', 'mega' and 'giga' respectively.

(self, key: bytes | str)

Source from the content-addressed store, hash-verified

235 return res[0] != 0
236
237 def get_int(self, key: bytes | str) -> int:
238 """Look up *key* and parse its value as an integer as per the git-config
239 rules. Return an integer.
240
241 A value can have a suffix 'k', 'm' or 'g' which stand for 'kilo',
242 'mega' and 'giga' respectively.
243 """
244
245 entry = self._get_entry(key)
246 res = ffi.new('int64_t *')
247 err = C.git_config_parse_int64(res, entry.c_value)
248 check_error(err)
249
250 return res[0]
251
252 def add_file(self, path: str | Path, level: int = 0, force: int = 0) -> None:
253 """Add a config file instance to an existing config."""

Callers 2

test_readFunction · 0.80
test_writeFunction · 0.80

Calls 2

_get_entryMethod · 0.95
check_errorFunction · 0.85

Tested by 2

test_readFunction · 0.64
test_writeFunction · 0.64