MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / _arg_swap

Function _arg_swap

cmd2/decorators.py:97–108  ·  view source on GitHub ↗

Swap the Statement parameter with one or more decorator-specific parameters. :param args: The original positional arguments :param search_arg: The argument to search for (usually the Statement) :param replace_arg: The arguments to substitute in :return: The new set of arguments to p

(args: Sequence[Any], search_arg: Any, *replace_arg: Any)

Source from the content-addressed store, hash-verified

95
96
97def _arg_swap(args: Sequence[Any], search_arg: Any, *replace_arg: Any) -> list[Any]:
98 """Swap the Statement parameter with one or more decorator-specific parameters.
99
100 :param args: The original positional arguments
101 :param search_arg: The argument to search for (usually the Statement)
102 :param replace_arg: The arguments to substitute in
103 :return: The new set of arguments to pass to the command function
104 """
105 index = args.index(search_arg)
106 args_list = list(args)
107 args_list[index : index + 1] = replace_arg
108 return args_list
109
110
111# The standard cmd2 command function signature (e.g. do_command(self, statement))

Callers 1

cmd_wrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…