gaps.cli.documentation.CommandDocumentation#

class CommandDocumentation(*functions, skip_params=None, is_split_spatially=False)[source]#

Bases: object

Generate documentation for a command.

Commands are typically comprised of one or more functions. This definition includes class initializers and object methods. Documentation is compiled from all input functions and used to generate CLI help docs and template configuration files.

Parameters:
  • *functions (callables) – Functions that comprise a single command for which to generate documentation. IMPORTANT The extended summary will be pulled form the first function only!

  • skip_params (set, optional) – Set of parameter names (str) to exclude from documentation. Typically this is because the user would not explicitly have to specify these. By default, None.

  • is_split_spatially (bool, optional) – Flag indicating whether or not this function is split spatially across nodes. If True, a “nodes” option is added to the execution control block of the generated documentation. By default, False.

Methods

command_help(command_name)

Generate a help string for a command.

config_help(command_name)

Generate a config help string for a command.

param_required(param)

Check whether a parameter is required for the run function

Attributes

REQUIRED_TAG

default_exec_values

Default "execution_control" config

exec_control_doc

Execution_control documentation

extended_summary

Function extended summary, without extra whitespace

hpc_parameter_help

Function parameter help, including execution control

parameter_help

Parameter help for the func

required_args

Required parameters of the input function

template_config

A template configuration file for this function

property default_exec_values#

Default “execution_control” config

Type:

dict

property exec_control_doc#

Execution_control documentation

Type:

str

property required_args#

Required parameters of the input function

Type:

set

property template_config#

A template configuration file for this function

Type:

dict

property parameter_help#

Parameter help for the func

Type:

str

property hpc_parameter_help#

Function parameter help, including execution control

Type:

str

property extended_summary#

Function extended summary, without extra whitespace

Type:

str

config_help(command_name)[source]#

Generate a config help string for a command.

Parameters:

command_name (str) – Name of command for which the config help is being generated.

Returns:

str – Help string for the config file.

command_help(command_name)[source]#

Generate a help string for a command.

Parameters:

command_name (str) – Name of command for which the help string is being generated.

Returns:

str – Help string for the command.

param_required(param)[source]#

Check whether a parameter is required for the run function

Parameters:

param (str) – Name of parameter to check.

Returns:

boolTrue if param is a required parameter of func.