]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Whitespace normalization.
authorTim Peters <tim.peters@gmail.com>
Mon, 7 Oct 2002 01:18:17 +0000 (01:18 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 7 Oct 2002 01:18:17 +0000 (01:18 +0000)
18 files changed:
Lib/ConfigParser.py
Lib/StringIO.py
Lib/fileinput.py
Lib/httplib.py
Lib/smtplib.py
Lib/tabnanny.py
Lib/test/pickletester.py
Lib/test/test_StringIO.py
Lib/test/test_cfgparser.py
Lib/test/test_generators.py
Lib/test/test_httplib.py
Lib/test/test_multifile.py
Lib/test/test_netrc.py
Lib/test/test_string.py
Lib/test/test_trace.py
Lib/test/test_urlparse.py
Lib/tokenize.py
Lib/urllib2.py

index 76bc7f601daa7b75cef75a90a7a926324686214b..2cfa5d391687db1b344e84c2cacf68431a93f67a 100644 (file)
@@ -282,7 +282,7 @@ class ConfigParser:
     def _interpolate(self, section, option, rawval, vars):
         # do the string interpolation
         value = rawval
-        depth = MAX_INTERPOLATION_DEPTH 
+        depth = MAX_INTERPOLATION_DEPTH
         while depth:                    # Loop through this until it's done
             depth -= 1
             if value.find("%(") != -1:
index 1111f908fc57c6482c4dc2c1595e6bf7c1cb949e..8f816cdd346f765709dcc3541a7fb2c313619161 100644 (file)
@@ -37,16 +37,16 @@ except ImportError:
 __all__ = ["StringIO"]
 
 class StringIO:
-    """class StringIO([buffer]) 
-    
+    """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 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. 
+    a UnicodeError to be raised when getvalue() is called.
     """
     def __init__(self, buf = ''):
         # Force self.buf to be a string or unicode
@@ -185,7 +185,7 @@ class StringIO:
         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. 
+        is called.
         """
         if self.buflist:
             self.buf += ''.join(self.buflist)
index bbd9781e7e6e3cf4a9d8214a17fc59cda0cc30fb..b3122617b3353efa0be02c0767c4d5773d350e0f 100644 (file)
@@ -94,7 +94,7 @@ def input(files=None, inplace=0, backup="", bufsize=0):
     Create an instance of the FileInput class. The instance will be used
     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. 
+    along to the constructor of the FileInput class.
     """
     global _state
     if _state and _state._file:
@@ -118,7 +118,7 @@ def nextfile():
     changed until after the first line of the next file has been read.
     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. 
+    last file has been read, this function has no effect.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -127,7 +127,7 @@ def nextfile():
 def filename():
     """
     Return the name of the file currently being read.
-    Before the first line has been read, returns None. 
+    Before the first line has been read, returns None.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -137,7 +137,7 @@ def lineno():
     """
     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. 
+    of the last file has been read, returns the line number of that line.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -147,7 +147,7 @@ def filelineno():
     """
     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. 
+    been read, returns the line number of that line within the file.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -156,7 +156,7 @@ def filelineno():
 def isfirstline():
     """
     Returns true the line just read is the first line of its file,
-    otherwise returns false. 
+    otherwise returns false.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -165,7 +165,7 @@ def isfirstline():
 def isstdin():
     """
     Returns true if the last line was read from sys.stdin,
-    otherwise returns false. 
+    otherwise returns false.
     """
     if not _state:
         raise RuntimeError, "no active input()"
@@ -173,14 +173,14 @@ def isstdin():
 
 class FileInput:
     """class FileInput([files[, inplace[, backup]]])
-    
+
     Class FileInput is the implementation of the module; its methods
     filename(), lineno(), fileline(), isfirstline(), isstdin(), nextfile()
     and close() correspond to the functions of the same name in the module.
     In addition it has a readline() method which returns the next
     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. 
+    sequential order; random access and readline() cannot be mixed.
     """
 
     def __init__(self, files=None, inplace=0, backup="", bufsize=0):
index e6dc898b2c70787a37c007a5e58bbcc648cfaf24..077fb255dc3b6f0c3d2acd521eef154300d102b5 100644 (file)
@@ -371,7 +371,7 @@ class HTTPResponse:
 
         if self.chunked:
             return self._read_chunked(amt)
-        
+
         if amt is None:
             # unbounded read
             if self.will_close:
@@ -441,7 +441,7 @@ class HTTPResponse:
         self.close()
 
         return value
-    
+
     def _safe_read(self, amt):
         """Read the number of bytes requested, compensating for partial reads.
 
index 1d0c1f5645c4c07572745c8d6258af1fd5d7febd..019228f187998eea85fa141a08fd08a92be11e7e 100755 (executable)
@@ -408,7 +408,7 @@ class SMTP:
                 self.esmtp_features["auth"] = self.esmtp_features.get("auth", "") \
                         + " " + auth_match.groups(0)[0]
                 continue
+
             # RFC 1869 requires a space between ehlo keyword and parameters.
             # It's actually stricter, in that only spaces are allowed between
             # parameters, but were not going to check for that here.  Note
@@ -524,7 +524,7 @@ class SMTP:
 
         def encode_plain(user, password):
             return encode_base64("%s\0%s\0%s" % (user, user, password), eol="")
+
 
         AUTH_PLAIN = "PLAIN"
         AUTH_CRAM_MD5 = "CRAM-MD5"
index ce1c4a425cee319cdcf33cdc09b9f8aa3e9f620a..6de9070b1082184b38d0bdcc9cb894b15cf6aeee 100755 (executable)
@@ -2,14 +2,14 @@
 
 """The Tab Nanny despises ambiguous indentation.  She knows no mercy.
 
-tabnanny -- Detection of ambiguous indentation 
+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. 
+check() described below.
 
 Warning: The API provided by this module is likely to change in future
-releases; such changes may not be backward compatible. 
+releases; such changes may not be backward compatible.
 """
 
 # Released to the public domain, by Tim Peters, 15 April 1998.
@@ -73,14 +73,14 @@ class NannyNag:
 
 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.     
+    written to standard output using the print statement.
     """
-    
+
     if os.path.isdir(file) and not os.path.islink(file):
         if verbose:
             print "%s: listing directory" % `file`
index e16428fa33a7a62f941535e536ed99fda5c3b33e..2576e8fba3ada3f12bcdfd81d2a2235ad4c3ec0f 100644 (file)
@@ -253,7 +253,7 @@ class AbstractPickleTests(unittest.TestCase):
         t = time.localtime()
         s = self.dumps(t)
         u = self.loads(s)
-        self.assertEqual(t, u)        
+        self.assertEqual(t, u)
         import os
         if hasattr(os, "stat"):
             t = os.stat(os.curdir)
index 79d2e738d61d8efaa3a737476ced72ad7ffe0dde..888f9c166428f7bff59e000874272ea12b220aef 100644 (file)
@@ -77,7 +77,7 @@ class TestStringIO(TestGenericStringIO):
             # The StringIO module also supports concatenating Unicode
             # snippets to larger Unicode strings. This is tested by this
             # method. Note that cStringIO does not support this extension.
-        
+
             f = self.MODULE.StringIO()
             f.write(self._line[:6])
             f.seek(3)
index 2c9587e069014e29b43a555d006d58360dc1d72a..491c0318e7fbb19479d4fc34069a9c019e34c647 100644 (file)
@@ -70,7 +70,7 @@ foo = another very
 foo = this line is much, much longer than my editor
         likes it.
 """)
