--- Copy of pydoc.py 2006-08-03 10:27:30.000000000 +0200 +++ pydoc.py 2008-06-25 11:26:17.546155500 +0200 @@ -157,6 +157,7 @@ no.append(x) return yes, no +include_private_names = False # By setting this to true, attributes starting with a single _ will also be visible def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. @@ -167,6 +168,8 @@ if all is not None: # only document that which the programmer exported in __all__ return name in all + elif include_private_names: + return 1 else: return not name.startswith('_') @@ -2167,6 +2170,7 @@ def cli(): """Command-line interface (looks at sys.argv to decide what to do).""" + global include_private_names import getopt class BadUsage: pass @@ -2177,10 +2181,12 @@ sys.path.insert(0, '.') try: - opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') + opts, args = getopt.getopt(sys.argv[1:], 'igk:p:w') writing = 0 for opt, val in opts: + if opt == '-i': + include_private_names = True if opt == '-g': gui() return @@ -2234,9 +2240,12 @@ %s -k Search for a keyword in the synopsis lines of all available modules. +%s -i + Include documentation of private attributes. Must be first. + %s -p Start an HTTP server on the given port on the local machine. - + %s -g Pop up a graphical interface for finding and serving documentation. @@ -2244,6 +2253,6 @@ Write out the HTML documentation for a module to a file in the current directory. If contains a '%s', it is treated as a filename; if it names a directory, documentation is written for all the contents. -""" % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) +""" % (cmd, os.sep, cmd, cmd, cmd, cmd, cmd, os.sep) if __name__ == '__main__': cli()