OLD | NEW |
1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
2 # -*- coding: latin-1 -*- | 2 # -*- coding: latin-1 -*- |
3 """Generate Python documentation in HTML or text for interactive use. | 3 """Generate Python documentation in HTML or text for interactive use. |
4 | 4 |
5 In the Python interpreter, do "from pydoc import help" to provide online | 5 In the Python interpreter, do "from pydoc import help" to provide online |
6 help. Calling help(thing) on a Python object documents the object. | 6 help. Calling help(thing) on a Python object documents the object. |
7 | 7 |
8 Or, at the shell command line outside of Python: | 8 Or, at the shell command line outside of Python: |
9 | 9 |
10 Run "pydoc <name>" to show documentation on something. <name> may be | 10 Run "pydoc <name>" to show documentation on something. <name> may be |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if predicate(x): | 152 if predicate(x): |
153 yes.append(x) | 153 yes.append(x) |
154 else: | 154 else: |
155 no.append(x) | 155 no.append(x) |
156 return yes, no | 156 return yes, no |
157 | 157 |
158 def visiblename(name, all=None): | 158 def visiblename(name, all=None): |
159 """Decide whether to show documentation on a variable.""" | 159 """Decide whether to show documentation on a variable.""" |
160 # Certain special names are redundant. | 160 # Certain special names are redundant. |
161 _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', | 161 _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', |
162 '__module__', '__name__', '__slots__', '__package__') | 162 '__module__', '__name__', '__slots__', '__package__', |
| 163 '__cached__') |
163 if name in _hidden_names: return 0 | 164 if name in _hidden_names: return 0 |
164 # Private names are hidden, but special names are displayed. | 165 # Private names are hidden, but special names are displayed. |
165 if name.startswith('__') and name.endswith('__'): return 1 | 166 if name.startswith('__') and name.endswith('__'): return 1 |
166 if all is not None: | 167 if all is not None: |
167 # only document that which the programmer exported in __all__ | 168 # only document that which the programmer exported in __all__ |
168 return name in all | 169 return name in all |
169 else: | 170 else: |
170 return not name.startswith('_') | 171 return not name.startswith('_') |
171 | 172 |
172 def classify_class_attrs(object): | 173 def classify_class_attrs(object): |
(...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 %s -g | 2321 %s -g |
2321 Pop up a graphical interface for finding and serving documentation. | 2322 Pop up a graphical interface for finding and serving documentation. |
2322 | 2323 |
2323 %s -w <name> ... | 2324 %s -w <name> ... |
2324 Write out the HTML documentation for a module to a file in the current | 2325 Write out the HTML documentation for a module to a file in the current |
2325 directory. If <name> contains a '%s', it is treated as a filename; if | 2326 directory. If <name> contains a '%s', it is treated as a filename; if |
2326 it names a directory, documentation is written for all the contents. | 2327 it names a directory, documentation is written for all the contents. |
2327 """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep)) | 2328 """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep)) |
2328 | 2329 |
2329 if __name__ == '__main__': cli() | 2330 if __name__ == '__main__': cli() |
OLD | NEW |