epydoc.objdoc.DocMap

Package epydoc :: Module objdoc :: Class DocMap |
[show private | hide private]
[frames | no frames]

## Class DocMap

    UserDict --+
               |
              DocMap

A dictionary mapping each object to the object's documentation. Typically, modules or classes are added to the `DocMap` using `add`, which adds an object and everything it contains. For example, the following code constructs a documentation map, adds the module "epydoc.epytext" to it, and looks up the documentation for "epydoc.epytext.parse":

    >>> docmap = DocMap()               # Construct a docmap
    >>> docmap.add(epydoc.epytext)      # Add epytext to it
    >>> docmap[epydoc.epytext.parse]    # Look up epytext.parse
    <FuncDoc: epydoc.epytext.parse (3 parameters; 1 exceptions)>

Method Summary
| ``__init__`(self, verbosity, document_bases, document_autogen_vars, inheritance_groups, inherit_groups)` Create a new empty documentation map.
`ObjDoc` | ``__getitem__`(self, key)` Return the documentation for the given object; or the object identified by `key`, if `key` is a `UID`.
| `__repr__(self)`
`None` | ``add`(self, obj)` Add the documentation for an object, and everything contained by that object, to this documentation map.
`None` | ``add_one`(self, objID)` Add an object's documentation to this documentation map.
`ObjDoc` or `None` | ``documented_ancestor`(self, method_uid)` Returns the documentation for the closest ancestor of `method_uid` that defines a docstring.
| `sorted_keys(self)`
`list` of `UID` | ``top`(self)` Return the list of top-level objects documented by this documentation map.
| `_add(self, objID)`
`boolean` | ``_toplevel`(self, uid)` Return true if the object identified by `uid` is not contained (as a sub-package, module contents, class contents, etc.) by any other object in this docmap.
Inherited from `UserDict`: `__cmp__`, `__contains__`, `__delitem__`, `__len__`, `__setitem__`, `clear`, `copy`, `get`, `has_key`, `items`, `iteritems`, `iterkeys`, `itervalues`, `keys`, `popitem`, `setdefault`, `update`, `values`

Method Details

### __init__(self, verbosity=0, document_bases=1, document_autogen_vars=1, inheritance_groups=0, inherit_groups=1) (Constructor) Create a new empty documentation map. Parameters: `verbosity` - The verbosity of output produced when creating documentation for objects. More positive numbers produce more verbose output; negative numbers supress warnings and errors. (type=`int`) `document_bases` - Whether or not documentation should automatically be built for the bases of classes that are added to the documentation map. (type=`boolean`) `inheritance_groups` - If true, then create a group for each base ancestor, containing the members that are inherited from that base. These groups have names of the form `'Inherited from base'`. (type=`boolean`) `inherit_groups` - If true, then inherit groups from the base ancestors. (type=`boolean`) Overrides: `UserDict.UserDict.__init__`

### __getitem__(self, key) (Indexing operator) Parameters: `key` - The object whose documentation should be returned. (type=any) Returns: The documentation for the given object; or the object identified by `key`, if `key` is a `UID`. (type=`ObjDoc`) Raises: `KeyError` - If the documentation for the object identified by `key` is not contained in this documentation map. Overrides: `UserDict.UserDict.__getitem__`

### add(self, obj) Add the documentation for an object, and everything contained by that object, to this documentation map. Parameters: `obj` - The object whose documentation should be added to this documentation map. (type=any) Returns: `None`

### add_one(self, objID) Add an object's documentation to this documentation map. If you also want to include the objects contained by `obj`, then use `add`. Parameters: `objID` - The UID of the object whose documentation should be added to this documentation map. (type=`UID`) Returns: `None`

### documented_ancestor(self, method_uid) Returns the documentation for the closest ancestor of `method_uid` that defines a docstring. In particular, search through the set of methods that `method_uid` overrides (starting with `method_uid` itself), and return the first method that: defines a docstring matches the signature of `method_uid` If no such method is found, or if `method_uid` itself is not documented by this docmap, then this function returns `None`. Parameters: `method_uid` (type=`UID`) Returns: `ObjDoc` or `None` Raises: `ValueError` - If `method_uid` is not the UID for a method.

### top(self) Returns: The list of top-level objects documented by this documentation map. The top-level objects are those that are not contained (as sub-packages, module contents, class contents, etc) by any other objects in the documentation map. (type=`list` of `UID`)

### _toplevel(self, uid) Parameters: `uid` - The `UID` to check. (type=`UID`) Returns: True if the object identified by `uid` is not contained (as a sub-package, module contents, class contents, etc.) by any other object in this docmap. (type=`boolean`)

Generated by Epydoc 2.1 on Sat Mar 20 17:46:19 2004 | http://epydoc.sf.net