1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 """The prompt UI help system."""
25
26
27 import pydoc
28 import sys
29 from textwrap import wrap
30
31
32 from status import Status; status = Status()
33
34
35
36
37
38 relax_class_help = "This is a python class which contains user functions. To list these functions, either place a period at the end of class name and hit the tab key, or type 'dir(class_name)'."
39
40
41
42
43
45 text = """\
46 For assistance in using a function, simply type 'help(function)'. All functions can be viewed by hitting the [TAB] key. In addition to functions, if 'help(object)' is typed, the help for the python object is returned. This system is similar to the help function built into the python interpreter, which has been renamed to help_python, with the interactive component removed. For the interactive python help system, type 'help_python()'.
47 """
48
50 """String representation of the object.
51
52 @return: The help description.
53 @rtype: str
54 """
55
56
57 string = ''
58 for line in wrap(self.text, status.text_width):
59 string += line + '\n'
60
61
62 return string
63
64
66 """Make the object executable."""
67
68
69 if len(args) != 1 or isinstance(args[0], str):
70 print((self.text))
71 return
72
73
74 obj = args[0]
75
76
77 if not hasattr(obj, '__relax_help__') and hasattr(obj, '_build_doc'):
78 obj.__relax_help__ = obj._build_doc()
79
80
81 if hasattr(obj, '__relax_help__'):
82 pydoc.pager(obj.__relax_help__)
83 return
84
85
86 return pydoc.help(*args, **kwds)
87
88
90 text = """\
91 For the interactive python help system, type 'help_python()'. The help_python function is identical
92 to the help function built into the normal python interpreter.
93 """
94
95
98
99
101 return pydoc.help(*args, **kwds)
102