From 105718b0566cf10e56e62677e5867bc76e67e3d2 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 29 May 2019 10:50:09 -0400 Subject: [PATCH] simpler --- sopel_modules/SpiceBot/Config.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/sopel_modules/SpiceBot/Config.py b/sopel_modules/SpiceBot/Config.py index 894f62a..8cf5acf 100644 --- a/sopel_modules/SpiceBot/Config.py +++ b/sopel_modules/SpiceBot/Config.py @@ -12,11 +12,6 @@ class BotConfig(): def __init__(self): self.dict = {} - self.config = None - self.filename = None - self.load_config() - - def load_config(self): # Load config parser = build_parser() @@ -31,19 +26,14 @@ class BotConfig(): self.filename = self.config.filename # load as dict - self.dict = self.config_file_to_dict() - - def config_file_to_dict(self): - configdict = dict() config = configparser.ConfigParser() config.read(self.filename) for each_section in config.sections(): - if each_section not in configdict.keys(): - configdict[each_section] = dict() - for (each_key, each_val) in config.items(each_section): - if each_key not in configdict[each_section].keys(): - configdict[each_section][each_key] = each_val - return configdict + if each_section not in self.dict.keys(): + self.dict[each_section] = dict() + for (each_key, each_val) in config.items(each_section): + if each_key not in self.dict[each_section].keys(): + self.dict[each_section][each_key] = each_val botconfig = BotConfig()