[Python-checkins] python/dist/src/Lib StringIO.py,1.25,1.26 fileinput.py,1.12,1.13 macpath.py,1.37,1.38 pickle.py,1.62,1.63 random.py,1.31,1.32 tabnanny.py,1.19,1.20 tokenize.py,1.31,1.32

tim_one@sourceforge.net tim_one@sourceforge.net
Thu, 23 May 2002 08:15:32 -0700


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

Modified Files:
	StringIO.py fileinput.py macpath.py pickle.py random.py 
	tabnanny.py tokenize.py 
Log Message:
Whitespace normalization.


Index: StringIO.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** StringIO.py	15 May 2002 02:56:03 -0000	1.25
--- StringIO.py	23 May 2002 15:15:29 -0000	1.26
***************
*** 38,51 ****
  
  class StringIO:
!     """class StringIO([buffer]) 
!     
      When a StringIO object is created, it can be initialized to an existing
      string by passing the string to the constructor. If no string is given,
!     the StringIO will start empty. 
  
      The StringIO object can accept either Unicode or 8-bit strings, but
      mixing the two may take some care. If both are used, 8-bit strings that
      cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause
!     a UnicodeError to be raised when getvalue() is called. 
      """
      def __init__(self, buf = ''):
--- 38,51 ----
  
  class StringIO:
!     """class StringIO([buffer])
! 
      When a StringIO object is created, it can be initialized to an existing
      string by passing the string to the constructor. If no string is given,
!     the StringIO will start empty.
  
      The StringIO object can accept either Unicode or 8-bit strings, but
      mixing the two may take some care. If both are used, 8-bit strings that
      cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause
!     a UnicodeError to be raised when getvalue() is called.
      """
      def __init__(self, buf = ''):
***************
*** 64,68 ****
  
      def close(self):
!         """Free the memory buffer. 
          """
          if not self.closed:
--- 64,68 ----
  
      def close(self):
!         """Free the memory buffer.
          """
          if not self.closed:
***************
*** 187,191 ****
          strings that cannot be interpreted as 7-bit ASCII (that use the
          8th bit) will cause a UnicodeError to be raised when getvalue()
!         is called. 
          """
          if self.buflist:
--- 187,191 ----
          strings that cannot be interpreted as 7-bit ASCII (that use the
          8th bit) will cause a UnicodeError to be raised when getvalue()
!         is called.
          """
          if self.buflist:

Index: fileinput.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/fileinput.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** fileinput.py	15 May 2002 02:56:03 -0000	1.12
--- fileinput.py	23 May 2002 15:15:29 -0000	1.13
***************
*** 95,99 ****
      as global state for the functions of this module, and is also returned
      to use during iteration. The parameters to this function will be passed
!     along to the constructor of the FileInput class. 
      """
      global _state
--- 95,99 ----
      as global state for the functions of this module, and is also returned
      to use during iteration. The parameters to this function will be passed
!     along to the constructor of the FileInput class.
      """
      global _state
***************
*** 119,123 ****
      Before the first line has been read, this function has no effect;
      it cannot be used to skip the first file. After the last line of the
!     last file has been read, this function has no effect. 
      """
      if not _state:
--- 119,123 ----
      Before the first line has been read, this function has no effect;
      it cannot be used to skip the first file. After the last line of the
!     last file has been read, this function has no effect.
      """
      if not _state:
***************
*** 128,132 ****
      """
      Return the name of the file currently being read.
!     Before the first line has been read, returns None. 
      """
      if not _state:
--- 128,132 ----
      """
      Return the name of the file currently being read.
!     Before the first line has been read, returns None.
      """
      if not _state:
***************
*** 138,142 ****
      Return the cumulative line number of the line that has just been read.
      Before the first line has been read, returns 0. After the last line
!     of the last file has been read, returns the line number of that line. 
      """
      if not _state:
--- 138,142 ----
      Return the cumulative line number of the line that has just been read.
      Before the first line has been read, returns 0. After the last line
!     of the last file has been read, returns the line number of that line.
      """
      if not _state:
***************
*** 148,152 ****
      Return the line number in the current file. Before the first line
      has been read, returns 0. After the last line of the last file has
!     been read, returns the line number of that line within the file. 
      """
      if not _state:
--- 148,152 ----
      Return the line number in the current file. Before the first line
      has been read, returns 0. After the last line of the last file has
!     been read, returns the line number of that line within the file.
      """
      if not _state:
***************
*** 157,161 ****
      """
      Returns true the line just read is the first line of its file,
!     otherwise returns false. 
      """
      if not _state:
--- 157,161 ----
      """
      Returns true the line just read is the first line of its file,
!     otherwise returns false.
      """
      if not _state:
***************
*** 166,170 ****
      """
      Returns true if the last line was read from sys.stdin,
!     otherwise returns false. 
      """
      if not _state:
--- 166,170 ----
      """
      Returns true if the last line was read from sys.stdin,
!     otherwise returns false.
      """
      if not _state:
***************
*** 174,178 ****
  class FileInput:
      """class FileInput([files[, inplace[, backup]]])
!     
      Class FileInput is the implementation of the module; its methods
      filename(), lineno(), fileline(), isfirstline(), isstdin(), nextfile()
--- 174,178 ----
  class FileInput:
      """class FileInput([files[, inplace[, backup]]])
! 
      Class FileInput is the implementation of the module; its methods
      filename(), lineno(), fileline(), isfirstline(), isstdin(), nextfile()
***************
*** 181,185 ****
      input line, and a __getitem__() method which implements the
      sequence behavior. The sequence must be accessed in strictly
!     sequential order; random access and readline() cannot be mixed. 
      """
  
--- 181,185 ----
      input line, and a __getitem__() method which implements the
      sequence behavior. The sequence must be accessed in strictly
!     sequential order; random access and readline() cannot be mixed.
      """
  

Index: macpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** macpath.py	23 Apr 2002 02:38:39 -0000	1.37
--- macpath.py	23 May 2002 15:15:29 -0000	1.38
***************
*** 239,253 ****
  # realpath is a no-op on systems without islink support
  def realpath(path):
! 	path = abspath(path)
! 	try:
! 		import macfs
! 	except ImportError:
! 		return path
! 	if not path:
! 		return path
! 	components = path.split(':')
! 	path = components[0] + ':'
! 	for c in components[1:]:
! 		path = join(path, c)
! 		path = macfs.ResolveAliasFile(path)[0].as_pathname()
! 	return path
--- 239,253 ----
  # realpath is a no-op on systems without islink support
  def realpath(path):
!     path = abspath(path)
!     try:
!         import macfs
!     except ImportError:
!         return path
!     if not path:
!         return path
!     components = path.split(':')
!     path = components[0] + ':'
!     for c in components[1:]:
!         path = join(path, c)
!         path = macfs.ResolveAliasFile(path)[0].as_pathname()
!     return path

Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** pickle.py	21 May 2002 17:22:02 -0000	1.62
--- pickle.py	23 May 2002 15:15:29 -0000	1.63
***************
*** 866,870 ****
              warnings.warn("The None return argument form of __reduce__  is "
                            "deprecated. Return a tuple of arguments instead.",
!                           DeprecationWarning)            
              value = callable.__basicnew__()
          else:
--- 866,870 ----
              warnings.warn("The None return argument form of __reduce__  is "
                            "deprecated. Return a tuple of arguments instead.",
!                           DeprecationWarning)
              value = callable.__basicnew__()
          else:

Index: random.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** random.py	14 May 2002 14:08:12 -0000	1.31
--- random.py	23 May 2002 15:15:29 -0000	1.32
***************
*** 446,457 ****
  
      def gammavariate(self, alpha, beta):
!         
          # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2
!         
          # Warning: a few older sources define the gamma distribution in terms
          # of alpha > -1.0
          if alpha <= 0.0 or beta <= 0.0:
              raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
!         
          random = self.random
          if alpha > 1.0:
--- 446,457 ----
  
      def gammavariate(self, alpha, beta):
! 
          # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2
! 
          # Warning: a few older sources define the gamma distribution in terms
          # of alpha > -1.0
          if alpha <= 0.0 or beta <= 0.0:
              raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
! 
          random = self.random
          if alpha > 1.0:
***************
*** 464,468 ****
              bbb = alpha - LOG4
              ccc = alpha + ainv
!             
              while 1:
                  u1 = random()
--- 464,468 ----
              bbb = alpha - LOG4
              ccc = alpha + ainv
! 
              while 1:
                  u1 = random()
***************
*** 631,635 ****
      _test_generator(N, 'gammavariate(0.01, 1.0)')
      _test_generator(N, 'gammavariate(0.1, 1.0)')
!     _test_generator(N, 'gammavariate(0.1, 2.0)')    
      _test_generator(N, 'gammavariate(0.5, 1.0)')
      _test_generator(N, 'gammavariate(0.9, 1.0)')
--- 631,635 ----
      _test_generator(N, 'gammavariate(0.01, 1.0)')
      _test_generator(N, 'gammavariate(0.1, 1.0)')
