pdk.Tools._pydoc (version 1.9, 26 February 2001)
index
pdk/Tools/_pydoc.py

Generate Python documentation in HTML or text for interactive use.

In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object.

Or, at the shell command line outside of Python:

Run "pydoc <name>" to show documentation on something. <name> may be the name of a function, module, package, or a dotted reference to a class or function within a module or module in a package. If the argument contains a path segment delimiter (e.g. slash on Unix, backslash on Windows) it is treated as the path to a Python source file.

Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines of all available modules.

Run "pydoc -p <port>" to start an HTTP server on a given port on the local machine to generate documentation web pages.

For platforms without a command line, "pydoc -g" starts the HTTP server and also pops up a little window for controlling it.

Run "pydoc -w <name>" to write out the HTML documentation for a module to a file named "<name>.html".

 
Modules
            
imp
inspect
os
re
sys
types
 
Classes
            
Doc
HTMLDoc
TextDoc
exceptions.Exception
ErrorDuringImport
Helper
repr.Repr
HTMLRepr
TextRepr
Scanner
ModuleScanner
 
class Doc
       
   Methods defined here:
docclass = fail(self, object, name=None, *args)
docmodule = fail(self, object, name=None, *args)
docother = fail(self, object, name=None, *args)
docroutine = fail(self, object, name=None, *args)
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
 
class ErrorDuringImport(exceptions.Exception)
     
Errors that occurred while trying to import something to document it.

 
   Methods defined here:
__init__(self, filename, (exc, value, tb))
__str__(self)
 
class HTMLDoc(Doc)
     
Formatter class for HTML documentation.

 
   Methods defined here:
bigsection(self, title, *args)
Format a section with a big heading.
classlink(self, object, modname)
Make a link for a class.
docclass(self, object, name=None, mod=None, funcs={}, classes={}, data={}, *ignored)
Produce HTML documentation for a class object.
docmodule(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a module object.
docother(self, object, name=None, container=None, funcs={}, classes={}, *ignored)
Produce HTML documentation for a data object.
docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, data={}, cl=None)
Produce HTML documentation for a function or method object.
escape = escape(self, text) from HTMLRepr
formattree(self, tree, modname, parent=None)
Produce HTML for a class tree as given by inspect.getclasstree().
formatvalue(self, object)
Format an argument default value as text.
grey(self, text)
heading(self, title, fgcol, bgcol, extras='')
Format a page heading.
index(self, dir, shadowed=None)
Generate an HTML index for a directory of modules.
markup(self, text, escape=None, funcs={}, classes={}, methods={}, data={})
Mark up some plain text, given a context of symbols to look for. Each context dictionary maps object names to anchor names.
modpkglink(self, (name, path, ispackage, shadowed))
Make a link for a module or package to display in an index.
modulelink(self, object)
Make a link for a module.
multicolumn(self, list, format, cols=4)
Format a list of items into a multi-column list.
namelink(self, name, *dicts)
Make a link for an identifier, given name-to-URL mappings.
page(self, title, contents)
Format an HTML page.
preformat(self, text)
Format literal preformatted text.
repr = repr(self, object) from HTMLRepr
section(self, title, fgcol, bgcol, contents, width=10, prelude='', marginalia=None, gap='&nbsp;&nbsp;')
Format a section with a heading.
 
class HTMLRepr(repr.Repr)
     
Class for safely making an HTML representation of a Python object.

 
   Methods defined here:
__init__(self)
escape(self, text)
repr(self, object)
repr1(self, x, level)
repr_instance(self, x, level)
repr_str = repr_string(self, x, level)
repr_string(self, x, level)
repr_unicode = repr_string(self, x, level)
 
class Helper
       
   Methods defined here:
__call__(self, request=None)
__init__(self, input, output)
__repr__(self)
help(self, request)
interact(self)
intro(self)
list(self, items, columns=4, width=80)
listkeywords(self)
listmodules(self, key='')
listtopics(self)
showtopic(self, topic)

Data and non-method functions defined here:
keywords = {'and': 'BOOLEAN', 'assert': ('ref/assert', ''), 'break': ('ref/break', 'while for'), 'class': ('ref/class', 'CLASSES SPECIALMETHODS'), 'continue': ('ref/continue', 'while for'), 'def': ('ref/function', ''), 'del': ('ref/del', 'BASICMETHODS'), 'elif': 'if', 'else': ('ref/if', 'while for'), 'except': 'try', ...}
topics = {'ASSERTION': 'assert', 'ASSIGNMENT': ('ref/assignment', 'AUGMENTEDASSIGNMENT'), 'ATTRIBUTEMETHODS': ('ref/attribute-access', 'ATTRIBUTES SPECIALMETHODS'), 'ATTRIBUTES': ('ref/attribute-references', 'getattr hasattr setattr ATTRIBUTEMETHODS'), 'AUGMENTEDASSIGNMENT': ('ref/augassign', 'NUMBERMETHODS'), 'BACKQUOTES': ('ref/string-conversions', 'repr str STRINGS LITERALS'), 'BASICMETHODS': ('ref/customization', 'cmp hash repr str SPECIALMETHODS'), 'BINARY': ('ref/binary', 'EXPRESSIONS'), 'BITWISE': ('ref/bitwise', 'EXPRESSIONS'), 'BOOLEAN': ('ref/lambda', 'EXPRESSIONS TRUTHVALUE'), ...}
 
