Instantiate a configuration class for plasTeX that parses the command-line options as well as reads the config files.
The optional argument, defaults , is a dictionary of default values for the configuration object. These values are used if a value is not found in the requested section.
merge items from another ConfigManager. This allows you to add ConfigManager instances with syntax like: config + other. This operation will modify the original instance.
create a new section in the configuration with the given name. This name is the name used for the section heading in the INI file (i.e. the name used within square brackets ([ ]) to start a section). The return value of this method is a reference to the newly created section.
read configuration data contained in files specified by filenames . Files that cannot be opened are silently ignored. This is designed so that you can specify a list of potential configuration file locations (e.g. current directory, user’s home directory, system directory), and all existing configuration files in the list will be read. A single filename may also be given.
retrieve the value of option from the section section . Setting raw to true prevents any string interpolation from occurring in that value. vars is a dictionary of addition value to use when interpolating values into the option.
Note: You can alsouse the alternative dictionary syntax: config[section].get(option).
parse the command-line options. If args is not given, the args are parsed from sys.argv[1:]. If merge is set to false, then the options are not merged into the configuration. The return value is a two element tuple. The first value is a list of parsed options in the form (option, value), and the second value is the list of arguments.
return the option value as a list using delim as the delimiter
add a category to group options when printing the command-line help. Command-line options can be grouped into categories to make options easier to find when printing the usage message for a program. Categories consist of two pieces: 1) the name, and 2) the title. The name is the key in the category dictionary and is the name used when specifying which category an option belongs to. The title is the actual text that you see as a section header when printing the usage message.
return a boolean indicating whether or not an option with the given name exists in the given section
merge items from another ConfigManager. This allows you to add ConfigManager instances with syntax like: config += other.
return a list of configured option names within a section. Options are all of the settings of a configuration file within a section (i.e. the lines that start with ‘optionname=’).
merge items from another ConfigManager. This allows you to add ConfigManager instances with syntax like: other + config. This operation will modify the original instance.
like read(), but the argument is a file object. The optional filename argument is used for printing error messages.
return the configuration as an INI formatted string; this also includes options that were set from Python code.
return the configuration as an INI formatted string; however, do not include options that were set from Python code.
return the configuration as an INI formatted string. The source option indicates which source of information should be included in the resulting INI file. The possible values are:
Name |
Description |
COMMANDLINE |
set from a command-line option |
CONFIGFILE |
set from a configuration file |
BUILTIN |
set from Python code |
ENVIRONMENT |
set from an environment variable |