The option module
The option module contains the Option class for creating a specific
configuration option, as well as the ClOption class for creating a
command line option.
The ClOption class
-
class pyamp.config.option.ClOption(name, abbr=None, defaultValue=None, action=None, optionType=None, helpText=None)[source]
The ClOption class encapsulates an Option that is configurable
through the command line as well as through a configuration file.
- name – The name of the option
- abbr – The abbreviated name
- defaultValue – The default value for this option
- action – The action used for this option
- optionType – The type of the option
- helpText – The help text to display
-
addOption(parser)[source]
Add the command line option to the command line parser.
- parser – The command line parser
The ClBoolOption class
-
class pyamp.config.option.ClBoolOption(name, abbr=None, defaultValue=False, helpText=None)[source]
The ClBoolOption encapsulates a boolean configuration option.
If the boolean does not exist, the option will be set to the default value
otherwise it will be set to the inverse of the default value.
- name – The name of the option
- abbr – The abbreviated name for the option
- defaultValue – The default value (True or False)
- helpText – The help text for this option
The Option class
-
class pyamp.config.option.Option(name, defaultValue=None, typeFn=None, commandLine=False)[source]
The Option class encapsulates a single configuration option. It contains
the name of the option, a default value for the option, as well as a
function to convert the option into a specific type.
- name – The name of the option
- defaultValue – The default value for this option
- typeFn – The function to convert the value to a specific type
- commandLine – True to be a command line option
-
convert(value)[source]
Convert the given value into the expected type for this Option.
- value – The value to convert
-
getDefaultValue()[source]
Get the default value for this Option.
-
getName()[source]
Get the name of this Option.
-
isCommandLine()[source]
Determine if this Option is configurable through the command
line.