Merge branch '1-comment-code-help-functions' into 'master'

Resolve "comment code (help functions)"

Closes #1

See merge request !1
This commit is contained in:
Milka64 2018-02-23 15:49:39 +00:00
commit f08049b4a6

View file

@ -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')