pydoc (version 54366, 26 February 2001)
index
/usr/local/lib/python2.5/pydoc.py
Module Docs

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".
 
Module docs for core modules are assumed to be in
 
    http://www.python.org/doc/current/lib/
 
This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
Reference Manual pages.

 
Modules
       
__builtin__
imp
inspect
os
pkgutil
re
sys
types

 
Classes
       
exceptions.Exception(exceptions.BaseException)
ErrorDuringImport
Doc
HTMLDoc
TextDoc
Helper
ModuleScanner
Scanner
repr.Repr
HTMLRepr
TextRepr

 
class Doc
     Methods defined here:
docclass = fail(self, object, name=None, *args)
docdata = fail(self, object, name=None, *args)
docmodule = fail(self, object, name=None, *args)
docother = fail(self, object, name=None, *args)
docproperty = 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.
getdocloc(self, object)
Return the location of module docs or None

 
class ErrorDuringImport(exceptions.Exception)
    Errors that occurred while trying to import something to document it.
 
 
Method resolution order:
ErrorDuringImport
exceptions.Exception
exceptions.BaseException
__builtin__.object

Methods defined here:
__init__(self, filename, (exc, value, tb))
__str__(self)

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
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={}, *ignored)
Produce HTML documentation for a class object.
docdata(self, object, name=None, mod=None, cl=None)
Produce html documentation for a data descriptor.
docmodule(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a module object.
docother(self, object, name=None, mod=None, *ignored)
Produce HTML documentation for a data object.
docproperty(self, object, name=None, mod=None, cl=None)
Produce html documentation for a property.
docroutine(self, object, name=None, mod=None, funcs={}, classes={}, methods={}, cl=None)
Produce HTML documentation for a function or method object.
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={})
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(self, object) from HTMLRepr
section(self, title, fgcol, bgcol, contents, width=6, prelude='', marginalia=None, gap='&nbsp;')
Format a section with a heading.

Methods inherited from Doc:
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
getdocloc(self, object)
Return the location of module docs or None

 
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)

Methods inherited from repr.Repr:
repr_array(self, x, level)
repr_deque(self, x, level)
repr_dict(self, x, level)
repr_frozenset(self, x, level)
repr_list(self, x, level)
repr_long(self, x, level)
repr_set(self, x, level)
repr_tuple(self, x, level)

 
class Helper
     Methods defined here:
__call__(self, request=None)
__init__(self, input, output)
__repr__(self)
getline(self, prompt)
Read one line, using raw_input when available.
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 other attributes defined here:
keywords = {'and': 'BOOLEAN', 'as': 'with', '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'), ...}
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/Booleans', 'EXPRESSIONS TRUTHVALUE'), ...}

 
class ModuleScanner
    An interruptible scanner that searches module synopses.
 
  Methods defined here:
run(self, callback, key=None, completer=None)

 
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.
docdata(self, object, name=None, mod=None, cl=None)
Produce text documentation for a data descriptor.
docmodule(self, object, name=None, mod=None)
Produce text documentation for a given module object.
docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None)
Produce text documentation for a data object.
docproperty(self, object, name=None, mod=None, cl=None)
Produce text documentation for a property.
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(self, x) from TextRepr
section(self, title, contents)
Format a section with a given heading.

Methods inherited from Doc:
document(self, object, name=None, *args)
Generate documentation for an object.
fail(self, object, name=None, *args)
Raise an exception for unimplemented types.
getdocloc(self, object)
Return the location of module docs or None

 
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)

Methods inherited from repr.Repr:
repr(self, x)
repr_array(self, x, level)
repr_deque(self, x, level)
repr_dict(self, x, level)
repr_frozenset(self, x, level)
repr_list(self, x, level)
repr_long(self, x, level)
repr_set(self, x, level)
repr_tuple(self, x, level)

 
Functions
       
allmethods(cl)
apropos(key)
Print all the one-line module summaries that contain a substring.
classify_class_attrs(object)
Wrap inspect.classify_class_attrs, with fixup for data descriptors.
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.
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)
locate(path, forceload=0)
Locate an object by 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)
source_synopsis(file)
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.
visiblename(name, all=None)
Decide whether to show documentation on a variable.
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
        __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: 54366 $'
__warningregistry__ = {('the gopherlib module is deprecated', <type 'exceptions.DeprecationWarning'>, 289): 1}
help = <pydoc.Helper instance>
html = <pydoc.HTMLDoc instance at 0xb724316c>
text = <pydoc.TextDoc instance at 0xb724314c>

 
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.