Exemple #1
0
    def __parse_section(self, config):
#        '''
#            Retrieve the subsections, recursively.
#            Internal purposes.
#        '''
#        sectDict = {}
#        for key in config.keys():
#            if type(config[key]) == type(dict()):
#                sectDict[key] = vmgSection(key, self.__parse_section(config[key]))
#            else:
#                sectDict[key] = config[key]
#
#        return sectDict
#        
        '''
            Retrieve the subsections, recursively.
            Internal purposes.
        '''
        sectDict = {}
        for key in config.keys():
            if type(config[key]) is str:
                sectDict[key] = config[key]
            else:
                sectDict[key] = vmgSection(key, self.__parse_section(config[key]))
        return sectDict
Exemple #2
0
 def __parse_section(self, config):
     #        '''
     #            Retrieve the subsections, recursively.
     #            Internal purposes.
     #        '''
     #        sectDict = {}
     #        for key in config.keys():
     #            if type(config[key]) == type(dict()):
     #                sectDict[key] = vmgSection(key, self.__parse_section(config[key]))
     #            else:
     #                sectDict[key] = config[key]
     #
     #        return sectDict
     #
     '''
         Retrieve the subsections, recursively.
         Internal purposes.
     '''
     sectDict = {}
     for key in config.keys():
         if type(config[key]) is str:
             sectDict[key] = config[key]
         else:
             sectDict[key] = vmgSection(key,
                                        self.__parse_section(config[key]))
     return sectDict
Exemple #3
0
 def parse(self):
     '''
         Use the configObj library to parse the file.
         '''
     config = ConfigObj(infile=self.infile, raise_errors=True, file_error=True)
     rootDict = {}
     for sect in config.keys():
         rootDict[sect] = vmgSection(sect, self.__parse_section(config[sect]))
     self.struct = vmgStruct(rootDict)
Exemple #4
0
 def parse(self):
     '''
         Use the configObj library to parse the file.
         '''
     config = ConfigObj(infile=self.infile,
                        raise_errors=True,
                        file_error=True)
     rootDict = {}
     for sect in config.keys():
         rootDict[sect] = vmgSection(sect,
                                     self.__parse_section(config[sect]))
     self.struct = vmgStruct(rootDict)