diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index e8f4aee..c4196a3 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -2224,52 +2224,6 @@ class InteractiveShell(Configurable, Magic): return False - - # PENDING REMOVAL: this method is slated for deletion, once our new - # input logic has been 100% moved to frontends and is stable. - def runlines(self, lines, clean=False): - """Run a string of one or more lines of source. - - This method is capable of running a string containing multiple source - lines, as if they had been entered at the IPython prompt. Since it - exposes IPython's processing machinery, the given strings can contain - magic calls (%magic), special shell access (!cmd), etc. - """ - - if not isinstance(lines, (list, tuple)): - lines = lines.splitlines() - - if clean: - lines = self._cleanup_ipy_script(lines) - - # We must start with a clean buffer, in case this is run from an - # interactive IPython session (via a magic, for example). - self.reset_buffer() - - # Since we will prefilter all lines, store the user's raw input too - # before we apply any transformations - self.buffer_raw[:] = [ l+'\n' for l in lines] - - more = False - prefilter_lines = self.prefilter_manager.prefilter_lines - with nested(self.builtin_trap, self.display_trap): - for line in lines: - # skip blank lines so we don't mess up the prompt counter, but - # do NOT skip even a blank line if we are in a code block (more - # is true) - - if line or more: - more = self.push_line(prefilter_lines(line, more)) - # IPython's run_source returns None if there was an error - # compiling the code. This allows us to stop processing - # right away, so the user gets the error message at the - # right place. - if more is None: - break - # final newline in case the input didn't have it, so that the code - # actually does get executed - if more: - self.push_line('\n') def run_source(self, source, filename=None, symbol='single'): """Compile and run some source in the interpreter. diff --git a/IPython/core/tests/test_iplib.py b/IPython/core/tests/test_iplib.py index 0f290ee..cb91ab2 100644 --- a/IPython/core/tests/test_iplib.py +++ b/IPython/core/tests/test_iplib.py @@ -237,10 +237,10 @@ SystemExit: (2, u'Mode = exit') """ -def test_runlines(): +def test_run_cell(): import textwrap - ip.runlines(['a = 10', 'a+=1']) - ip.runlines('assert a == 11\nassert 1') + ip.run_cell('a = 10\na+=1') + ip.run_cell('assert a == 11\nassert 1') nt.assert_equals(ip.user_ns['a'], 11) complex = textwrap.dedent(""" @@ -260,7 +260,7 @@ def test_runlines(): """) # Simply verifies that this kind of input is run - ip.runlines(complex) + ip.run_cell(complex) def test_db(): diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index 16be332..159a2f1 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -151,7 +151,7 @@ class TestMagicRunSimple(tt.TempFileMixin): "def f(): return foo()") self.mktmp(src) _ip.magic('run %s' % self.fname) - _ip.runlines('t = isinstance(f(), foo)') + _ip.run_cell('t = isinstance(f(), foo)') nt.assert_true(_ip.user_ns['t']) # We have to skip these in win32 because getoutputerr() crashes, @@ -188,7 +188,7 @@ class TestMagicRunSimple(tt.TempFileMixin): " print i;break\n" % empty.fname) self.mktmp(src) _ip.magic('run %s' % self.fname) - _ip.runlines('ip == get_ipython()') + _ip.run_cell('ip == get_ipython()') tt.assert_equals(_ip.user_ns['i'], 5) @dec.skip_win32 diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 9e0d781..95e676b 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -241,7 +241,7 @@ class Kernel(Configurable): except: status = u'error' # FIXME: this code right now isn't being used yet by default, - # because the runlines() call above directly fires off exception + # because the run_cell() call above directly fires off exception # reporting. This code, therefore, is only active in the scenario # where runlines itself has an unhandled exception. We need to # uniformize this, for all exception construction to come from a