Module nemo.configfile

Configuration file processing (eg, filenames).

Functions

def get(section, option)
Expand source code
def get(section, option):
    """Get an option value for the named section.

    This works the same as ConfigParser.get.
    """
    return config.get(section, option)

Get an option value for the named section.

This works the same as ConfigParser.get.

def has_option_p(section, option)
Expand source code
def has_option_p(section, option):
    """Check if this section has a given option.

    This works the same as ConfigParser.has_option.
    """
    return config.has_option(section, option)

Check if this section has a given option.

This works the same as ConfigParser.has_option.

def load(filename)
Expand source code
def load(filename):
    """Load a configuration file (or files)."""
    result = config.read(filename)
    if not result:
        msg = f"config file {filename} not found"
        raise FileNotFoundError(msg)
    # Verify
    config.get('generation', 'cst-trace')
    config.get('generation', 'egs-geothermal-trace')
    config.get('generation', 'hsa-geothermal-trace')
    config.get('generation', 'wind-trace')
    config.get('generation', 'pv1axis-trace')
    config.get('demand', 'demand-trace')

Load a configuration file (or files).