MCPcopy
hub / github.com/mitmproxy/mitmproxy / execute

Method execute

mitmproxy/command.py:282–292  ·  view source on GitHub ↗

Execute a command string. May raise CommandError.

(self, cmdstr: str)

Source from the content-addressed store, hash-verified

280 return self.commands[command_name].call(args)
281
282 def execute(self, cmdstr: str) -> Any:
283 """
284 Execute a command string. May raise CommandError.
285 """
286 parts, _ = self.parse_partial(cmdstr)
287 if not parts:
288 raise exceptions.CommandError(f"Invalid command: {cmdstr!r}")
289 command_name, *args = (
290 unquote(part.value) for part in parts if part.type != mitmproxy.types.Space
291 )
292 return self.call_strings(command_name, args)
293
294 def dump(self, out=sys.stdout) -> None:
295 cmds = list(self.commands.values())

Callers 15

test_simpleFunction · 0.95
test_decoratorFunction · 0.95
test_commandFunction · 0.80
test_up_and_downMethod · 0.80
test_save_commandFunction · 0.80
completionMethod · 0.80
parseMethod · 0.80
is_validMethod · 0.80
redrawMethod · 0.80
console_choose_cmdMethod · 0.80
mouse_eventMethod · 0.80

Calls 3

parse_partialMethod · 0.95
call_stringsMethod · 0.95
unquoteFunction · 0.90

Tested by 6

test_simpleFunction · 0.76
test_decoratorFunction · 0.76
test_commandFunction · 0.64
test_up_and_downMethod · 0.64
test_save_commandFunction · 0.64