formatter

Differences between revisions 14 and 54 (spanning 40 versions)
Revision 14 as of 2014-04-06 07:32:12
Size: 8715
Editor: host217-42-218-163
Comment:
Revision 54 as of 2014-04-06 09:20:33
Size: 9451
Editor: host217-42-218-163
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Formatter module supporting pydoc2 - contains classes for walking the data structures, and generating output as appropriate

``23 Mar - using the new analyser module``
 Formatter module supporting pydoc2 - contains classes for walking the data structures, and generating output as appropriate

 ''23 Mar - using the new analyser module''

  ''23 Mar - using the new analyser module''
Line 17: Line 19:
''`formatter`''.'''`formatterError`'''(```` msg````)      ''Derived From :''
BaseException

  ''''

 
==== Properties ====
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`formatterError`'''(```` msg````) ||<style="border:none;text-align:right;"> ''Derived From'' :''!BaseException'' ||




==== Properties ====
Line 32: Line 34:
''`formatter`''.'''`InvalidDictionaryError`'''(```` msg````)      ''Derived From :''
[[#formatterError|formatterError]]

  ''''

 
==== Properties ====
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`InvalidDictionaryError`'''(```` msg````) ||<style="border:none;text-align:right;"> ''Derived From'' :''[[#formatterError|formatterError]]'' ||




==== Properties ====
Line 47: Line 49:
''`formatter`''.'''`DataWalker`'''(```` options=None````)          ''Base class to walk the various entries in the data for a single module''

``
This is subclassed by Formatter classes``
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`DataWalker`'''(```` options=None````) ||<style="border:none;text-align:right;"> ||

 
Base class to walk the various entries in the data for a single module




  ''
This is subclassed by Formatter classes''
Line 67: Line 72:
''`formatter`''.'''`HtmlFormatter`'''(```` module=`''`, directory=`''`, error=`''`, options=None, autoclose=True, OutputStream='stdout'````)      ''Derived From :''
[[#DataWalker|DataWalker]]

  ''Format the data as a html page''

``OutputStream : Must be a fileType object - for instance an open file or a StringIO  <<BR>>module : the absolute filename of the module to be displayed  <<BR>>directory : the absolute path of the directory to be displayed  <<BR>>error : A dictionary with details of the error to be displayed  <<BR>>options : The options namescpace created from parse-arg  <<BR>>autoclose : Whether the formatter should automatically close the file when finished.  <<BR>> Where the OutputStream is StringIO this will probably need to be false.``
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`HtmlFormatter`'''(```` module=`''`, directory=`''`, error=`''`, options=None, autoclose=True, OutputStream='stdout'````) ||<style="border:none;text-align:right;"> ''Derived From'' :''[[#DataWalker|DataWalker]]'' ||

 Format the data as a html page




  ''
OutputStream : Must be a fileType object - for instance an open file or a StringIO<<BR>>module : the absolute filename of the module to be displayed<<BR>>directory : the absolute path of the directory to be displayed<<BR>>error : A dictionary with details of the error to be displayed<<BR>>options : The options namescpace created from parse-arg<<BR>>autoclose : Whether the formatter should automatically close the file when finished.<<BR>> Where the OutputStream is StringIO this will probably need to be false.''
Line 130: Line 137:
''`formatter`''.'''`TextFormatter`'''(```` absfilename, options=None````)      ''Derived From :''
[[#DataWalker|DataWalker]]

  ''
Generates Text format for a single module''

``
absfile - the file name for the module   <<BR>>options : opttions passed by the command line``
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`TextFormatter`'''(```` absfilename, options=None````) ||<style="border:none;text-align:right;"> ''Derived From'' :''[[#DataWalker|DataWalker]]'' ||

 
Generates Text format for a single module




  ''
absfile - the file name for the module <<BR>>options : opttions passed by the command line''
Line 149: Line 158:
Any header before the module starts   Any header before the module starts
Line 153: Line 162:
Processing once the end of the Module is reached.   Processing once the end of the Module is reached.
Line 179: Line 188:
''`formatter`''.'''`WikiFormatter`'''(```` module=`''`, directory=`''`, error=`''`, options=None, autoclose=True, OutputStream='stdout'````)      ''Derived From :''
[[#DataWalker|DataWalker]]

  ''Format the data as a html page''

``OutputStream : Must be a fileType object - for instance an open file or a StringIO  <<BR>>module : the absolute filename of the module to be displayed  <<BR>>directory : the absolute path of the directory to be displayed  <<BR>>error : A dictionary with details of the error to be displayed  <<BR>>options : The options namescpace created from parse-arg  <<BR>>autoclose : Whether the formatter should automatically close the file when finished.  <<BR>> Where the OutputStream is StringIO this will probably need to be false.  <<BR>>   <<BR>>Currently - does not need to support the directoy or error formats - may support directory/Package in future.``
||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`WikiFormatter`'''(```` module=`''`, directory=`''`, error=`''`, options=None, autoclose=True, OutputStream='stdout'````) ||<style="border:none;text-align:right;"> ''Derived From'' :''[[#DataWalker|DataWalker]]'' ||

 Format the data as a html page




  ''
OutputStream : Must be a fileType object - for instance an open file or a StringIO<<BR>>module : the absolute filename of the module to be displayed<<BR>>directory : the absolute path of the directory to be displayed<<BR>>error : A dictionary with details of the error to be displayed<<BR>>options : The options namescpace created from parse-arg<<BR>>autoclose : Whether the formatter should automatically close the file when finished.<<BR>> Where the OutputStream is StringIO this will probably need to be false.<<BR>> <<BR>>Currently - does not need to support the directoy or error formats - may support directory/Package in future.''
Line 198: Line 209:
Not supported by a wiki page as yet   Not supported by a wiki page as yet
Line 202: Line 213:
Definitely not needed by a wiki   Definitely not needed by a wiki
Line 206: Line 217:
Not needed by a wiki   Not needed by a wiki
Line 242: Line 253:
''`formatter`''.'''`pager`'''(````````)          ''pager class Encapsulates all the good stuff we need in a pager - Used by the Text formatter class only'' ||<style="border:none;text-align:left;" tablewidth="75%"> ''`formatter`''.'''`pager`'''(````````) ||<style="border:none;text-align:right;"> ||

 
pager class Encapsulates all the good stuff we need in a pager - Used by the Text formatter class only


Line 250: Line 264:
Passes the text to the appropriate pager

``The first time this is called, determine what kind of pager to use.``
  Passes the text to the appropriate pager

  ''The first time this is called, determine what kind of pager to use.''
Line 256: Line 270:
Format a string in bold by overstriking.   Format a string in bold by overstriking.

formatter

  • Formatter module supporting pydoc2 - contains classes for walking the data structures, and generating output as appropriate

    23 Mar - using the new analyser module

    • 23 Mar - using the new analyser module

No functions defined within this module

CLASSES

formatterError Class

formatter.formatterError( msg)

Derived From :BaseException

Properties

  • formatterError.args Read Only

    formatterError.message Read Only

InvalidDictionaryError Class

formatter.InvalidDictionaryError( msg)

Derived From :formatterError

Properties

  • InvalidDictionaryError.args Read Only

    InvalidDictionaryError.message Read Only

DataWalker Class

formatter.DataWalker( options=None)

  • Base class to walk the various entries in the data for a single module
    • This is subclassed by Formatter classes

Methods

  • DataWalker.TraverseProperty( prop, depth=1, line=False, method=False)

    DataWalker.TraverseFunction( func, depth=1, line=False, method=False)

    DataWalker.TraverseClass( cls, depth=1)

    DataWalker.TraverseModule( depth=1)

HtmlFormatter Class

formatter.HtmlFormatter( module='', directory='', error='', options=None, autoclose=True, OutputStream='stdout')

Derived From :DataWalker

  • Format the data as a html page
    • OutputStream : Must be a fileType object - for instance an open file or a StringIO
      module : the absolute filename of the module to be displayed
      directory : the absolute path of the directory to be displayed
      error : A dictionary with details of the error to be displayed
      options : The options namescpace created from parse-arg
      autoclose : Whether the formatter should automatically close the file when finished.
      Where the OutputStream is StringIO this will probably need to be false.

Methods

  • HtmlFormatter.TraverseProperty( prop, depth=1, line=False, method=False)

    HtmlFormatter.TraverseFunction( func, depth=1, line=False, method=False)

    HtmlFormatter.TraverseClass( cls, depth=1)

    HtmlFormatter.TraverseModule( depth=1)

    HtmlFormatter.Directory()

    HtmlFormatter.ErrorReport( dict)

    HtmlFormatter.ModuleError( module)

    HtmlFormatter.ModuleHeader( module)

    HtmlFormatter.ModuleFooter( module)

    HtmlFormatter.ClassMethodHeader()

    HtmlFormatter.ClassMethodFooter()

    HtmlFormatter.ClassSectionHeader( depth)

    HtmlFormatter.NoClassesPresent( depth=1)

    HtmlFormatter.ClassSectionFooter( depth)

    HtmlFormatter.FunctionSectionHeader( depth)

    HtmlFormatter.NoFunctionsPresent( depth=1)

    HtmlFormatter.FunctionSectionFooter( depth)

    HtmlFormatter.ClassHeader( cls)

    HtmlFormatter.ClassFooter( cls)

    HtmlFormatter.formatModule( module, depth=1)

    HtmlFormatter.formatClass( cls, depth)

    HtmlFormatter.ClassPropertiesHeader()

    HtmlFormatter.ClassPropertiesFooter()

    HtmlFormatter.formatProperty( property, depth)

    HtmlFormatter.formatFunction( function, depth, line=False, method=False)

TextFormatter Class

formatter.TextFormatter( absfilename, options=None)

Derived From :DataWalker

  • Generates Text format for a single module
    • absfile - the file name for the module
      options : opttions passed by the command line

Methods

  • TextFormatter.TraverseProperty( prop, depth=1, line=False, method=False)

    TextFormatter.TraverseFunction( func, depth=1, line=False, method=False)

    TextFormatter.TraverseClass( cls, depth=1)

    TextFormatter.TraverseModule( depth=1)

    TextFormatter.ModuleHeader( module) Any header before the module starts

    TextFormatter.ModuleFooter( module) Processing once the end of the Module is reached.

    TextFormatter.ClassHeader( dict)

    TextFormatter.ClassFooter( dict)

    TextFormatter.NoClassesPresent()

    TextFormatter.NoFunctionsPresent()

    TextFormatter.ClassSectionHeader( depth)

    TextFormatter.FunctionSectionHeader( depth)

    TextFormatter.FunctionSectionFooter( depth)

    TextFormatter.formatModule( module, depth=1)

    TextFormatter.formatClass( cls, depth)

    TextFormatter.formatFunction( function, depth, line=False, method=False)

WikiFormatter Class

formatter.WikiFormatter( module='', directory='', error='', options=None, autoclose=True, OutputStream='stdout')

Derived From :DataWalker

  • Format the data as a html page
    • OutputStream : Must be a fileType object - for instance an open file or a StringIO
      module : the absolute filename of the module to be displayed
      directory : the absolute path of the directory to be displayed
      error : A dictionary with details of the error to be displayed
      options : The options namescpace created from parse-arg
      autoclose : Whether the formatter should automatically close the file when finished.
      Where the OutputStream is StringIO this will probably need to be false.

      Currently - does not need to support the directoy or error formats - may support directory/Package in future.

Methods

  • WikiFormatter.TraverseProperty( prop, depth=1, line=False, method=False)

    WikiFormatter.TraverseFunction( func, depth=1, line=False, method=False)

    WikiFormatter.TraverseClass( cls, depth=1)

    WikiFormatter.TraverseModule( depth=1)

    WikiFormatter.Directory() Not supported by a wiki page as yet

    WikiFormatter.ErrorReport( dict) Definitely not needed by a wiki

    WikiFormatter.ModuleError( module) Not needed by a wiki

    WikiFormatter.ModuleHeader( module)

    WikiFormatter.ModuleFooter( module)

    WikiFormatter.ClassMethodHeader()

    WikiFormatter.ClassSectionHeader( depth)

    WikiFormatter.NoClassesPresent( depth=1)

    WikiFormatter.FunctionSectionHeader( depth)

    WikiFormatter.NoFunctionsPresent( depth=1)

    WikiFormatter.FunctionSectionFooter( depth)

    WikiFormatter.ClassHeader( cls)

    WikiFormatter.ClassFooter( cls)

    WikiFormatter.formatModule( module, depth=1)

    WikiFormatter.formatClass( cls, depth)

    WikiFormatter.ClassPropertiesHeader()

    WikiFormatter.formatProperty( property, depth)

    WikiFormatter.formatFunction( function, depth, line=False, method=False)

pager Class

formatter.pager()

  • pager class Encapsulates all the good stuff we need in a pager - Used by the Text formatter class only

Methods

  • pager.page( text) Passes the text to the appropriate pager

    The first time this is called, determine what kind of pager to use.

    pager.bold( text) Format a string in bold by overstriking.

TimeWarp/formatter (last edited 2014-04-06 09:20:33 by host217-42-218-163)