Lines Matching full:section
3 A setup file consists of sections, lead by a "[section]" header,
8 the same section, or values in a special [DEFAULT] section.
31 its value is the section's name.
34 return all the configuration section names, sans DEFAULT
36 has_section(section)
37 return whether the given section exists
39 has_option(section, option)
40 return whether the given option exists in the given section
42 options(section)
43 return list of configuration options for the named section
55 get(section, option, raw=False, vars=None)
58 constructor and the DEFAULT section. Additional substitutions may be
62 getint(section, options)
65 getfloat(section, options)
68 getboolean(section, options)
73 items(section, raw=False, vars=None)
75 in the section.
77 remove_section(section)
78 remove the given file section and all its options
80 remove_option(section, option)
81 remove the given option from the given section
83 set(section, option, value)
140 """Raised when no section matches a requested option."""
142 def __init__(self, section): argument
143 Error.__init__(self, 'No section: %r' % (section,))
144 self.section = section
145 self.args = (section, )
148 """Raised when a section is multiply-created."""
150 def __init__(self, section): argument
151 Error.__init__(self, "Section %r already exists" % section)
152 self.section = section
153 self.args = (section, )
158 def __init__(self, option, section): argument
159 Error.__init__(self, "No option %r in section: %r" %
160 (option, section))
162 self.section = section
163 self.args = (option, section)
168 def __init__(self, option, section, msg): argument
171 self.section = section
172 self.args = (option, section, msg)
177 def __init__(self, option, section, rawval, reference): argument
183 % (section, option, reference, rawval))
184 InterpolationError.__init__(self, option, section, msg)
186 self.args = (option, section, rawval, reference)
195 def __init__(self, option, section, rawval): argument
200 % (section, option, rawval))
201 InterpolationError.__init__(self, option, section, msg)
202 self.args = (option, section, rawval)
218 """Raised when a key-value pair is found before any section header."""
223 'File contains no section headers.\nfile: %s, line: %d\n%r' %
249 """Return a list of section names, excluding [DEFAULT]"""
253 def add_section(self, section): argument
254 """Create a new section in the configuration.
256 Raise DuplicateSectionError if a section by the specified name
260 if section.lower() == "default":
261 raise ValueError, 'Invalid section name: %s' % section
263 if section in self._sections:
264 raise DuplicateSectionError(section)
265 self._sections[section] = self._dict()
267 def has_section(self, section): argument
268 """Indicate whether the named section is present in the configuration.
270 The DEFAULT section is not acknowledged.
272 return section in self._sections
274 def options(self, section): argument
275 """Return a list of option names for the given section name."""
277 opts = self._sections[section].copy()
279 raise NoSectionError(section)
326 def get(self, section, option): argument
328 if section not in self._sections:
329 if section != DEFAULTSECT:
330 raise NoSectionError(section)
334 raise NoOptionError(option, section)
335 elif opt in self._sections[section]:
336 return self._sections[section][opt]
340 raise NoOptionError(option, section)
342 def items(self, section): argument
344 d2 = self._sections[section]
346 if section != DEFAULTSECT:
347 raise NoSectionError(section)
355 def _get(self, section, conv, option): argument
356 return conv(self.get(section, option))
358 def getint(self, section, option): argument
359 return self._get(section, int, option)
361 def getfloat(self, section, option): argument
362 return self._get(section, float, option)
367 def getboolean(self, section, option): argument
368 v = self.get(section, option)
376 def has_option(self, section, option): argument
377 """Check for the existence of a given option in a given section."""
378 if not section or section == DEFAULTSECT:
381 elif section not in self._sections:
385 return (option in self._sections[section]
388 def set(self, section, option, value=None): argument
390 if not section or section == DEFAULTSECT:
394 sectdict = self._sections[section]
396 raise NoSectionError(section)
406 for section in self._sections:
407 fp.write("[%s]\n" % section)
408 for (key, value) in self._sections[section].items():
416 def remove_option(self, section, option): argument
418 if not section or section == DEFAULTSECT:
422 sectdict = self._sections[section]
424 raise NoSectionError(section)
431 def remove_section(self, section): argument
432 """Remove a file section."""
433 existed = section in self._sections
435 del self._sections[section]
439 # Regular expressions for parsing section headers and options.
494 # a section header or option header?
496 # is it a section header?
510 # no section header in the file?
590 def get(self, section, option, raw=False, vars=None): argument
591 """Get an option value for a given section.
594 in `vars' (if provided), `section', and in `defaults' in that order.
600 The section DEFAULT is special.
604 sectiondict = self._sections[section]
606 if section != DEFAULTSECT:
607 raise NoSectionError(section)
618 raise NoOptionError(option, section)
623 return self._interpolate(section, option, value, d)
625 def items(self, section, raw=False, vars=None): argument
627 in the section.
635 The section DEFAULT is special.
639 d.update(self._sections[section])
641 if section != DEFAULTSECT:
642 raise NoSectionError(section)
654 return [(option, self._interpolate(section, option, d[option], d))
657 def _interpolate(self, section, option, rawval, vars): argument
669 option, section, rawval, e.args[0])
673 raise InterpolationDepthError(option, section, rawval)
688 def _interpolate(self, section, option, rawval, vars): argument
691 self._interpolate_some(option, L, rawval, section, vars, 1)
696 def _interpolate_some(self, option, accum, rest, section, map, depth): argument
698 raise InterpolationDepthError(option, section, rest)
715 raise InterpolationSyntaxError(option, section,
723 option, section, rest, var)
726 section, map, depth + 1)
731 option, section,
734 def set(self, section, option, value=None): argument
753 ConfigParser.set(self, section, option, value)