This commit is contained in:
lda
2026-08-30 10:25:26 +07:00 Verified
parent ad716bfb7f
commit 85adbcf37d
3 changed files with 7 additions and 9 deletions
+1 -1
View File
@@ -21,8 +21,8 @@ from .models import (
) )
from .shell import ( from .shell import (
Shell, Shell,
isolate_output_history,
carefully_setup_shell, carefully_setup_shell,
isolate_output_history,
run_cell_and_collect, run_cell_and_collect,
setup_shell, setup_shell,
) )
+5 -7
View File
@@ -252,9 +252,7 @@ def carefully_setup_shell(
if execution_magics.default_runner is None: if execution_magics.default_runner is None:
execution_magics.default_runner = mpl_runner(shell.safe_execfile) execution_magics.default_runner = mpl_runner(shell.safe_execfile)
clobbered = ( clobbered = enable_pylab_lite(shell, import_all=import_all) if pylab else []
enable_pylab_lite(shell, import_all=import_all) if pylab else []
)
return selected_gui, backend, clobbered return selected_gui, backend, clobbered
@@ -265,7 +263,9 @@ def inline_support_present(shell: InteractiveShell, backend: str) -> bool:
"inline", "inline",
"module://matplotlib_inline.backend_inline", "module://matplotlib_inline.backend_inline",
} }
return (flush_figures in callbacks) if is_inline else (flush_figures not in callbacks) return (
(flush_figures in callbacks) if is_inline else (flush_figures not in callbacks)
)
def figure_formats_for(shell: InteractiveShell) -> set[str]: def figure_formats_for(shell: InteractiveShell) -> set[str]:
@@ -297,9 +297,7 @@ def enable_pylab_lite(
ignored = {"__builtins__"} ignored = {"__builtins__"}
candidates = set(pylab_ns).intersection(shell.user_ns).difference(ignored) candidates = set(pylab_ns).intersection(shell.user_ns).difference(ignored)
clobbered = [ clobbered = [
name name for name in candidates if shell.user_ns[name] is not pylab_ns[name]
for name in candidates
if shell.user_ns[name] is not pylab_ns[name]
] ]
shell.user_ns.update(pylab_ns) shell.user_ns.update(pylab_ns)
+1 -1
View File
@@ -2,8 +2,8 @@ import unittest
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from ipython_shell import App, AppInfo
from ipython_mcp.app import app as mcp_app from ipython_mcp.app import app as mcp_app
from ipython_shell import App, AppInfo
from ipython_webapp.app import app as web_app from ipython_webapp.app import app as web_app
from langchain_demo.ipython_wrapper import get_app_info from langchain_demo.ipython_wrapper import get_app_info