Show More
@@ -924,6 +924,7 b' def magic_rep(self, arg):' | |||
|
924 | 924 | self.set_next_input(cmd.rstrip()) |
|
925 | 925 | print("Couldn't evaluate or find in history:", arg) |
|
926 | 926 | |
|
927 | ||
|
927 | 928 | def magic_rerun(self, parameter_s=''): |
|
928 | 929 | """Re-run previous input |
|
929 | 930 | |
@@ -969,8 +970,8 b' def init_ipython(ip):' | |||
|
969 | 970 | ip.define_magic("rep", magic_rep) |
|
970 | 971 | ip.define_magic("recall", magic_rep) |
|
971 | 972 | ip.define_magic("rerun", magic_rerun) |
|
972 | ip.define_magic("hist",magic_history) # Alternative name | |
|
973 | ip.define_magic("history",magic_history) | |
|
973 | ip.define_magic("hist", magic_history) # Alternative name | |
|
974 | ip.define_magic("history", magic_history) | |
|
974 | 975 | |
|
975 | 976 | # XXX - ipy_completers are in quarantine, need to be updated to new apis |
|
976 | 977 | #import ipy_completers |
@@ -2674,7 +2674,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2674 | 2674 | make sense in all contexts, for example a terminal ipython can't |
|
2675 | 2675 | display figures inline. |
|
2676 | 2676 | """ |
|
2677 | ||
|
2677 | from IPython.core.pylabtools import mpl_runner | |
|
2678 | 2678 | # We want to prevent the loading of pylab to pollute the user's |
|
2679 | 2679 | # namespace as shown by the %who* magics, so we execute the activation |
|
2680 | 2680 | # code in an empty namespace, and we update *both* user_ns and |
@@ -2690,7 +2690,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2690 | 2690 | # Now we must activate the gui pylab wants to use, and fix %run to take |
|
2691 | 2691 | # plot updates into account |
|
2692 | 2692 | self.enable_gui(gui) |
|
2693 | self._magic.magic_run = self._pylab_magic_run | |
|
2693 | self._magic.default_runner = mpl_runner(self.safe_execfile) | |
|
2694 | 2694 | |
|
2695 | 2695 | #------------------------------------------------------------------------- |
|
2696 | 2696 | # Utilities |
@@ -49,7 +49,6 b' from IPython.core.error import StdinNotImplementedError' | |||
|
49 | 49 | from IPython.core.macro import Macro |
|
50 | 50 | from IPython.core import magic_arguments, page |
|
51 | 51 | from IPython.core.prefilter import ESC_MAGIC |
|
52 | from IPython.core.pylabtools import mpl_runner | |
|
53 | 52 | from IPython.testing.skipdoctest import skip_doctest |
|
54 | 53 | from IPython.utils import py3compat |
|
55 | 54 | from IPython.utils.encoding import DEFAULT_ENCODING |
@@ -124,6 +123,8 b' class Magic(object):' | |||
|
124 | 123 | |
|
125 | 124 | |
|
126 | 125 | configurables = None |
|
126 | ||
|
127 | default_runner = None | |
|
127 | 128 | #...................................................................... |
|
128 | 129 | # some utility functions |
|
129 | 130 | |
@@ -1796,6 +1797,8 b' Currently the magic system has the following functions:\\n"""' | |||
|
1796 | 1797 | self.shell.InteractiveTB(etype, value, tb, tb_offset=3) |
|
1797 | 1798 | else: |
|
1798 | 1799 | if runner is None: |
|
1800 | runner = self.default_runner | |
|
1801 | if runner is None: | |
|
1799 | 1802 | runner = self.shell.safe_execfile |
|
1800 | 1803 | if 't' in opts: |
|
1801 | 1804 | # timed execution |
@@ -3549,16 +3552,6 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
3549 | 3552 | "Add `--reset` to overwrite already existing config files with defaults." |
|
3550 | 3553 | ]) |
|
3551 | 3554 | |
|
3552 | # Pylab support: simple wrappers that activate pylab, load gui input | |
|
3553 | # handling and modify slightly %run | |
|
3554 | ||
|
3555 | @skip_doctest | |
|
3556 | def _pylab_magic_run(self, parameter_s=''): | |
|
3557 | Magic.magic_run(self, parameter_s, | |
|
3558 | runner=mpl_runner(self.shell.safe_execfile)) | |
|
3559 | ||
|
3560 | _pylab_magic_run.__doc__ = magic_run.__doc__ | |
|
3561 | ||
|
3562 | 3555 | @skip_doctest |
|
3563 | 3556 | def magic_pylab(self, s): |
|
3564 | 3557 | """Load numpy and matplotlib to work interactively. |
General Comments 0
You need to be logged in to leave comments.
Login now