Table of Contents

Module: __init__ ../HappyDoc-r2_1/happydoclib/parseinfo/__init__.py

Extract information from a Python code parse tree.

This module is based on the Demos/parser/example.py module distributed with the Python source distribution.

File-specific Parser Configuration Values

Parameters to the HappyDoc Parser can also be embedded within the first comment block of the module. The parameter values recognized and their meanings are listed below.

To provide file-specific parser configuration settings, any Python code can be embedded in the comments of the file. For example:

      #!/usr/bin/env python
      #
      # HappyDoc:# These variables should be discovered.
      # HappyDoc:TestInt=1
      # HappyDoc:TestString="String"
      # HappyDoc:TestStringModule=string.strip(' this has spaces in front and back ')
      # HappyDoc:url=urlencode({'a':'A', 'b':'B'})
      # HappyDoc:docStringFormat='StructuredText'

All lines beginning with the pattern "# HappyDoc:" will be concatenated (separated by newlines) and execed. The local namespace resulting from the execution of the code will be examined for variables of interest to the parser. The incoming global namespace for the configuration code will have a few pre-populated names for convenience.

Pre-defined Globals

Name

Description

string

The string module.

urlquote

Same as urllib.quote function.

urlencode

Same as urllib.urlencode function.

Recognized Parser Configuration Variables

Parameter

Description

docStringFormat

The name of the format for the __doc__ strings in the module. This value is used to determine the docstring converter which will know how to translate the docstrings in the module.

Imported modules   
import happydoclib
from happydoclib.StreamFlushTest import StreamFlushTest
import happydoclib.parsecomments
from happydoclib.parseinfo.moduleinfo import ModuleInfo
import happydoclib.path
import parser
import types
Functions   
getDocs
  getDocs 
getDocs (
        parent,
        fileName,
        includeComments=1,
        defaultConfigValues={},
        )

Retrieve information from the parse tree of a source file.

Parameters

fileName
Name of the file to read Python source code from.
includeComments=1
Flag to indicate whether comments should be parsed for cases where __doc__ strings are not available.
Exceptions   
TypeError( msg, source )
Classes   

ParserUnitTest


Table of Contents

This document was automatically generated on Sat Aug 24 16:57:40 2002 by HappyDoc version 2.1