class ModuleScanner(Scanner)
     
An interruptible scanner that searches module synopses.

 
   Methods defined here:
__init__(self)
isnewpackage(self, (dir, package))
run(self, callback, key=None, completer=None)
submodules(self, (dir, package))
 
class Scanner
     
A generic tree iterator.

 
   Methods defined here:
__init__(self, roots, children, descendp)
next(self)
 
class TextDoc(Doc)
     
Formatter class for text documentation.

 
   Methods defined here:
bold(self, text)
Format a string in bold by overstriking.
docclass(self, object, name=None, mod=None)
Produce text documentation for a given class object.
docmodule(self, object, name=None, mod=None)
Produce text documentation for a given module object.
docother(self, object, name=None, mod=None, maxlen=None, doc=None)
Produce text documentation for a data object.
docroutine(self, object, name=None, mod=None, cl=None)
Produce text documentation for a function or method object.
formattree(self, tree, modname, parent=None, prefix='')
Render in text a class tree as returned by inspect.getclasstree().
formatvalue(self, object)
Format an argument default value as text.
indent(self, text, prefix=' ')
Indent text by prepending a given prefix to each line.
repr = repr(self, x) from TextRepr
section(self, title, contents)
Format a section with a given heading.
 
class TextRepr(repr.Repr)
     
Class for safely making a text representation of a Python object.

 
   Methods defined here:
__init__(self)
repr1(self, x, level)
repr_instance(self, x, level)
repr_str = repr_string(self, x, level)
repr_string(self, x, level)
 
Functions
            
allmethods(cl)
apropos(key)
Print all the one-line module summaries that contain a substring.
classname(object, modname)
Get a class name and qualify it with a module name if necessary.
cli()
Command-line interface (looks at sys.argv to decide what to do).
cram(text, maxlen)
Omit part of a string if needed to make it fit in a maximum length.
describe(thing)
Produce a short description of the given thing.
doc(thing, title='Python Library Documentation: %s', forceload=0)
Display text documentation, given an object or a path to an object.
getdoc(object)
Get the doc string or comments for an object.
getdocfile(object)
Returns the name of the HTML file that contains the documentation of an object, or None if no such file can be found.
getpager()
Decide what method to use for paging through text.
gui()
Graphical interface (starts web server and pops up a control window).
importfile(path)
Import a Python source file or compiled file given its path.
isdata(object)
Check if an object is of a type that probably means it's data.
ispackage(path)
Guess whether a path refers to a package directory.
ispath(x)
issomeinstance(object)
check if an object is of type InstanceType
locate(path, forceload=0)
Locate an object by name, file name, or dotted path, importing as necessary.
pager(text)
The first time this is called, determine what kind of pager to use.
pathdirs()
Convert sys.path into a list of absolute, existing, unique paths.
pipepager(text, cmd)
Page through text by feeding it to another program.
plain(text)
Remove boldface formatting from text.
plainpager(text)
Simply print unformatted text. This is the ultimate fallback.
replace(text, *pairs)
Do a series of global replacements on a string.
resolve(thing, forceload=0)
Given an object or a path to an object, get the object and its name.
safeimport(path, forceload=0, cache={})

Import a module; handle errors; return None if the module isn't found.

If the module is found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at the beginning. If the optional 'forceload' argument is 1, we reload the module from disk (unless it's a dynamic extension).

serve(port, callback=None, completer=None)
splitdoc(doc)
Split a doc string into a synopsis line (if any) and the rest.
stripid(text)
Remove the hexadecimal id from a Python object representation.
synopsis(filename, cache={})
Get the one-line summary out of a module file.
tempfilepager(text, cmd)
Page through text by invoking a program on a temporary file.
ttypager(text)
Page through text on a text terminal.
writedoc(thing, forceload=0)
Write HTML documentation to a file in the current directory.
writedocs(dir, pkgpath='', done=None)
Write out HTML documentation for all modules in a directory tree.
 
Data
             COLORS = {'AuthorBg': '#ffffff', 'AuthorFg': '#7799ee', 'BodyBackground': '#ffffff', 'BuiltinModulesBg': '#ffffff', 'BuiltinModulesFg': '#aaa8a8', 'ClassDataBg': '#000000', 'ClassDataFg': '#ccc8c8', 'ClassSectionBg': '#ffffff', 'ClassSectionFg': '#aaa8c8', 'DataSectionBg': '#ffffff', ...}
HIDE = 7
HIDE_INHERITED = 4
HIDE_PRIVATE = 1
HIDE_PROTECTED = 2
NEWONLY = 1
PYEXTENSIONS = ['.py']
URLPREFIX = ''
__author__ = 'Ka-Ping Yee <ping@lfw.org>'
__credits__ = 'Guido van Rossum, for an excellent programming l...erlain, for the first implementation of textdoc.\n'
__date__ = '26 February 2001'
__version__ = '$Revision: 1.9 $'
help = instance of Helper
html = instance of pdkHTMLDoc
text = instance of TextDoc
 
Author
            
Ka-Ping Yee <ping@lfw.org>
 
Credits
            
Guido van Rossum, for an excellent programming language. Tommy Burnette, the original creator of manpy. Paul Prescod, for all his work on onlinehelp. Richard Chamberlain, for the first implementation of textdoc.