MCPcopy Create free account
hub / github.com/ipython/ipython / init_code

Method init_code

IPython/core/shellapp.py:288–305  ·  view source on GitHub ↗

run the pre-flight code, specified via exec_lines

(self)

Source from the content-addressed store, hash-verified

286 self.log.warning("Unknown error in loading extensions:", exc_info=True)
287
288 def init_code(self):
289 """run the pre-flight code, specified via exec_lines"""
290 self._run_startup_files()
291 self._run_exec_lines()
292 self._run_exec_files()
293
294 # Hide variables defined here from %who etc.
295 if self.hide_initial_ns:
296 self.shell.user_ns_hidden.update(self.shell.user_ns)
297
298 # command-line execution (ipython -i script.py, ipython -m module)
299 # should *not* be excluded from %whos
300 self._run_cmd_line_code()
301 self._run_module()
302
303 # flush output, so itwon't be attached to the first cell
304 sys.stdout.flush()
305 sys.stderr.flush()
306
307 def _run_exec_lines(self):
308 """Run lines of code in IPythonApp.exec_lines in the user's namespace."""

Callers 1

initializeMethod · 0.80

Calls 7

_run_startup_filesMethod · 0.95
_run_exec_linesMethod · 0.95
_run_exec_filesMethod · 0.95
_run_cmd_line_codeMethod · 0.95
_run_moduleMethod · 0.95
updateMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected