[Python-checkins] python/dist/src/Lib formatter.py,1.19,1.19.16.1

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Wed, 29 May 2002 16:24:14 -0700


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

Modified Files:
      Tag: release22-maint
	formatter.py 
Log Message:
Backport change to 1.18 adding docstrings

Index: formatter.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v
retrieving revision 1.19
retrieving revision 1.19.16.1
diff -C2 -d -r1.19 -r1.19.16.1
*** formatter.py	13 Aug 2001 14:55:17 -0000	1.19
--- formatter.py	29 May 2002 23:24:12 -0000	1.19.16.1
***************
*** 28,31 ****
--- 28,40 ----
  
  class NullFormatter:
+     """A formatter which does nothing.
+ 
+     If the writer parameter is omitted, a NullWriter instance is created.
+     No methods of the writer are called by NullFormatter instances.
+ 
+     Implementations should inherit from this class if implementing a writer
+     interface but don't need to inherit any implementation.
+ 
+     """
  
      def __init__(self, writer=None):
***************
*** 53,56 ****
--- 62,72 ----
  
  class AbstractFormatter:
+     """The standard formatter.
+ 
+     This implementation has demonstrated wide applicability to many writers,
+     and may be used directly in most circumstances.  It has been used to
+     implement a full-featured World Wide Web browser.
+ 
+     """
  
      #  Space handling policy:  blank spaces at the boundary between elements
***************
*** 284,288 ****
  
  class NullWriter:
!     """Minimal writer interface to use in testing & inheritance."""
      def __init__(self): pass
      def flush(self): pass
--- 300,310 ----
  
  class NullWriter:
!     """Minimal writer interface to use in testing & inheritance.
! 
!     A writer which only provides the interface definition; no actions are
!     taken on any methods.  This should be the base class for all writers
!     which do not need to inherit any implementation methods.
! 
!     """
      def __init__(self): pass
      def flush(self): pass
***************
*** 301,304 ****
--- 323,332 ----
  
  class AbstractWriter(NullWriter):
+     """A writer which can be used in debugging formatters, but not much else.
+ 
+     Each method simply announces itself by printing its name and
+     arguments on standard output.
+ 
+     """
  
      def new_alignment(self, align):
***************
*** 337,340 ****
--- 365,375 ----
  
  class DumbWriter(NullWriter):
+     """Simple writer class which writes output on the file object passed in
+     as the file parameter or, if file is omitted, on standard output.  The
+     output is simply word-wrapped to the number of columns specified by
+     the maxcol parameter.  This class is suitable for reflowing a sequence
+     of paragraphs.
+ 
+     """
  
      def __init__(self, file=None, maxcol=72):