pimlico.core.modules.options module

Utilities and type processors for module options.

exception pimlico.core.modules.options.ModuleOptionParseError[source]

Bases: exceptions.Exception

pimlico.core.modules.options.choose_from_list(options, name=None)[source]

Utility for option processors to limit the valid values to a list of possibilities.

pimlico.core.modules.options.comma_separated_list(item_type=<type 'str'>)[source]

Option processor type that accepts comma-separated lists of strings. Each value is then parsed according to the given item_type (default: string).

pimlico.core.modules.options.comma_separated_strings(string)
pimlico.core.modules.options.format_option_type(t)[source]
pimlico.core.modules.options.opt_type_help(help_text)[source]

Decorator to add help text to functions that are designed to be used as module option processors. The help text will be used to describe the type in documentation.

pimlico.core.modules.options.process_module_options(opt_def, opt_dict, module_type_name)[source]

Utility for processing runtime module options. Called from module base class.

Parameters:
  • opt_def – dictionary defining available options
  • opt_dict – dictionary of option values
  • module_type_name – name for error output
Returns:

dictionary of processed options

pimlico.core.modules.options.str_to_bool(string)[source]

Convert a string value to a boolean in a sensible way. Suitable for specifying booleans as options.

Parameters:string – input string
Returns:boolean value