!     _test_generator(N, 'gammavariate(0.1, 2.0)')
      _test_generator(N, 'gammavariate(0.5, 1.0)')
      _test_generator(N, 'gammavariate(0.9, 1.0)')

Index: tabnanny.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tabnanny.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** tabnanny.py	15 May 2002 02:56:03 -0000	1.19
--- tabnanny.py	23 May 2002 15:15:29 -0000	1.20
***************
*** 3,14 ****
  """The Tab Nanny despises ambiguous indentation.  She knows no mercy.
  
! tabnanny -- Detection of ambiguous indentation 
  
  For the time being this module is intended to be called as a script.
  However it is possible to import it into an IDE and use the function
! check() described below. 
  
  Warning: The API provided by this module is likely to change in future
! releases; such changes may not be backward compatible. 
  """
  
--- 3,14 ----
  """The Tab Nanny despises ambiguous indentation.  She knows no mercy.
  
! tabnanny -- Detection of ambiguous indentation
  
  For the time being this module is intended to be called as a script.
  However it is possible to import it into an IDE and use the function
! check() described below.
  
  Warning: The API provided by this module is likely to change in future
! releases; such changes may not be backward compatible.
  """
  
***************
*** 61,65 ****
      """
      Raised by tokeneater() if detecting an ambiguous indent.
!     Captured and handled in check(). 
      """
      def __init__(self, lineno, msg, line):
--- 61,65 ----
      """
      Raised by tokeneater() if detecting an ambiguous indent.
!     Captured and handled in check().
      """
      def __init__(self, lineno, msg, line):
***************
*** 74,85 ****
  def check(file):
      """check(file_or_dir)
!     
      If file_or_dir is a directory and not a symbolic link, then recursively
      descend the directory tree named by file_or_dir, checking all .py files
      along the way. If file_or_dir is an ordinary Python source file, it is
      checked for whitespace related problems. The diagnostic messages are
!     written to standard output using the print statement.     
      """
!     
      if os.path.isdir(file) and not os.path.islink(file):
          if verbose:
--- 74,85 ----
  def check(file):
      """check(file_or_dir)
! 
      If file_or_dir is a directory and not a symbolic link, then recursively
      descend the directory tree named by file_or_dir, checking all .py files
      along the way. If file_or_dir is an ordinary Python source file, it is
      checked for whitespace related problems. The diagnostic messages are
!     written to standard output using the print statement.
      """
! 
      if os.path.isdir(file) and not os.path.islink(file):
          if verbose:

Index: tokenize.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tokenize.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** tokenize.py	15 May 2002 02:56:03 -0000	1.31
--- tokenize.py	23 May 2002 15:15:29 -0000	1.32
***************
*** 125,136 ****
      The tokenize() function accepts two parameters: one representing the
      input stream, and one providing an output mechanism for tokenize().
!     
      The first parameter, readline, must be a callable object which provides
      the same interface as the readline() method of built-in file objects.
!     Each call to the function should return one line of input as a string. 
  
      The second parameter, tokeneater, must also be a callable object. It is
      called once for each token, with five arguments, corresponding to the
!     tuples generated by generate_tokens(). 
      """
      try:
--- 125,136 ----
      The tokenize() function accepts two parameters: one representing the
      input stream, and one providing an output mechanism for tokenize().
! 
      The first parameter, readline, must be a callable object which provides
      the same interface as the readline() method of built-in file objects.
!     Each call to the function should return one line of input as a string.
  
      The second parameter, tokeneater, must also be a callable object. It is
      called once for each token, with five arguments, corresponding to the
!     tuples generated by generate_tokens().
      """
      try:
***************
*** 150,154 ****
      readline() method of built-in file objects. Each call to the function
      should return one line of input as a string.
!     
      The generator produces 5-tuples with these members: the token type; the
      token string; a 2-tuple (srow, scol) of ints specifying the row and
--- 150,154 ----
      readline() method of built-in file objects. Each call to the function
      should return one line of input as a string.
! 
      The generator produces 5-tuples with these members: the token type; the
      token string; a 2-tuple (srow, scol) of ints specifying the row and
***************
*** 156,160 ****
      ints specifying the row and column where the token ends in the source;
      and the line on which the token was found. The line passed is the
!     logical line; continuation lines are included. 
      """
      lnum = parenlev = continued = 0
--- 156,160 ----
      ints specifying the row and column where the token ends in the source;
      and the line on which the token was found. The line passed is the
!     logical line; continuation lines are included.
      """
      lnum = parenlev = continued = 0