MCPcopy Index your code
hub / github.com/RustPython/RustPython / do_cmd

Method do_cmd

Lib/_pyrepl/reader.py:696–725  ·  view source on GitHub ↗

`cmd` is a tuple of "event_name" and "event", which in the current implementation is always just the "buffer" which happens to be a list of single-character strings.

(self, cmd: tuple[str, list[str]])

Source from the content-addressed store, hash-verified

694 self.dirty = False
695
696 def do_cmd(self, cmd: tuple[str, list[str]]) -> None:
697 """`cmd` is a tuple of "event_name" and "event", which in the current
698 implementation is always just the "buffer" which happens to be a list
699 of single-character strings."""
700
701 trace("received command {cmd}", cmd=cmd)
702 if isinstance(cmd[0], str):
703 command_type = self.commands.get(cmd[0], commands.invalid_command)
704 elif isinstance(cmd[0], type):
705 command_type = cmd[0]
706 else:
707 return # nothing to do
708
709 command = command_type(self, *cmd) # type: ignore[arg-type]
710 command.do()
711
712 self.after_command(command)
713
714 if self.dirty:
715 self.refresh()
716 else:
717 self.update_cursor()
718
719 if not isinstance(cmd, commands.digit_arg):
720 self.last_command = command_type
721
722 self.finished = bool(command.finish)
723 if self.finished:
724 self.console.finish()
725 self.finish()
726
727 def run_hooks(self) -> None:
728 threading_hook = self.threading_hook

Callers 3

prepareMethod · 0.95
handle1Method · 0.95

Calls 8

after_commandMethod · 0.95
refreshMethod · 0.95
update_cursorMethod · 0.95
finishMethod · 0.95
traceFunction · 0.90
isinstanceFunction · 0.85
getMethod · 0.45
doMethod · 0.45

Tested by

no test coverage detected