The configFile module

The configFile module contains the ConfigFile class which provides the ability to parse a configuration file for configured Option objects.

The ConfigFile class

Inheritance diagram of pyamp.config.configFile.ConfigFile

class pyamp.config.configFile.ConfigFile(configurationFile=None, options=None, variables=None, logger=None)[source]

The ConfigFile class is responsible for parsing a configuration file with the given dictionary of sections and options, and variables.

The ConfigFile class takes a dictionary of options which map the configuration section names to the list of configuration Option objects associated with that section. It also takes a dictionary of variables mapping the name of the variable to the value for the variable. The variable names can then be used in a configuration file by adding a $ before the variable name. This value will then be replaced with the value assigned in the variables dictionary.

This class implements the Loggable interface. This class uses the ConfigParser module to parse the configuration file, and thus parses configuration files of the same format.

  • configurationFile – The configuration file to load
  • options – The dictionary of supported options
  • variables – The dictionary of supported variables
  • logger – The logger
get(section, option, defaultValue=None)[source]

Get the value of the given configuration option from the given section.

  • section – The section name
  • option – The option
  • defaultValue – The default value if the option does not exist
getSettings()[source]

Get the settings dictionary.

parse(filename)[source]

Parse a configuration file.

  • filename – The configuration file to parse

Table Of Contents

Previous topic

The option module

Next topic

The parser module

This Page