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