[Tkinter-discuss] Re: Tools for summarizing a module?

Stewart Midwinter stewart at midtoad.homelinux.org
Tue Mar 23 16:16:14 EST 2004


Ken, not sure if this is exactly what you need, but Pydoc is a very simple tool 
to use.  It will generate a series of HTML pages, one for each Python script in 
your folder tree. All you need to do is place your quoted doc strings as shown 
in the attached example file.   then, to view the documentation, you run pydoc 
in viewer mode and it launches a browser to show the pages.

cheers
-- 
Stewart Midwinter
Calgary, Alberta
stewart 'at' midwinter 'dot' ca


Quoting Kenneth McDonald <kmmcdonald at wisc.edu>:

> Before I start any documentation effort on Tkinter, I'd like to get
> a good idea of what's in there right now. Is there a good tool
> that will go through a module, and print out, in summary form,
> its functions, classes, methods, etc., with docstrings if present?
> If not, I'll write my own, but why waste effort if this has already
> been done?
-------------- next part --------------
#!/usr/bin/env python
# -*- coding: Latin-1 -*-
# =============================================================================c+
# company name and address
# Calgary, Alberta
# Canada  T2P 2V7
# Voice: 
# Web:   
#email: 
# 
# Copyright (C) company name  All Rights Reserved.
# 
# This software is subject to copyright protection under the laws of Canada and other countries.

# This software is the confidential and proprietary information of
# ...
# =============================================================================c-

'''The module configfilereader creates the class ConfigFileReconstructor,
   and provides methods for reading, converting and writing out the files associated with 
   the DDE interface.

   This module is called by the following modules:
   ddetransformer
   ''' 

'''Pychecker reports the following unresolved warnings:
cfr\configfilereconstructor_new.py:127: Statement appears to have no effect

   '''

'''Pychecher reports that the following modules are not used:
import errno, sys, os, traceback, exceptions
'''

import string
import cfr
import uti.csvreader

class ConfigFileReconstructor:
    '''The class ConfigFileReconstructor has methods for reading, converting and 
    writing out the files associated with the DDE interface'''
   
    def __init__(self, writeUSRFile = 1, ConfigFile='dde_out.usr'):
        '''Set the names of the dde input and output files, and the lwserver.usr file; 
           add some items to the configuration dictionary.'''
        self.__writeUSRFile = writeUSRFile
        self.__Config = ConfigFile
        self.__InputAliasDictionary = {}
        self.__OutputAliasDictionary = {}
        self.__LWSDictionary = {}
        self.__ConfigAliasInputAddDictionary = {}
        self.__ConfigAliasInputDeleteDictionary = {}
        self.__ConfigAliasOutputAddDictionary = {}
        self.__ConfigAliasOutputDeleteDictionary = {}
        self.__ConfigServerAddDictionary = {}
        self.__ConfigServerDeleteDictionary = {}
        self.__ConfigServerAddDictionary['AUXTrigger E I 1 -1'] = 'AUXTrigger E I 1 -1\n'
        # snip code
        return
        
    def readConfigFiles(self):
        '''Read the dde_out.usr file, determine action to take based on which of 
        (AE,DE, AO,DO, AI,DI) was specified, then parse the lines. 
        Also, read the dde_out.csv created by PCG and parse it.
        '''
        self._Ddeoutf = uti.CSVReader(self.__Ddeout,'r')
        self._Ddeinf = uti.CSVReader(self.__Ddein,'r')
        self._Lwserverf = uti.CSVReader(self.__Lwserver,'r')
        self._Configf = uti.CSVReader(self.__Config,'r')
        # Read in dde/database modification file
        # snip code
        return
        
    def convert(self):
        '''Convert lines based on type of command (AE,DE, AO,DO, AI,DI)
        '''
        # Delete points first so there is no confusion
        keys = self.__ConfigAliasInputDeleteDictionary.keys()
        print 'Process/Delete Input Alias Dictionary'
        for key in keys:
            self.__InputAliasDictionary[key] = None
        # snip code
        return
        
    def writeConfigFiles(self):
        '''write out dde_out.csv, dde_in.csv, lwserver.usr
        '''
        self._Ddeoutf = uti.CSVReader(self.__Ddeout,'w')
        lines = []
        # write out dde_out.csv
        keys = self.__InputAliasDictionary.keys()
        print 'Write',self.__Ddeout
        for key in keys:
            if (self.__InputAliasDictionary[key] != None):
                lines.append(self.__InputAliasDictionary[key])
        self._Ddeoutf.putlines(lines)
        self._Ddeoutf.close()
        # snip code
        return

cfr.ConfigFileReconstructor = ConfigFileReconstructor



More information about the Tkinter-discuss mailing list