[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.16,1.17

Ka-Ping Yee ping@users.sourceforge.net
Thu, 22 Mar 2001 16:12:55 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv25567

Modified Files:
	pydoc.py 
Log Message:
Fixes for various issues reported and discovered since Python 9:
Factor description of import errors into DocImportError.__str__.
Add "docother" and "fail" methods to Doc class.
Factor formatting of constants into "docother".
Increase max string repr limit to 100 characters.
Factor page generation into HTMLDoc.page.
Handle aliasing of names (objects appearing under an attribute
    name different from their intrinsic __name__) by passing the
    attribute name into each doc* method.
Handle methods at top level of modules (e.g. in random).
Try to do reloading efficiently.

Important fixes still to do:
    Module reloading is broken by the unfortunate property that
        failed imports leave an incomplete module in sys.  Still
        need to think of a good solution.
    Can't document modules in the current directory, due to the
        other unfortunate property that sys.path gets '.' when
        you run 'python' but it gets the script directory when
        you run a script.  Need to ponder to find a solution.
    The synopsis() routine does not work on .so modules.
    Aliases cause duplicate copies of documentation to appear.
        This is easy to fix, just more work.
    Classes appear as their intrinsic name, not their attribute name,
        in the class hierarchy.  This should be fixed.
    Inherited methods should be listed in class descriptions.



Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** pydoc.py	2001/03/16 08:29:47	1.16
--- pydoc.py	2001/03/23 00:12:53	1.17
***************
*** 5,26 ****
  help.  Calling help(thing) on a Python object documents the object.
  
! At the shell command line outside of Python:
!     Run "pydoc <name>" to show documentation on something.  <name> may be
!     the name of a function, module, package, or a dotted reference to a
!     class or function within a module or module in a package.  If the
!     argument contains a path segment delimiter (e.g. slash on Unix,
!     backslash on Windows) it is treated as the path to a Python source file.
! 
!     Run "pydoc -k <keyword>" to search for a keyword in the synopsis lines
[...1179 lines suppressed...]
              except DocImportError, value:
!                 print 'Problem in %s - %s' % (value.filename, value.args)
  
      except (getopt.error, BadUsage):
--- 1485,1499 ----
          for arg in args:
              try:
!                 if ispath(arg) and os.path.isfile(arg):
                      arg = importfile(arg)
!                 if writing:
!                     if ispath(arg) and os.path.isdir(arg):
!                         writedocs(arg)
!                     else:
!                         writedoc(arg)
!                 else:
!                     man(arg)
              except DocImportError, value:
!                 print value
  
      except (getopt.error, BadUsage):