MCPcopy Index your code
hub / github.com/python/cpython / do_cmd

Method do_cmd

Lib/_pyrepl/reader.py:659–688  ·  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

657 self.dirty = False
658
659 def do_cmd(self, cmd: tuple[str, list[str]]) -> None:
660 """`cmd` is a tuple of "event_name" and "event", which in the current
661 implementation is always just the "buffer" which happens to be a list
662 of single-character strings."""
663
664 trace("received command {cmd}", cmd=cmd)
665 if isinstance(cmd[0], str):
666 command_type = self.commands.get(cmd[0], commands.invalid_command)
667 elif isinstance(cmd[0], type):
668 command_type = cmd[0]
669 else:
670 return # nothing to do
671
672 command = command_type(self, *cmd) # type: ignore[arg-type]
673 command.do()
674
675 self.after_command(command)
676
677 if self.dirty:
678 self.refresh()
679 else:
680 self.update_cursor()
681
682 if not isinstance(cmd, commands.digit_arg):
683 self.last_command = command_type
684
685 self.finished = bool(command.finish)
686 if self.finished:
687 self.console.finish()
688 self.finish()
689
690 def run_hooks(self) -> None:
691 threading_hook = self.threading_hook

Callers 3

prepareMethod · 0.95
handle1Method · 0.95

Calls 7

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

Tested by

no test coverage detected