Show More
@@ -727,6 +727,7 b' Currently the magic system has the following functions:\\n"""' | |||
|
727 | 727 | except: |
|
728 | 728 | shell.showtraceback() |
|
729 | 729 | |
|
730 | @testdec.skip_doctest | |
|
730 | 731 | def magic_who_ls(self, parameter_s=''): |
|
731 | 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 | 763 | typelist = parameter_s.split() |
|
763 | 764 | if typelist: |
|
764 | 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 | 768 | out.sort() |
|
768 | 769 | return out |
|
769 | 770 | |
|
771 | @testdec.skip_doctest | |
|
770 | 772 | def magic_who(self, parameter_s=''): |
|
771 | 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 | 833 | def magic_whos(self, parameter_s=''): |
|
831 | 834 | """Like %who, but gives some extra information about each variable. |
|
832 | 835 |
@@ -362,3 +362,28 b' def test_xmode():' | |||
|
362 | 362 | for i in range(3): |
|
363 | 363 | _ip.magic("xmode") |
|
364 | 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