Package prompt :: Module help
[hide private]
[frames] | no frames]

Source Code for Module prompt.help

 1  ############################################################################### 
 2  #                                                                             # 
 3  # Copyright (C) 2003, 2004 Edward d'Auvergne                                  # 
 4  #                                                                             # 
 5  # This file is part of the program relax.                                     # 
 6  #                                                                             # 
 7  # relax is free software; you can redistribute it and/or modify               # 
 8  # it under the terms of the GNU General Public License as published by        # 
 9  # the Free Software Foundation; either version 2 of the License, or           # 
10  # (at your option) any later version.                                         # 
11  #                                                                             # 
12  # relax is distributed in the hope that it will be useful,                    # 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of              # 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               # 
15  # GNU General Public License for more details.                                # 
16  #                                                                             # 
17  # You should have received a copy of the GNU General Public License           # 
18  # along with relax; if not, write to the Free Software                        # 
19  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   # 
20  #                                                                             # 
21  ############################################################################### 
22   
23  import pydoc 
24  import sys 
25   
26   
27  # Generic string printed out for function classes. 
28  ################################################## 
29   
30  relax_class_help = """ 
31  This is a python class which contains user functions.  To list these functions, either place a 
32  period at the end of class name and hit the tab key, or type 'dir(class_name)'. 
33  """ 
34   
35   
36  # Helper classes. 
37  ################# 
38   
39 -class _Helper:
40 text = """\ 41 For assistance in using a function, simply type 'help(function)'. All functions can be viewed by 42 hitting the [TAB] key. In addition to functions, if 'help(object)' is typed, the help for the 43 python object is returned. This system is similar to the help function built into the python 44 interpreter, which has been renamed to help_python, with the interactive component removed. For the 45 interactive python help system, type 'help_python()'. 46 """ 47
48 - def __repr__(self):
49 return self.text
50
51 - def __call__(self, *args, **kwds):
52 if len(args) != 1 or type(args[0]) == str: 53 print self.text 54 return 55 if hasattr(args[0], '__relax_help__'): 56 sys.stdout.write(args[0].__relax_help__ + "\n") 57 return 58 return pydoc.help(*args, **kwds)
59 60
61 -class _Helper_python:
62 text = """\ 63 For the interactive python help system, type 'help_python()'. The help_python function is identical 64 to the help function built into the normal python interpreter. 65 """ 66
67 - def __repr__(self):
68 return self.text
69
70 - def __call__(self, *args, **kwds):
71 return pydoc.help(*args, **kwds)
72