MCPcopy Index your code
hub / github.com/python/cpython / Get

Method Get

Lib/idlelib/config.py:50–65  ·  view source on GitHub ↗

Get an option value for given section/option or return default. If type is specified, return as type.

(self, section, option, type=None, default=None, raw=False)

Source from the content-addressed store, hash-verified

48 ConfigParser.__init__(self, defaults=cfgDefaults, strict=False)
49
50 def Get(self, section, option, type=None, default=None, raw=False):
51 """
52 Get an option value for given section/option or return default.
53 If type is specified, return as type.
54 """
55 # TODO Use default as fallback, at least if not None
56 # Should also print Warning(file, section, option).
57 # Currently may raise ValueError
58 if not self.has_option(section, option):
59 return default
60 if type == 'bool':
61 return self.getboolean(section, option)
62 elif type == 'int':
63 return self.getint(section, option)
64 else:
65 return self.get(section, option, raw=raw)
66
67 def GetOptionList(self, section):
68 "Return a list of options for given section, else []."

Callers 12

test_getMethod · 0.95
test_load_fileMethod · 0.95
GetOptionMethod · 0.80
GetThemeDictMethod · 0.80
save_optionMethod · 0.80
dumpCfgFunction · 0.80
delete_customMethod · 0.80
delete_custom_keysMethod · 0.80
load_extensionsMethod · 0.80
test_set_optionMethod · 0.80
test_load_cfg_filesMethod · 0.80

Calls 4

has_optionMethod · 0.45
getbooleanMethod · 0.45
getintMethod · 0.45
getMethod · 0.45

Tested by 4

test_getMethod · 0.76
test_load_fileMethod · 0.76
test_set_optionMethod · 0.64
test_load_cfg_filesMethod · 0.64