MCPcopy
hub / github.com/prompt-toolkit/ptpython / embed

Function embed

src/ptpython/ipython.py:308–323  ·  view source on GitHub ↗

Copied from `IPython/terminal/embed.py`, but using our `InteractiveShellEmbed` instead.

(**kwargs)

Source from the content-addressed store, hash-verified

306
307
308def embed(**kwargs):
309 """
310 Copied from `IPython/terminal/embed.py`, but using our `InteractiveShellEmbed` instead.
311 """
312 config = kwargs.get("config")
313 header = kwargs.pop("header", "")
314 compile_flags = kwargs.pop("compile_flags", None)
315 if config is None:
316 config = load_default_config()
317 config.InteractiveShellEmbed = config.TerminalInteractiveShell
318 kwargs["config"] = config
319 shell = InteractiveShellEmbed.instance(**kwargs)
320 initialize_extensions(shell, config["InteractiveShellApp"]["extensions"])
321 run_exec_lines(shell, config["InteractiveShellApp"]["exec_lines"])
322 run_startup_scripts(shell)
323 shell(header=header, stack_depth=2, compile_flags=compile_flags)
324
325
326def run_startup_scripts(shell):

Callers 1

runFunction · 0.90

Calls 3

initialize_extensionsFunction · 0.85
run_exec_linesFunction · 0.85
run_startup_scriptsFunction · 0.85

Tested by

no test coverage detected