compass.config.CompassConfigParser

class compass.config.CompassConfigParser[source]

A “meta” config parser that keeps a dictionary of config parsers and their sources to combine when needed. The custom config parser allows provenance of the source of different config options and allows the “user” config options to always take precedence over other config options (even if they are added later).

This version simply overrides the combine() method to also ensure that certain paths are absolute, rather than relative.

__init__()

Make a new (empty) config parser

Methods

__init__()

Make a new (empty) config parser

add_from_file(filename)

Add the contents of a config file to the parser.

add_from_package(package, config_filename[, ...])

Add the contents of a config file to the parser.

add_user_config(filename)

Add a the contents of a user config file to the parser.

append(other)

Append a deep copy of another config parser to this one.

combine([raw])

Combine the config files into one

copy()

Get a deep copy of the config parser

get(section, option)

Get an option value for a given section.

getboolean(section, option)

Get an option boolean value for a given section.

getexpression(section, option[, dtype, ...])

Get an option as an expression (typically a list, though tuples and dicts are also available).

getfloat(section, option)

Get an option float value for a given section.

getint(section, option)

Get an option integer value for a given section.

getlist(section, option[, dtype])

Get an option value as a list for a given section.

has_option(section, option)

Whether the given section has the given option

has_section(section)

Whether the given section is part of the config

list_files()

Get a list of files contributing to the combined config options

prepend(other)

Prepend a deep copy of another config parser to this one.

set(section, option[, value, comment, user])

Set the value of the given option in the given section. The file from

write(fp[, include_sources, ...])

Write the config options to the given file pointer.