Table of Contents

Class: FunctionInfo ../HappyDoc-r2_1/happydoclib/parseinfo/functioninfo.py

Gather information about a function or method definition.

Base Classes   
SuiteInfoBase
SuiteFuncInfo
Methods   
__init__
_constructParameterInfo
_extractFunctionParameters
_extractThrownExceptions
_reconstructValueFromAtom
getExceptionInfo
getExceptionNames
getFullyQualifiedName
getParameterInfo
getParameterNames
getReference
  __init__ 
__init__ (
        self,
        parent=None,
        tree=None,
        commentInfo={},
        )

Initialize the info extractor.

Parameters:

parent
parent object for this object (e.g. Module or Function)
tree
parse tree from which to extract information
commentInfo
comments extracted from the source file holding this module
  _constructParameterInfo 
_constructParameterInfo ( self,  parameterData )

Construct storable parameter data from a parameter list.

Given the sequence of tuples extracted as a parameter list, store the names (in order) in self._parameter_names and the information about the parameter in self._parameter_info where the keys are the parameter name and the info is a tuple containing:

(default_specified, default_value, default_value_type)

Where:

default_specified
boolean indicating whether a default value was specified
default_value
the default value given, if any
default_value_type
the type of the default value (token.STRING, token.NAME, None). A type of None means unknown.
  _extractFunctionParameters 
_extractFunctionParameters ( self,  tree )

Extract information about a function's parameters.

Exceptions   
'Unrecognized parse result %s in %s' %( parameters [ 1 ], parameters )
'Unrecognized parse result %s in %s' %( parameters [ 2 ], parameters )
  _extractThrownExceptions 
_extractThrownExceptions ( self,  tree )

Return a dictionary of exception->exception_type values.

  _reconstructValueFromAtom 
_reconstructValueFromAtom (
        self,
        atom,
        trailer=[],
        )

Convert an atom portion of a parse tree into the value.

If the atom represents a string, number or name

  getExceptionInfo 
getExceptionInfo ( self,  exceptionName )

Returns a type value for an exception.

The return value will be one of (token.NAME, token.STRING) indicating whether the exception was thrown as a string or a named object.

  getExceptionNames 
getExceptionNames ( self )

Return a list of the names of any exceptions raised by the function.

  getFullyQualifiedName 
getFullyQualifiedName ( self )

Return a complete, unique, name representing this object.

  getParameterInfo 
getParameterInfo ( self,  paramName )

Returns the info record for a parameter.

The returned tuple consists of:

(default_specified, default_value, default_value_type)

Where:

default_specified
boolean indicating whether a default value was specified
default_value
the default value given, if any
default_value_type
the type of the default value (token.STRING, token.NAME, None). A type of None means unknown.
  getParameterNames 
getParameterNames ( self )

Returns a list of the names of all parameters to the function, in order.

  getReference 
getReference (
        self,
        formatter,
        sourceNode,
        )

Return a reference to this function from sourceNode.


Table of Contents

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