Show More
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | |
|
4 |
$Id: Magic.py 117 |
|
|
4 | $Id: Magic.py 1178 2006-02-24 17:26:36Z vivainio $""" | |
|
5 | 5 | |
|
6 | 6 | #***************************************************************************** |
|
7 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -365,6 +365,8 b' license. To use profiling, please install"python2.3-profiler" from non-free.""")' | |||
|
365 | 365 | try: |
|
366 | 366 | if parameter_s.split()[0] == '-latex': |
|
367 | 367 | mode = 'latex' |
|
368 | if parameter_s.split()[0] == '-brief': | |
|
369 | mode = 'brief' | |
|
368 | 370 | except: |
|
369 | 371 | pass |
|
370 | 372 | |
@@ -378,8 +380,14 b' license. To use profiling, please install"python2.3-profiler" from non-free.""")' | |||
|
378 | 380 | pass |
|
379 | 381 | else: |
|
380 | 382 | break |
|
383 | if mode == 'brief': | |
|
384 | # only first line | |
|
385 | fndoc = fn.__doc__.split('\n',1)[0] | |
|
386 | else: | |
|
387 | fndoc = fn.__doc__ | |
|
388 | ||
|
381 | 389 | magic_docs.append('%s%s:\n\t%s\n' %(self.shell.ESC_MAGIC, |
|
382 |
fname,fn |
|
|
390 | fname,fndoc)) | |
|
383 | 391 | magic_docs = ''.join(magic_docs) |
|
384 | 392 | |
|
385 | 393 | if mode == 'latex': |
@@ -387,6 +395,8 b' license. To use profiling, please install"python2.3-profiler" from non-free.""")' | |||
|
387 | 395 | return |
|
388 | 396 | else: |
|
389 | 397 | magic_docs = self.format_screen(magic_docs) |
|
398 | if mode == 'brief': | |
|
399 | return magic_docs | |
|
390 | 400 | |
|
391 | 401 | outmsg = """ |
|
392 | 402 | IPython's 'magic' functions |
@@ -2758,8 +2768,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2758 | 2768 | screen_lines=self.shell.rc.screen_length) |
|
2759 | 2769 | |
|
2760 | 2770 | def magic_cpaste(self, parameter_s=''): |
|
2761 | """Allows you to paste & execute a pre-formatted code block from | |
|
2762 | clipboard. | |
|
2771 | """Allows you to paste & execute a pre-formatted code block from clipboard | |
|
2763 | 2772 | |
|
2764 | 2773 | You must terminate the block with '--' (two minus-signs) alone on the |
|
2765 | 2774 | line. You can also provide your own sentinel with '%paste -s %%' ('%%' |
@@ -2800,10 +2809,13 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2800 | 2809 | else: |
|
2801 | 2810 | self.user_ns[par] = block |
|
2802 | 2811 | print "Block assigned to '%s'" % par |
|
2812 | ||
|
2803 | 2813 | def magic_quickref(self,arg): |
|
2804 | 2814 | """ Show a quick reference sheet """ |
|
2805 | 2815 | import IPython.usage |
|
2806 |
|
|
|
2816 | qr = IPython.usage.quick_reference + self.magic_magic('-brief') | |
|
2817 | ||
|
2818 | page(qr) | |
|
2807 | 2819 | |
|
2808 | 2820 | def magic_upgrade(self,arg): |
|
2809 | 2821 | """ Upgrade your IPython installation |
General Comments 0
You need to be logged in to leave comments.
Login now