epydoc.objdoc.ModuleDoc

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

## Class ModuleDoc

    ObjDoc --+
             |
            ModuleDoc

The documentation for a module or package. This documentation consists of standard pieces of documentation (as defined in `ObjDoc`), and the following module-specific pieces of documentation:

- classes: A list of all classes contained in the module/package.
- functions: A list of all functions contained in the module/package.
- variables: A list of all variables contained in the module/package.
- modules: A list of all modules contained in the package (packages only).
- imported objects: Lists of imported objects, sorted by type.

Method Summary
| `__init__(self, uid, verbosity)`
| `__repr__(self)`
Inherited from `ObjDoc`: `_sort`
Accessors
`list` of `Link` | ``functions`(self)` Return a list of all functions defined by the module/package documented by this `ModuleDoc`.
`list` of `Link` | ``classes`(self)` Return a list of all classes defined by the module/package documented by this `ModuleDoc`, sorted by name.
`list` of `Var` | ``variables`(self)` Return a list of all variables defined by the module/package documented by this `ModuleDoc`, sorted by name.
`list` of `Link` | ``imported_functions`(self)` Return a list of all functions contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name.
`list` of `Link` | ``imported_classes`(self)` Return a list of all classes contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name.
`UID` or `None` | ``package`(self)` Return the package that contains the module documented by this `ModuleDoc`, or `None` if no package contains the module.
`boolean` | ``ispackage`(self)` Return true if this `ModuleDoc` documents a package (not a module).
`boolean` | ``ismodule`(self)` Return true if this `ModuleDoc` documents a module (not a package).
`list` of `Link` | ``modules`(self)` Return a list of the known modules and subpackages conained in the package documented by this `ModuleDoc`, sorted by name.
`list` of `Var` | ``imported_variables`(self)` Return a list of all variables contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name.
`list` of `Link` | ``imported_modules`(self)` Return a list of all modules that are imported by the module/package documented by this `ModuleDoc`, sorted by name.
Inherited from `ObjDoc`: `by_group`, `defines_groups`, `descr`, `field_values`, `fields`, `groups`, `has_docstring`, `sortorder`, `summary`, `uid`
Modifiers
| `remove_autogenerated_variables(self)`
`None` | ``add_modules`(self, modules)` Register submodules for the package doumented by this `ModuleDoc`.
Import Detection
| ``_find_defined_vars`(self, lhs_testlist, defined_variables)` A helper function for `_find_imported_variables`: for every variable `v` set by the given left-hand-side of an equation, set `defined_variables[v]=1`.
| ``_find_imported_variables`(self)` If possible, read the module's python documentation, and try to figure out which variables were imported.
Error Handling
Inherited from `ObjDoc`: `_print_errors`
Docstring Parsing
| ``_process_field`(self, tag, arg, descr, warnings)` Process a field from this object's docstring.

Instance Variable Summary
`list` of `Link` | `_classes`: A list of all classes contained in the module/package.
`list` of `Link` | `_functions`: A list of all functions contained in the module/package.
`list` of `Link` | `_modules`: A list of all modules conained in the package (package only).
`list` of `Var` | `_variables`: A list of all variables defined by this module/package.
Inherited from `ObjDoc`: `_uid`
Error Handling
Inherited from `ObjDoc`: `_field_warnings`, `_misc_warnings`, `_parse_errors`, `_parse_warnings`
Docstring Parsing
Inherited from `ObjDoc`: `_descr`, `_fields`

Class Variable Summary
`tuple` | `_EXPR_STMT_PATTERN` = `(264, (265, (266, ['expr_stmt']), (...`
`tuple` | `_LHS_PATTERN` = `(292, (293, (294, (295, (297, (298, (299,...`
Docstring Parsing
Inherited from `ObjDoc`: `STANDARD_FIELDS`

Method Details

### functions(self) Returns: A list of all functions defined by the module/package documented by this `ModuleDoc`. (type=`list` of `Link`)