-           
+
 def case_sensitivity():
     print "Testing case sensitivity..."
     cf = ConfigParser.ConfigParser()
index 410f043fd363a1ca2c8ad6a5082d36f02c5bc943..345bdc87b448aa2978db3abe5fc63bd09537027d 100644 (file)
@@ -816,7 +816,7 @@ This one caused a crash (see SF bug 567538):
 ...             continue
 ...         finally:
 ...             yield i
-... 
+...
 >>> g = f()
 >>> print g.next()
 0
index 09f92fc46a9f40e9f465a0377a1ad625a68902d2..f70abec7ea5400ea552689238d7b2dfeb9451ebd 100644 (file)
@@ -56,4 +56,3 @@ r.begin()
 cookies = r.getheader("Set-Cookie")
 if cookies != hdr:
     raise AssertionError, "multiple headers not combined properly"
-               
index 8f703477f34619400ad96ce676b1d5585aeaf497..6cb946f89926f2f118f5877198fad079f8e125d6 100644 (file)
@@ -4,12 +4,12 @@ import cStringIO
 
 msg = """Mime-Version: 1.0
 Content-Type: multipart/mixed;
-       boundary="=====================_590453667==_"
+        boundary="=====================_590453667==_"
 X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]
 
 --=====================_590453667==_
 Content-Type: multipart/alternative;
-       boundary="=====================_590453677==_.ALT"
+        boundary="=====================_590453677==_.ALT"
 
 --=====================_590453677==_.ALT
 Content-Type: text/plain; charset="us-ascii"; format=flowed
@@ -49,8 +49,8 @@ def getMIMEMsg(mf):
         boundaries += 1
 
         mf.push(boundary)
-        while mf.next(): 
-            getMIMEMsg(mf)     
+        while mf.next():
+            getMIMEMsg(mf)
         mf.pop()
     else:
         lines = mf.readlines()
index 5922fdc161cb0ff5da971f6152803b7498bc0030..2cf1ae4dcec910a9fad671a2a300d9e0115f52d6 100644 (file)
@@ -12,7 +12,7 @@ macdef macro2
 line3
 line4
 
-default login log2 password pass2 
+default login log2 password pass2
 
 """
 
@@ -25,7 +25,7 @@ class NetrcTestCase(unittest.TestCase):
         fp.write(TEST_NETRC)
         fp.close()
         self.netrc = netrc.netrc(temp_filename)
