From 91772dfebd6dc31fa34a214a2ff5224e1b2b5fc5 Mon Sep 17 00:00:00 2001 From: "RICART Michael (X)" Date: Fri, 23 Feb 2018 16:41:09 +0100 Subject: [PATCH] fix issue#1 --- esp8266/uConfigParser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/esp8266/uConfigParser.py b/esp8266/uConfigParser.py index 73df532..e44a337 100644 --- a/esp8266/uConfigParser.py +++ b/esp8266/uConfigParser.py @@ -8,20 +8,24 @@ class ConfigParser: return dict_to_return def add_section(self, section): + """Create a new section in the configuration.""" self.config_dict[section] = {} def has_section(self, section): + """Indicate whether the named section is present in the configuration.""" if section in self.config_dict.keys(): return True else: return False def options(self, section): + """Return a list of option names for the given section name.""" if not section in self.config_dict: raise return self.config_dict[section].keys() def read(self, filename=None, fp=None): + """Read and parse a filename or a list of filenames.""" if not fp and not filename: print("ERROR : no filename and no fp") raise @@ -60,6 +64,7 @@ class ConfigParser: self.config_dict[section][option] = values def get(self, section, option): + """Get value of a givenoption in a given section.""" if not self.has_section(section) \ or not self.has_option(section,option): raise @@ -92,7 +97,7 @@ class ConfigParser: values = '\n '.join(values) else: fp.write(' ') - fp.write(values) + fp.write(values) fp.write('\n') fp.write('\n')