MCPcopy Index your code
hub / github.com/ipython/ipython / init_code

Method init_code

IPython/core/shellapp.py:346–364  ·  view source on GitHub ↗

run the pre-flight code, specified via exec_lines

(self)

Source from the content-addressed store, hash-verified

344 self.log.warning("Unknown error in loading extensions:", exc_info=True)
345
346 def init_code(self):
347 """run the pre-flight code, specified via exec_lines"""
348 self._run_startup_files()
349 self._run_exec_lines()
350 self._run_exec_files()
351
352 # Hide variables defined here from %who etc.
353 if self.hide_initial_ns:
354 self.shell.user_ns_hidden.update(self.shell.user_ns)
355
356 # command-line execution (ipython -i script.py, ipython -m module)
357 # should *not* be excluded from %whos
358 self._run_cmd_line_code()
359 self._run_module()
360
361 # flush output, so itwon't be attached to the first cell
362 sys.stdout.flush()
363 sys.stderr.flush()
364 self.shell._sys_modules_keys = set(sys.modules.keys())
365
366 def _run_exec_lines(self):
367 """Run lines of code in IPythonApp.exec_lines in the user's namespace."""

Callers 1

initializeMethod · 0.80

Calls 8

_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
keysMethod · 0.80
updateMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected