Show More
@@ -727,6 +727,7 b' Currently the magic system has the following functions:\\n"""' | |||||
727 | except: |
|
727 | except: | |
728 | shell.showtraceback() |
|
728 | shell.showtraceback() | |
729 |
|
729 | |||
|
730 | @testdec.skip_doctest | |||
730 | def magic_who_ls(self, parameter_s=''): |
|
731 | def magic_who_ls(self, parameter_s=''): | |
731 | """Return a sorted list of all interactive variables. |
|
732 | """Return a sorted list of all interactive variables. | |
732 |
|
733 | |||
@@ -762,11 +763,12 b' Currently the magic system has the following functions:\\n"""' | |||||
762 | typelist = parameter_s.split() |
|
763 | typelist = parameter_s.split() | |
763 | if typelist: |
|
764 | if typelist: | |
764 | typeset = set(typelist) |
|
765 | typeset = set(typelist) | |
765 | out = [i for i in out if type(i).__name__ in typeset] |
|
766 | out = [i for i in out if type(user_ns[i]).__name__ in typeset] | |
766 |
|
767 | |||
767 | out.sort() |
|
768 | out.sort() | |
768 | return out |
|
769 | return out | |
769 |
|
770 | |||
|
771 | @testdec.skip_doctest | |||
770 | def magic_who(self, parameter_s=''): |
|
772 | def magic_who(self, parameter_s=''): | |
771 | """Print all interactive variables, with some minimal formatting. |
|
773 | """Print all interactive variables, with some minimal formatting. | |
772 |
|
774 | |||
@@ -827,6 +829,7 b' Currently the magic system has the following functions:\\n"""' | |||||
827 |
|
829 | |||
828 |
|
830 | |||
829 |
|
831 | |||
|
832 | @testdec.skip_doctest | |||
830 | def magic_whos(self, parameter_s=''): |
|
833 | def magic_whos(self, parameter_s=''): | |
831 | """Like %who, but gives some extra information about each variable. |
|
834 | """Like %who, but gives some extra information about each variable. | |
832 |
|
835 |
@@ -362,3 +362,28 b' def test_xmode():' | |||||
362 | for i in range(3): |
|
362 | for i in range(3): | |
363 | _ip.magic("xmode") |
|
363 | _ip.magic("xmode") | |
364 | nt.assert_equal(_ip.InteractiveTB.mode, xmode) |
|
364 | nt.assert_equal(_ip.InteractiveTB.mode, xmode) | |
|
365 | ||||
|
366 | def doctest_who(): | |||
|
367 | """doctest for %who | |||
|
368 | ||||
|
369 | In [1]: %reset -f | |||
|
370 | ||||
|
371 | In [2]: alpha = 123 | |||
|
372 | ||||
|
373 | In [3]: beta = 'beta' | |||
|
374 | ||||
|
375 | In [4]: %who int | |||
|
376 | alpha | |||
|
377 | ||||
|
378 | In [5]: %who str | |||
|
379 | beta | |||
|
380 | ||||
|
381 | In [6]: %whos | |||
|
382 | Variable Type Data/Info | |||
|
383 | ---------------------------- | |||
|
384 | alpha int 123 | |||
|
385 | beta str beta | |||
|
386 | ||||
|
387 | In [7]: %who_ls | |||
|
388 | Out[7]: ['alpha', 'beta'] | |||
|
389 | """ No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now