neuralib.argp.dispatch.DispatchOption
- class neuralib.argp.dispatch.DispatchOption[source]
Bases:
object- __init__()
Methods
__init__()dispatch(command[, alias, group])find_command(command[, group])find dispatch-decoratored function in host according to command.
invoke_command(command, *args, **kwargs)invoke a dispatch-decoratored function in default group.
invoke_group_command(group, command, *args, ...)invoke a dispatch-decoratored function in certain group.
list_commands([group])list all dispatch-decoratored function info in host.
parser_command_epilog([group])- argument
alias of
DispatchArgument
- list_commands(group=<object object>)[source]
list all dispatch-decoratored function info in host.
- Parameters:
group (str | None) – dispatch group.
- Returns:
list of DispatchCommand
- Return type:
list[DispatchCommand]
- find_command(command, group=<object object>)[source]
find dispatch-decoratored function in host according to command.
- Parameters:
command (str) – command or command alias
group (str | None) – dispatch group
- Returns:
found DispatchCommand
- Return type:
DispatchCommand | None
- invoke_command(command, *args, **kwargs)[source]
invoke a dispatch-decoratored function in default group.
- Parameters:
command (str) – command or command alias
args – dispatch-decoratored function positional arguments
kwargs – dispatch-decoratored function keyword arguments
- Returns:
function return
- Raises:
- Return type:
Any
- invoke_group_command(group, command, *args, **kwargs)[source]
invoke a dispatch-decoratored function in certain group.
- Parameters:
group (str) – dispatch group
command (str) – command or command alias
args – dispatch-decoratored function positional arguments
kwargs – dispatch-decoratored function keyword arguments
- Returns:
function return
- Raises:
- Return type:
Any