From 48c7b3885c786fcb3f5f75404cd4cc2caa20bfe9 Mon Sep 17 00:00:00 2001 From: gpotter2 <10530980+gpotter2@users.noreply.github.com> Date: Sat, 22 Jul 2023 15:12:19 +0200 Subject: [PATCH] Fix IPython DeprecationWarning ptipython raises the following error since IPython 7: >>> IPython.core.inputsplitter is deprecated since IPython 7 in favor of `IPython.core.inputtransformer2` --- ptpython/ipython.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ptpython/ipython.py b/ptpython/ipython.py index ae85a26..ad0516a 100644 --- a/ptpython/ipython.py +++ b/ptpython/ipython.py @@ -14,7 +14,7 @@ from warnings import warn from IPython import utils as ipy_utils -from IPython.core.inputsplitter import IPythonInputSplitter +from IPython.core.inputtransformer2 import TransformerManager from IPython.terminal.embed import InteractiveShellEmbed as _InteractiveShellEmbed from IPython.terminal.ipapp import load_default_config from prompt_toolkit.completion import ( @@ -66,7 +66,7 @@ def out_prompt(self) -> AnyFormattedText: class IPythonValidator(PythonValidator): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.isp = IPythonInputSplitter() + self.isp = TransformerManager() def validate(self, document: Document) -> None: document = Document(text=self.isp.transform_cell(document.text))