Exemplo n.º 1
0
 def options(self, section=None):
     """Return a list of option names for the given section name."""
     try:
         opts = self._sections[section].copy()
     except KeyError:
         if section not in ['', None, DEFAULTSECT, DEFAULTSECT.lower()]:
             raise NoSectionError(section)
         return self._defaults.keys()
     opts.update(self._defaults)
     for parent in self._parent_sections(section):
         opts.update(self._sections[parent])
     if '__name__' in opts:
         del opts['__name__']
     return opts.keys()
Exemplo n.º 2
0
 def items(self, section=None):
     try:
         d2 = self._get_interpolated_section(section)
     except KeyError:
         if section not in ['', None, DEFAULTSECT, DEFAULTSECT.lower()]:
             raise NoSectionError(section)
         return self._get_interpolated_section('').items()
     d = self._get_interpolated_section('')
     for parent in reversed(list(self._parent_sections(section))):
         d = merge(d, self._get_interpolated_section(parent))
     d = merge(d, d2)
     if "__name__" in d:
         del d["__name__"]
     return d.items()
Exemplo n.º 3
0
 def items(self, section=None):
     try:
         d2 = self._sections[section]
     except KeyError:
         if section not in ['', None, DEFAULTSECT, DEFAULTSECT.lower()]:
             raise NoSectionError(section)
         return self._defaults.items()
     d = self._defaults.copy()
     for parent in reversed(list(self._parent_sections(section))):
         d = merge(d, self._sections[parent])
     d = merge(d, d2)
     if "__name__" in d:
         del d["__name__"]
     return d.items()