Work in progress for uConfigParser
This commit is contained in:
parent
600b1bf2fb
commit
f8efc58597
1 changed files with 12 additions and 4 deletions
|
@ -1,10 +1,11 @@
|
||||||
class RawConfigParser:
|
class ConfigParser:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
self.config_dict = {}
|
||||||
|
|
||||||
def sections(self):
|
def sections(self):
|
||||||
"""Return a list of section names, excluding [DEFAULT]"""
|
"""Return a list of section names, excluding [DEFAULT]"""
|
||||||
pass
|
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):
|
def add_section(self, section):
|
||||||
pass
|
pass
|
||||||
|
@ -16,7 +17,14 @@ class RawConfigParser:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def read(self, filename = None, fp = None):
|
def read(self, filename = None, fp = None):
|
||||||
pass
|
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 get(self, section, option):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue