MCPcopy Index your code
hub / github.com/bpython/bpython / run_code_and_maybe_finish

Method run_code_and_maybe_finish

bpython/curtsiesfrontend/repl.py:1296–1315  ·  view source on GitHub ↗
(self, for_code=None)

Source from the content-addressed store, hash-verified

1294 return not code_will_parse
1295
1296 def run_code_and_maybe_finish(self, for_code=None):
1297 r = self.coderunner.run_code(for_code=for_code)
1298 if r:
1299 logger.debug("----- Running finish command stuff -----")
1300 logger.debug("saved_indent: %r", self.saved_indent)
1301 err = self.saved_predicted_parse_error
1302 self.saved_predicted_parse_error = False
1303
1304 indent = self.saved_indent
1305 if err:
1306 indent = 0
1307
1308 if self.rl_history.index == 0:
1309 self._set_current_line(" " * indent, update_completion=True)
1310 else:
1311 self._set_current_line(
1312 self.rl_history.entries[-self.rl_history.index],
1313 reset_rl_history=False,
1314 )
1315 self.cursor_offset = len(self.current_line)
1316
1317 def keyboard_interrupt(self):
1318 # TODO factor out the common cleanup from running a line

Callers 3

process_control_eventMethod · 0.95
pushMethod · 0.95
process_eventMethod · 0.80

Calls 2

_set_current_lineMethod · 0.95
run_codeMethod · 0.80

Tested by

no test coverage detected