### classes(self) Returns: A list of all classes defined by the module/package documented by this `ModuleDoc`, sorted by name. (type=`list` of `Link`)

### variables(self) Returns: A list of all variables defined by the module/package documented by this `ModuleDoc`, sorted by name. (type=`list` of `Var`)

### imported_functions(self) Returns: A list of all functions contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name. (type=`list` of `Link`)

### imported_classes(self) Returns: A list of all classes contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name. (type=`list` of `Link`)

### package(self) Returns: The package that contains the module documented by this `ModuleDoc`, or `None` if no package contains the module. (type=`UID` or `None`)

### ispackage(self) Returns: True if this `ModuleDoc` documents a package (not a module). (type=`boolean`)

### ismodule(self) Returns: True if this `ModuleDoc` documents a module (not a package). (type=`boolean`)

### modules(self) Returns: A list of the known modules and subpackages conained in the package documented by this `ModuleDoc`, sorted by name. (type=`list` of `Link`) Raises: `TypeError` - If this `ModuleDoc` does not document a package.

### imported_variables(self) Returns: A list of all variables contained in the module/package documented by this `ModuleDoc` that are not defined by that module/package, sorted by name. (type=`list` of `Var`)

### imported_modules(self) Returns: A list of all modules that are imported by the module/package documented by this `ModuleDoc`, sorted by name. (type=`list` of `Link`)

### add_modules(self, modules) Register submodules for the package doumented by this `ModuleDoc`. This must be done externally, since we can't determine the submodules of a package through introspection alone. This is automatically called by `DocMap.add` when new modules are added to a `DocMap`. Parameters: `modules` - A list of modules or subpackages. (type=`list` of `UID`) Returns: `None`

### _find_defined_vars(self, lhs_testlist, defined_variables) A helper function for `_find_imported_variables`: for every variable `v` set by the given left-hand-side of an equation, set `defined_variables[v]=1`. Parameters: `lhs_testlist` - An AST tuple containing a `testlist` element from the left hand side of an equation. `defined_variables` - The output dictionary.

### _find_imported_variables(self) If possible, read the module's python documentation, and try to figure out which variables were imported. To decide which variables were imported, we use the following heuristic: if a variable isn't defined in the lhs of a top-level statement, then it's probably imported. Note that this isn't 100% effective. E.g., if someone uses `global`, uses a `try`/`except` block, or directly modifies their modules' `__dict__`, then we'll be fooled. Bug: If you define class C with method g, and then at the top level you say 'h=C.g', then this method will think that is an imported variable (since the var's name is derived from its uid, and the uid will be C.g, not h).

### _process_field(self, tag, arg, descr, warnings) Process a field from this object's docstring. `ObjDoc._process_field` be overridden by child classes of `ObjDoc`, and called as the default case. Parameters: `tag` - The field's tag name (type=`string`) `arg` - The field's optional argument (or `None` if no argument was specified). (type=`string`) `descr` - The field's body. (type=`markup.ParsedDocstring`) `warnings` - A list of warnings that have been encountered. If any new warnings are encountered, then they should be appended to this list. Overrides: `epydoc.objdoc.ObjDoc._process_field` (inherited documentation)

Instance Variable Details

### _classes A list of all classes contained in the module/package. Type: `list` of `Link`

### _functions A list of all functions contained in the module/package. Type: `list` of `Link`

### _modules A list of all modules conained in the package (package only). Type: `list` of `Link`

### _variables A list of all variables defined by this module/package. Type: `list` of `Var`

Class Variable Details

    ### _EXPR_STMT_PATTERN Type: `tuple` Value:
        (264, (265, (266, ['expr_stmt']), (4, '')))

    ### _LHS_PATTERN Type: `tuple` Value:
        (292,
         (293,
          (294,
           (295,
            (297, (298, (299, (300, (301, (302, (303, (304, ['lhs_atom']))))))\
        ))))))

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