Show More
@@ -884,6 +884,13 b' class HistoryMagics(Magics):' | |||
|
884 | 884 | if close_at_end: |
|
885 | 885 | outfile.close() |
|
886 | 886 | |
|
887 | # For a long time we've had %hist as well as %history | |
|
888 | @line_magic | |
|
889 | def hist(self, arg): | |
|
890 | return self.history(arg) | |
|
891 | ||
|
892 | hist.__doc__ = history.__doc__ | |
|
893 | ||
|
887 | 894 | @line_magic |
|
888 | 895 | def rep(self, arg): |
|
889 | 896 | r"""Repeat a command, or get command to input line for editing. |
@@ -199,9 +199,7 b' class MagicsManager(Configurable):' | |||
|
199 | 199 | validate_type(magic_type) |
|
200 | 200 | magic_name = func.func_name if magic_name is None else magic_name |
|
201 | 201 | setattr(self.user_magics, magic_name, func) |
|
202 |
|
|
|
203 | _record_magic(self.magics, magic_type, name, newm) | |
|
204 | ||
|
202 | _record_magic(self.magics, magic_type, magic_name, func) | |
|
205 | 203 | |
|
206 | 204 | def _define_magic(self, name, func): |
|
207 | 205 | """Support for deprecated API. |
@@ -320,8 +320,8 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
320 | 320 | @line_magic |
|
321 | 321 | def quickref(self,arg): |
|
322 | 322 | """ Show a quick reference sheet """ |
|
323 |
|
|
|
324 |
qr = |
|
|
323 | from IPython.core.usage import quick_reference | |
|
324 | qr = quick_reference + self.magic('-brief') | |
|
325 | 325 | page.page(qr) |
|
326 | 326 | |
|
327 | 327 | @line_magic |
@@ -522,7 +522,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
522 | 522 | "foo.ipynb" to "foo.json" do "%notebook -f json foo.ipynb". Possible |
|
523 | 523 | formats include (json/ipynb, py). |
|
524 | 524 | """ |
|
525 |
args = magic_arguments.parse_argstring(self. |
|
|
525 | args = magic_arguments.parse_argstring(self.notebook, s) | |
|
526 | 526 | |
|
527 | 527 | from IPython.nbformat import current |
|
528 | 528 | args.filename = unquote_filename(args.filename) |
@@ -1408,7 +1408,7 b' class NamespaceMagics(Magics):' | |||
|
1408 | 1408 | beta |
|
1409 | 1409 | """ |
|
1410 | 1410 | |
|
1411 |
varlist = self. |
|
|
1411 | varlist = self.who_ls(parameter_s) | |
|
1412 | 1412 | if not varlist: |
|
1413 | 1413 | if parameter_s: |
|
1414 | 1414 | print 'No variables match your requested type.' |
@@ -1459,7 +1459,7 b' class NamespaceMagics(Magics):' | |||
|
1459 | 1459 | beta str test |
|
1460 | 1460 | """ |
|
1461 | 1461 | |
|
1462 |
varnames = self. |
|
|
1462 | varnames = self.who_ls(parameter_s) | |
|
1463 | 1463 | if not varnames: |
|
1464 | 1464 | if parameter_s: |
|
1465 | 1465 | print 'No variables match your requested type.' |
@@ -16,6 +16,8 b' from StringIO import StringIO' | |||
|
16 | 16 | |
|
17 | 17 | import nose.tools as nt |
|
18 | 18 | |
|
19 | from IPython.core import magic | |
|
20 | from IPython.core import magic_functions as mf | |
|
19 | 21 | from IPython.nbformat.v3.tests.nbexamples import nb0 |
|
20 | 22 | from IPython.nbformat import current |
|
21 | 23 | from IPython.testing import decorators as dec |
@@ -51,7 +53,8 b' def test_magic_parse_options():' | |||
|
51 | 53 | """Test that we don't mangle paths when parsing magic options.""" |
|
52 | 54 | ip = get_ipython() |
|
53 | 55 | path = 'c:\\x' |
|
54 | opts = ip._magic.parse_options('-f %s' % path,'f:')[0] | |
|
56 | m = magic.Magics(ip) | |
|
57 | opts = m.parse_options('-f %s' % path,'f:')[0] | |
|
55 | 58 | # argv splitting is os-dependent |
|
56 | 59 | if os.name == 'posix': |
|
57 | 60 | expected = 'c:x' |
@@ -284,8 +287,9 b' def test_parse_options():' | |||
|
284 | 287 | """Tests for basic options parsing in magics.""" |
|
285 | 288 | # These are only the most minimal of tests, more should be added later. At |
|
286 | 289 | # the very least we check that basic text/unicode calls work OK. |
|
287 | nt.assert_equal(_ip._magic.parse_options('foo', '')[1], 'foo') | |
|
288 |
nt.assert_equal( |
|
|
290 | m = magic.Magics(ip) | |
|
291 | nt.assert_equal(m.parse_options('foo', '')[1], 'foo') | |
|
292 | nt.assert_equal(m.parse_options(u'foo', '')[1], u'foo') | |
|
289 | 293 | |
|
290 | 294 | |
|
291 | 295 | def test_dirops(): |
@@ -422,7 +426,8 b' def test_timeit_arguments():' | |||
|
422 | 426 | "Test valid timeit arguments, should not cause SyntaxError (GH #1269)" |
|
423 | 427 | _ip.magic("timeit ('#')") |
|
424 | 428 | |
|
425 | @dec.skipif(_ip._magic.magic_prun == _ip._magic.profile_missing_notice) | |
|
429 | ||
|
430 | @dec.skipif(mf.profile is None) | |
|
426 | 431 | def test_prun_quotes(): |
|
427 | 432 | "Test that prun does not clobber string escapes (GH #1302)" |
|
428 | 433 | _ip.magic("prun -q x = '\t'") |
@@ -79,7 +79,7 b' def test_issue_114():' | |||
|
79 | 79 | msp = ip.prefilter_manager.multi_line_specials |
|
80 | 80 | ip.prefilter_manager.multi_line_specials = False |
|
81 | 81 | try: |
|
82 |
for mgk in ip. |
|
|
82 | for mgk in ip.magics_manager.lsmagic()['line']: | |
|
83 | 83 | raw = template % mgk |
|
84 | 84 | yield nt.assert_equals(ip.prefilter(raw), raw) |
|
85 | 85 | finally: |
General Comments 0
You need to be logged in to leave comments.
Login now