pimlico.core.modules.options module

Utilities and type processors for module 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.

format_option_type(t)[source]
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
choose_from_list(options, name=None)[source]

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

comma_separated_list(item_type=<type 'str'>, length=None)[source]

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

comma_separated_strings(string)
json_string(string)[source]
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

exception ModuleOptionParseError[source]

Bases: exceptions.Exception