-        
+
     def tearDown (self):
         del self.netrc
         os.unlink(temp_filename)
@@ -36,8 +36,7 @@ class NetrcTestCase(unittest.TestCase):
                                            )
         self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1'))
         self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2'))
-            
-        
+
+
 if __name__ == "__main__":
     test_support.run_unittest(NetrcTestCase)
-
index 8f0ea47bd0a1396292d0186d28c876997eb4224b..cc61512a73e355250903b9258794310e09395e30 100644 (file)
@@ -38,7 +38,7 @@ def test(name, input, output, *args):
                 value = apply(f, (input,) + args)
             if value is input:
                 if verbose:
-                   print 'no'
+                    print 'no'
                 print '*',f, `input`, `output`, `value`
                 return
     if value != output:
index a0483ebce947aeabfacc386c5ab8e693ce965672..d61be828802cd4f2d2aea451c2ebb06a4a3ef0fb 100644 (file)
@@ -119,7 +119,7 @@ def _settrace_and_return(tracefunc):
     sys._getframe().f_back.f_trace = tracefunc
 def settrace_and_return(tracefunc):
     _settrace_and_return(tracefunc)
-    
+
 settrace_and_return.events = [(1, 'return')]
 
 def _settrace_and_raise(tracefunc):
@@ -131,7 +131,7 @@ def settrace_and_raise(tracefunc):
         _settrace_and_raise(tracefunc)
     except RuntimeError, exc:
         pass
-    
+
 settrace_and_raise.events = [(2, 'exception'),
                              (3, 'line'),
                              (4, 'line'),
@@ -146,14 +146,14 @@ class Tracer:
 
 class TraceTestCase(unittest.TestCase):
     def compare_events(self, line_offset, events, expected_events):
-        events = [(l - line_offset, e) for (l, e) in events]        
+        events = [(l - line_offset, e) for (l, e) in events]
         if events != expected_events:
             self.fail(
                 "events did not match expectation:\n" +
                 "\n".join(difflib.ndiff(map(str, expected_events),
                                         map(str, events))))
-        
-    
+
+
     def run_test(self, func):
         tracer = Tracer()
         sys.settrace(tracer.trace)
@@ -168,7 +168,7 @@ class TraceTestCase(unittest.TestCase):
         sys.settrace(None)
         self.compare_events(func.func_code.co_firstlineno,
                             tracer.events, func.events)
-    
+
     def test_1_basic(self):
         self.run_test(basic)
     def test_2_arigo(self):
@@ -206,7 +206,7 @@ class RaisingTraceFuncTestCase(unittest.TestCase):
                     self.fail("exception not thrown!")
         except RuntimeError:
             self.fail("recursion counter not reset")
-            
+
 
 def test_main():
     test_support.run_unittest(TraceTestCase)
index b0a38b585c7e98fe04a2b8fd14eb260d5af4da2a..7651afab85f7bd2bec7823cb36268af774a1b924 100644 (file)
@@ -12,8 +12,8 @@ for url, expected in [('http://www.python.org',
                        ('http', 'www.python.org', '/', '', '', 'abc')),
                       (RFC1808_BASE,
                        ('http', 'a', '/b/c/d', 'p', 'q', 'f')),
-                     ('file:///tmp/junk.txt',
-                      ('file', '', '/tmp/junk.txt', '', '', '')),
+                      ('file:///tmp/junk.txt',
+                       ('file', '', '/tmp/junk.txt', '', '', '')),
                       ]:
     result = urlparse.urlparse(url)
     print "%-13s = %r" % (url, result)
index 160482a042a1e1ae300c4377710334d45dd0fbb0..b64be8083202c39f75fd7c6c815a25b8c7e59040 100644 (file)
@@ -125,14 +125,14 @@ def tokenize(readline, tokeneater=printtoken):
     """
     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. 
+    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(). 
+    tuples generated by generate_tokens().
     """
     try:
         tokenize_loop(readline, tokeneater)
@@ -150,13 +150,13 @@ def generate_tokens(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 generator produces 5-tuples with these members: the token type; the
     token string; a 2-tuple (srow, scol) of ints specifying the row and
     column where the token begins in the source; a 2-tuple (erow, ecol) of
     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. 
+    logical line; continuation lines are included.
     """
     lnum = parenlev = continued = 0
     namechars, numchars = string.ascii_letters + '_', '0123456789'
index e9f2d52a9ed1b284a6d575c189ef9b4fe194cb08..479bab91a6598195c95a9205df9e8ae0976c0d2f 100644 (file)
@@ -458,7 +458,7 @@ class ProxyHandler(BaseHandler):
             user_pass, host = host.split('@', 1)
             if ':' in user_pass:
                 user, password = user_pass.split(':', 1)
-                user_pass = base64.encodestring('%s:%s' % (unquote(user), 
+                user_pass = base64.encodestring('%s:%s' % (unquote(user),
                                                            unquote(password)))
                 req.add_header('Proxy-Authorization', 'Basic ' + user_pass)
         host = unquote(host)