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

Function maybe_run_command

Lib/_pyrepl/simple_interact.py:118–131  ·  view source on GitHub ↗
(statement: str)

Source from the content-addressed store, hash-verified

116 input_n = 0
117
118 def maybe_run_command(statement: str) -> bool:
119 statement = statement.strip()
120 if statement in console.locals or statement not in REPL_COMMANDS:
121 return False
122
123 reader = _get_reader()
124 reader.history.pop() # skip internal commands in history
125 command = REPL_COMMANDS[statement]
126 if callable(command):
127 # Make sure that history does not change because of commands
128 with reader.suspend_history():
129 command()
130 return True
131 return False
132
133 while 1:
134 try:

Callers 1

Calls 5

callableFunction · 0.85
commandFunction · 0.85
suspend_historyMethod · 0.80
stripMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected