Lines Matching full:section

128     def _handle_no_value(self, section, key, default):  argument
130 msg = ("Value '%s' not found in section '%s'" %
131 (key, section))
137 def get_section_as_dict(self, section): argument
138 """Return a dict mapping section options to values.
140 This is useful if a config section is being used like a
141 dictionary. If the section is missing, return an empty dict.
144 in the section.
146 @param section: Section to get.
149 if self.config.has_section(section):
150 return collections.OrderedDict(self.config.items(section))
155 def get_section_values(self, section): argument
157 Return a config parser object containing a single section of the
160 @param section: Section we want to turn into a config parser object.
161 @return: ConfigParser() object containing all the contents of section.
164 cfgparser.add_section(section)
165 for option, value in self.config.items(section):
166 cfgparser.set(section, option, value)
170 def get_config_value(self, section, key, type=str, argument
174 @param section: Section the key is in.
188 val = self.config.get(section, key)
190 return self._handle_no_value(section, key, default)
193 return self._handle_no_value(section, key, default)
195 return self._convert_value(key, section, val, type)
198 def get_config_value_regex(self, section, key_regex, type=str): argument
199 """Get a dict of configs in given section with key matched to key-regex.
201 @param section: Section the key is in.
209 for option, value in self.config.items(section):
211 configs[option] = self._convert_value(option, section, value,
217 # get_config_value which is mostly called with (section, key, type).
218 def get_config_value_with_fallback(self, section, key, fallback_key, argument
227 @param section: Section the key is in.
232 @param fallback_section: The section the fallback key resides in. In
233 case none is specified, the the same section as
248 fallback_section = section
251 return self.get_config_value(section, key, type, **kwargs)
257 def override_config_value(self, section, key, new_value): argument
260 @param section: Name of the section.
264 self.config.set(section, key, new_value)
282 for section in sections:
283 # add the section if need be
284 if not self.config.has_section(section):
285 self.config.add_section(section)
287 options = override_config.options(section)
289 val = override_config.get(section, option)
290 self.config.set(section, option, val)
323 def _convert_value(self, key, section, value, value_type): argument
356 msg = ("Could not convert %s value %r in section %s to type %s" %
357 (key, sval, section, value_type))
385 def set_config_value(self, section, key, value): argument
386 self._config_info[(section, key)] = value
389 def get_config_value(self, section, key, type=str, argument
391 identifier = (section, key)