class ConfigParser: def __init__(self): self.config_dict = {} def sections(self): """Return a list of section names, excluding [DEFAULT]""" dict_to_return = [section for section in self.config_dict.keys() if not section in "DEFAULT"] return dict_to_return def add_section(self, section): pass def has_section(self, section): pass def options(self, section): pass def read(self, filename = None, fp = None): if not fp: fp = open(filename) self.config_dict = {line.replace('[','').replace(']',''):{} for line in fp.read()\ if line.startswith('[') and line.endwith(']') } def get(self, section, option): def items(self, section): def getboolean(self, section, option): def has_option(self, section, option): """Check for the existence of a given option in a given section.""" def set(self, section, option, value=None): """Set an option.""" def write(self, fp): """Write an .ini-format representation of the configuration state.""" def remove_option(self, section, option): """Remove an option.""" def remove_section(self, section): """Remove a file section."""