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

Method get_bool

pygit2/config.py:222–235  ·  view source on GitHub ↗

Look up *key* and parse its value as a boolean as per the git-config rules. Return a boolean value (True or False). Truthy values are: 'true', 1, 'on' or 'yes'. Falsy values are: 'false', 0, 'off' and 'no'

(self, key: str | bytes)

Source from the content-addressed store, hash-verified

220 check_error(err)
221
222 def get_bool(self, key: str | bytes) -> bool:
223 """Look up *key* and parse its value as a boolean as per the git-config
224 rules. Return a boolean value (True or False).
225
226 Truthy values are: 'true', 1, 'on' or 'yes'. Falsy values are: 'false',
227 0, 'off' and 'no'
228 """
229
230 entry = self._get_entry(key)
231 res = ffi.new('int *')
232 err = C.git_config_parse_bool(res, entry.c_value)
233 check_error(err)
234
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

Callers 3

test_newFunction · 0.95
test_addFunction · 0.95
test_readFunction · 0.80

Calls 2

_get_entryMethod · 0.95
check_errorFunction · 0.85

Tested by 3

test_newFunction · 0.76
test_addFunction · 0.76
test_readFunction · 0.64