Merge pull request #2022 from the-rectifier/ipython_9

Import `IPython.terminal` submodules explicitly in Volshell
This commit is contained in:
ikelos
2026-09-09 08:40:18 +01:00
committed by GitHub
+5 -4
View File
@@ -25,7 +25,8 @@ except ImportError:
has_capstone = False
try:
from IPython import terminal
from IPython.terminal import embed, prompts
from traitlets import config as traitlets_config
has_ipython = True
@@ -135,16 +136,16 @@ class Volshell(interfaces.plugins.PluginInterface):
combined_locals.update(self._construct_locals_dict())
if has_ipython:
class LayerNamePrompt(terminal.prompts.Prompts):
class LayerNamePrompt(prompts.Prompts):
def in_prompt_tokens(self, cli=None):
slf = self.shell.user_ns.get("self")
layer_name = slf.current_layer if slf else "no_layer"
return [(terminal.prompts.Token.Prompt, f"[{layer_name}]> ")]
return [(prompts.Token.Prompt, f"[{layer_name}]> ")]
c = traitlets_config.Config()
c.TerminalInteractiveShell.prompts_class = LayerNamePrompt
c.InteractiveShellEmbed.banner2 = banner
self.__console = terminal.embed.InteractiveShellEmbed(
self.__console = embed.InteractiveShellEmbed(
config=c, user_ns=combined_locals
)
else: