Did I find the right examples for you? yes no

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
Generate a configuration parser for all modules described.
'name' is either a directory containing model files (must
end with .ini) or a single model file (also with .ini sufix).
A new cfg.ConfigParser instance will be created unless
specified as 'parser' parameter.

        def generateParser(name, LOG=None, parser=None):
    """ Generate a configuration parser for all modules described.
        'name' is either a directory containing model files (must
        end with .ini) or a single model file (also with .ini sufix).
        A new cfg.ConfigParser instance will be created unless
        specified as 'parser' parameter.
    """

    if os.path.isfile(name):
        filenames = [name]
    elif os.path.isdir(name):
        filenames = list()
        for n in os.listdir(name):
            filenames.append(os.path.join(name, n))
    else:
        raise ValueError('%s is neither a file nor a directory' % name)

    if parser is None:
        parser = cfgparse.ConfigParser()
    for filename in filenames:
        parseModel(filename, parser,  LOG)
    return parser
        


src/h/a/haufe.hrs.configuration-0.5.18/haufe/hrs/configuration/demo.py   haufe.hrs.configuration(Download)
 
if __name__ == '__main__':
    from haufe.hrs.configuration import generateParser, OptionLookup
 
    import logging
    LOG = logging.getLogger()
    parser = generateParser('example/model', LOG)

src/h/a/haufe.hrs.configuration-0.5.18/haufe/hrs/configuration/tests/test_configuration.py   haufe.hrs.configuration(Download)
import unittest
from unittest import TestCase, TestSuite, makeSuite
from haufe.hrs.configuration import generateParser, OptionLookup
from haufe.hrs.configuration import util
 
    def _generateParser(self, name):
        return generateParser(os.path.join(dirname, name))
 
    def testParseModel(self):
        parser = self._generateParser('model')