diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index ac1c585..8dd9329 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -334,15 +334,18 @@ class InteractiveShell(SingletonConfigurable): filename = Unicode("") ipython_dir= Unicode('').tag(config=True) # Set to get_ipython_dir() in __init__ - # Input splitter, to transform input line by line and detect when a block - # is ready to be executed. - input_splitter = Instance('IPython.core.inputsplitter.IPythonInputSplitter', - (), {'line_input_checker': True}) - - # Used to transform cells before running them. + # Used to transform cells before running them, and check whether code is complete input_transformer_manager = Instance('IPython.core.inputtransformer2.TransformerManager', ()) + @property + def input_splitter(self): + """Make this available for compatibility + + ipykernel currently uses shell.input_splitter.check_complete + """ + return self.input_transformer_manager + logstart = Bool(False, help= """ Start logging to the default log file in overwrite mode. diff --git a/IPython/core/tests/test_inputtransformer2.py b/IPython/core/tests/test_inputtransformer2.py index 5068760..0970f16 100644 --- a/IPython/core/tests/test_inputtransformer2.py +++ b/IPython/core/tests/test_inputtransformer2.py @@ -179,10 +179,11 @@ def test_transform_help(): nt.assert_equal(tf.transform(HELP_MULTILINE[0]), HELP_MULTILINE[2]) def test_check_complete(): - tm = ipt2.TransformerManager() - nt.assert_equal(tm.check_complete("a = 1"), ('complete', None)) - nt.assert_equal(tm.check_complete("for a in range(5):"), ('incomplete', 4)) - nt.assert_equal(tm.check_complete("raise = 2"), ('invalid', None)) - nt.assert_equal(tm.check_complete("a = [1,\n2,"), ('incomplete', 0)) - nt.assert_equal(tm.check_complete("a = '''\n hi"), ('incomplete', 3)) - nt.assert_equal(tm.check_complete("def a():\n x=1\n global x"), ('invalid', None)) + cc = ipt2.TransformerManager().check_complete + nt.assert_equal(cc("a = 1"), ('complete', None)) + nt.assert_equal(cc("for a in range(5):"), ('incomplete', 4)) + nt.assert_equal(cc("raise = 2"), ('invalid', None)) + nt.assert_equal(cc("a = [1,\n2,"), ('incomplete', 0)) + nt.assert_equal(cc("a = '''\n hi"), ('incomplete', 3)) + nt.assert_equal(cc("def a():\n x=1\n global x"), ('invalid', None)) + nt.assert_equal(cc("a \\ "), ('invalid', None)) # Nothing allowed after backslash