The parser module contains the OptionsParser class which provides the ability to parse a configuration file and command line given a set of available options.
.
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.
Get the value of the given configuration option from the given section.
Get the settings dictionary.
Parse a configuration file.
The OptionsParser class is responsible for parsing command line and configuration file options and providing the ability to get the value of a given option.
This class implements the pyamp.patterns.Borg design pattern and also implements the pyamp.logging.Loggable interface.
This property contains the list of options that are only configurable via the command line.
This property contains a dictionary mapping section names to the list of options contained within that section. Options must be a subclass of the Option class. These are the sections and options that will be loaded from the configuration file and the command line arguments.
Note
Any ClOption objects that are given will be configurable via the configuration file and from the command line.
This property contains a dictionary mapping variable names to their respective values. These variables can be used within the configuration file and will be replaced by the assigned values.
Variables can be used in the configuration file by appending a dollar sign before the name of the variable. The variable will then replaced with its value prior to parsing the file.
Example:
# $HOME will be replaced with the user's home directory before parsing
[Section]
Var = $HOME
Get the value of an option from the given section.
Get the value of a command line option.
Override the pyamp.patterns.Borg init function.
pyamp.logging.LogData object
Parse the command line options, and the configuration file.
Set the logger for the OptionsParser.
pyamp.logging.LogData object