]> granicus.if.org Git - python/commitdiff
Whitespace normalization.
authorTim Peters <tim.peters@gmail.com>
Thu, 4 Oct 2001 05:36:56 +0000 (05:36 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 4 Oct 2001 05:36:56 +0000 (05:36 +0000)
18 files changed:
Lib/difflib.py
Lib/email/Encoders.py
Lib/email/Errors.py
Lib/email/Generator.py
Lib/email/Iterators.py
Lib/email/MIMEBase.py
Lib/email/MIMEImage.py
Lib/email/MIMEMessage.py
Lib/email/MIMEText.py
Lib/email/Message.py
Lib/email/Parser.py
Lib/email/Utils.py
Lib/email/__init__.py
Lib/quopri.py
Lib/test/test_email.py
Lib/test/test_iter.py
Lib/test/test_profile.py
Lib/test/test_unicode.py

index 8493503e6f4c5efa94584bcad441dccfb72946f1..a2689f406f2ede83bce18ebbbc580c282b772c90 100644 (file)
@@ -946,7 +946,7 @@ class Differ:
 
         yield "- " + aline
         if atags:
-             yield "? %s%s\n" % ("\t" * common, atags)
+            yield "? %s%s\n" % ("\t" * common, atags)
 
         yield "+ " + bline
         if btags:
index d9cd42d45cb03e9dca9baa0e8c35bbc7694a8fd8..0425e5c8475880366ebcd7cb6f7476426cfb422f 100644 (file)
@@ -8,7 +8,7 @@ import base64
 from quopri import encodestring as _encodestring
 
 
-\f
+
 # Helpers
 def _qencode(s):
     return _encodestring(s, quotetabs=1)
@@ -26,7 +26,7 @@ def _bencode(s):
     return value
 
 
-\f
+
 def encode_base64(msg):
     """Encode the message's payload in Base64.
 
@@ -38,7 +38,7 @@ def encode_base64(msg):
     msg['Content-Transfer-Encoding'] = 'base64'
 
 
-\f
+
 def encode_quopri(msg):
     """Encode the message's payload in Quoted-Printable.
 
@@ -50,7 +50,7 @@ def encode_quopri(msg):
     msg['Content-Transfer-Encoding'] = 'quoted-printable'
 
 
-\f
+
 def encode_7or8bit(msg):
     """Set the Content-Transfer-Encoding: header to 7bit or 8bit."""
     orig = msg.get_payload()
@@ -64,6 +64,6 @@ def encode_7or8bit(msg):
         msg['Content-Transfer-Encoding'] = '7bit'
 
 
-\f
+
 def encode_noop(msg):
     """Do nothing."""
index 71d7663c34714e43b8566259bffef0d7a9585bf7..5a1e0febd17c4223476f0f2144c27b2b46f53e76 100644 (file)
@@ -5,7 +5,7 @@
 """
 
 
-\f
+
 class MessageError(Exception):
     """Base class for errors in this module."""
 
index c31dc803ec7de694a7ead0af14b34fe138f9b374..476e9e7e6a3106e7676e17b59619e374260ddf15 100644 (file)
@@ -25,7 +25,7 @@ SPACE8 = ' ' * 8
 fcre = re.compile(r'^From ', re.MULTILINE)
 
 
-\f
+
 class Generator:
     """Generates output from a Message object tree.
 
@@ -278,7 +278,7 @@ class Generator:
         self._fp.write(s.getvalue())
 
 
-\f
+
 class DecodedGenerator(Generator):
     """Generator a text representation of a message.
 
@@ -334,7 +334,7 @@ class DecodedGenerator(Generator):
                     }
 
 
-\f
+
 # Helper
 def _make_boundary(self, text=None):
     # Craft a random boundary.  If text is given, ensure that the chosen
index d1ee53fe2d0837c62340172ffdfbfc43d020fb3c..cd08f37dee6abe6b4e0db5ede67fe25c0d841942 100644 (file)
@@ -9,7 +9,7 @@ from cStringIO import StringIO
 from types import StringType
 
 
-\f
+
 def body_line_iterator(msg):
     """Iterate over the parts, returning string payloads line-by-line."""
     for subpart in msg.walk():
@@ -19,7 +19,7 @@ def body_line_iterator(msg):
                 yield line
 
 
-\f
+
 def typed_subpart_iterator(msg, maintype='text', subtype=None):
     """Iterate over the subparts with a given MIME type.
 
index 33216f6acb5e318c1368344091f9f625ff81130c..c4ff3037a35161c426205a8ee055e1dd75dbc0f5 100644 (file)
@@ -7,7 +7,7 @@
 import Message
 
 
-\f
+
 class MIMEBase(Message.Message):
     """Base class for MIME specializations."""
 
index 963da23a2de8a2f475f660958b6cd21479746d7d..5c28cfde1e7eef447688e7a24cf1f25f876ab638 100644 (file)
@@ -12,7 +12,7 @@ import Errors
 import Encoders
 
 
-\f
+
 class MIMEImage(MIMEBase.MIMEBase):
     """Class for generating image/* type MIME documents."""
 
index fc4b2c6bdc9a507c7b8e630a5b9b91301881e1bb..11bdb3bcb7e307d249e13041e07b32542aa8e990 100644 (file)
@@ -8,7 +8,7 @@ import Message
 import MIMEBase
 
 
-\f
+
 class MIMEMessage(MIMEBase.MIMEBase):
     """Class representing message/* MIME documents."""
 
index ccce9fb5b1a3d2137bc68c7c380a534f1dc6e555..b0995980f3d86072cab8fdf98e11ea0cad9e5396 100644 (file)
@@ -8,7 +8,7 @@ import MIMEBase
 from Encoders import encode_7or8bit
 
 
-\f
+
 class MIMEText(MIMEBase.MIMEBase):
     """Class for generating text/* type MIME documents."""
 
index 5822bad89d8737ba019a2f571b20afff74caaa50..d03b43f58c540ac8fd79fa7ec93f630ad84cd0c1 100644 (file)
@@ -20,7 +20,7 @@ SEMISPACE = '; '
 paramre = re.compile(r';\s*')
 
 
-\f
+
 class Message:
     """Basic message object for use inside the object tree.
 
@@ -430,7 +430,7 @@ class Message:
 
     def get_charsets(self, failobj=None):
         """Return a list containing the charset(s) used in this message.
-    
+
         The returned list of items describes the Content-Type: headers'
         charset parameter for this message and all the subparts in its
         payload.
index 81763dc0068eebca198a95d0b510b4bd9e71c42f..e8a3b9272588f7e2583c21982cdaa2430f216157 100644 (file)
@@ -14,7 +14,7 @@ EMPTYSTRING = ''
 NL = '\n'
 
 
-\f
+
 class Parser:
     def __init__(self, _class=Message.Message):
         """Parser of RFC 2822 and MIME email messages.
index 6bbf2d35cb14657630f08ffe8ba10c1bc7e409ab..e75dae1046efcd0ca3f1674c28f728477d8c2e53 100644 (file)
@@ -21,7 +21,7 @@ COMMASPACE = ', '
 UEMPTYSTRING = u''
 
 
-\f
+
 # Helpers
 
 def _identity(s):
@@ -42,7 +42,7 @@ def _bdecode(s):
     return value
 
 
-\f
+
 def getaddresses(fieldvalues):
     """Return a list of (REALNAME, EMAIL) for each fieldvalue."""
     all = COMMASPACE.join(fieldvalues)
@@ -50,7 +50,7 @@ def getaddresses(fieldvalues):
     return a.getaddrlist()
 
 
-\f
+
 ecre = re.compile(r'''
   =\?                   # literal =?
   (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
@@ -92,7 +92,7 @@ def decode(s):
     return UEMPTYSTRING.join(rtn)
 
 
-\f
+
 def encode(s, charset='iso-8859-1', encoding='q'):
     """Encode a string according to RFC 2047."""
     if encoding.lower() == 'q':
index 499511400851e96aaf4e4aab5305958abe325c9e..8ca8d02cfdf2dee60e3d8c81769c7fcacc30db1e 100644 (file)
@@ -22,7 +22,7 @@ __all__ = ['Encoders',
            ]
 
 
-\f
+
 # Some convenience routines
 from Parser import Parser as _Parser
 from Message import Message as _Message
index 0425735603ddf49de42a10e637afcefe208e06e8..6d7cdd613fd71392961836388637bfe1117d7f24 100755 (executable)
@@ -12,10 +12,10 @@ HEX = '0123456789ABCDEF'
 EMPTYSTRING = ''
 
 try:
-  from binascii import a2b_qp, b2a_qp
+    from binascii import a2b_qp, b2a_qp
 except:
-  a2b_qp = None
-  b2a_qp = None
+    a2b_qp = None
+    b2a_qp = None
 
 
 def needsquoting(c, quotetabs, header):
@@ -28,7 +28,7 @@ def needsquoting(c, quotetabs, header):
     if c in ' \t':
         return quotetabs
     # if header, we have to escape _ because _ is used to escape space
-    if c == '_': 
+    if c == '_':
         return header
     return c == ESCAPE or not (' ' <= c <= '~')
 
@@ -55,7 +55,7 @@ def encode(input, output, quotetabs, header = 0):
         odata = b2a_qp(data, quotetabs = quotetabs, header = header)
         output.write(odata)
         return
-      
+
     def write(s, output=output, lineEnd='\n'):
         # RFC 1521 requires that the line ending in a space or tab must have
         # that trailing character encoded.
index 1c5add0fe84a6483630766b20c26d1a632a1c389..96facd63218415cf4d153503aa26a31cbdac3d34 100644 (file)
@@ -28,14 +28,14 @@ NL = '\n'
 EMPTYSTRING = ''
 
 
-\f
+
 def openfile(filename):
     path = os.path.join(os.path.dirname(test.regrtest.__file__),
                         'data', filename)
     return open(path)
 
 
-\f
+
 # Base test class
 class TestEmailBase(unittest.TestCase):
     def _msgobj(self, filename):
@@ -47,12 +47,12 @@ class TestEmailBase(unittest.TestCase):
         return msg
 
 
-\f
+
 # Test various aspects of the Message class's API
 class TestMessageAPI(TestEmailBase):
     def test_get_charsets(self):
         eq = self.assertEqual
-        
+
         msg = self._msgobj('msg_08.txt')
         charsets = msg.get_charsets()
         eq(charsets, [None, 'us-ascii', 'iso-8859-1', 'iso-8859-2', 'koi8-r'])
@@ -175,7 +175,7 @@ class TestMessageAPI(TestEmailBase):
         msg = email.message_from_string(
         "Content-Disposition: blarg; filename\n")
         self.assertEqual(msg.get_filename(), '')
-        
+
     def test_missing_boundary(self):
         msg = email.message_from_string("From: foo\n")
         self.assertEqual(msg.get_boundary(), None)
@@ -217,7 +217,7 @@ class TestMessageAPI(TestEmailBase):
         self.failIf(msg.has_key('headeri'))
 
 
-\f
+
 # Test the email.Encoders module
 class TestEncoders(unittest.TestCase):
     def test_encode_noop(self):
@@ -254,7 +254,7 @@ class TestEncoders(unittest.TestCase):
         eq(msg['content-transfer-encoding'], 'quoted-printable')
 
 
-\f
+
 class TestLongHeaders(unittest.TestCase):
     def test_header_splitter(self):
         msg = MIMEText('')
@@ -271,12 +271,12 @@ Content-Type: text/plain; charset="us-ascii"
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit
 X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
-       spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
+        spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
 
 ''')
 
 
-\f
+
 class TestFromMangling(unittest.TestCase):
     def setUp(self):
         self.msg = Message()
@@ -309,7 +309,7 @@ Blah blah blah
 """)
 
 
-\f
+
 # Test the basic MIMEImage class
 class TestMIMEImage(unittest.TestCase):
     def setUp(self):
@@ -362,7 +362,7 @@ class TestMIMEImage(unittest.TestCase):
                                   header='foobar') is missing)
 
 
-\f
+
 # Test the basic MIMEText class
 class TestMIMEText(unittest.TestCase):
     def setUp(self):
@@ -383,7 +383,7 @@ class TestMIMEText(unittest.TestCase):
         self.failUnless(not self._msg.is_multipart())
 
 
-\f
+
 class TestMultipartMixed(unittest.TestCase):
     def setUp(self):
         fp = openfile('PyBanner048.gif')
@@ -406,7 +406,7 @@ This is the dingus fish.
         container['From'] = 'Barry <barry@digicool.com>'
         container['To'] = 'Dingus Lovers <cravindogs@cravindogs.com>'
         container['Subject'] = 'Here is your dingus fish'
-        
+
         now = 987809702.54848599
         timetuple = time.localtime(now)
         if timetuple[-1] == 0:
@@ -445,7 +445,7 @@ This is the dingus fish.
         unless(not m1.is_multipart())
 
 
-\f
+
 class TestNonConformant(TestEmailBase):
     def test_parse_missing_minor_type(self):
         eq = self.assertEqual
@@ -466,7 +466,7 @@ class TestNonConformant(TestEmailBase):
         self.assertRaises(Errors.BoundaryError, p.parsestr, data)
 
 
-\f
+
 class TestRFC2047(unittest.TestCase):
     def test_iso_8859_1(self):
         eq = self.assertEqual
@@ -497,7 +497,7 @@ class TestRFC2047(unittest.TestCase):
            '=?iso-8859-2?b?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=')
 
 
-\f
+
 class TestMIMEMessage(TestEmailBase):
     def setUp(self):
         fp = openfile('msg_11.txt')
@@ -603,7 +603,7 @@ Your message cannot be delivered to the following recipients:
            '<002001c144a6$8752e060$56104586@oxy.edu>')
 
 
-\f
+
 class TestIdempotent(unittest.TestCase):
     def _msgobj(self, filename):
         fp = openfile(filename)
@@ -652,7 +652,7 @@ class TestIdempotent(unittest.TestCase):
     def test_mixed_with_image(self):
         msg, text = self._msgobj('msg_06.txt')
         self._idempotent(msg, text)
-    
+
     def test_multipart_report(self):
         msg, text = self._msgobj('msg_05.txt')
         self._idempotent(msg, text)
@@ -660,7 +660,7 @@ class TestIdempotent(unittest.TestCase):
     def test_dsn(self):
         msg, text = self._msgobj('msg_16.txt')
         self._idempotent(msg, text)
-        
+
     def test_content_type(self):
         eq = self.assertEquals
         # Get a message object and reset the seek pointer for other tests
@@ -701,9 +701,9 @@ class TestIdempotent(unittest.TestCase):
         eq(msg1.get_type(), 'text/plain')
         self.failUnless(isinstance(msg1.get_payload(), StringType))
         eq(msg1.get_payload(), '\n')
-        
 
-\f
+
+
 class TestMiscellaneous(unittest.TestCase):
     def test_message_from_string(self):
         fp = openfile('msg_01.txt')
@@ -744,7 +744,7 @@ class TestMiscellaneous(unittest.TestCase):
         # Create a subclass
         class MyMessage(Message):
             pass
-        
+
         msg = email.message_from_string(text, MyMessage)
         unless(isinstance(msg, MyMessage))
         # Try something more complicated
@@ -763,7 +763,7 @@ class TestMiscellaneous(unittest.TestCase):
         # Create a subclass
         class MyMessage(Message):
             pass
-        
+
         fp = openfile('msg_01.txt')
         try:
             msg = email.message_from_file(fp, MyMessage)
@@ -780,7 +780,7 @@ class TestMiscellaneous(unittest.TestCase):
             unless(isinstance(subpart, MyMessage))
 
 
-\f
+
 class TestIterators(TestEmailBase):
     def test_body_line_iterator(self):
         eq = self.assertEqual
@@ -801,15 +801,15 @@ class TestIterators(TestEmailBase):
         eq(len(lines), 43)
         eq(EMPTYSTRING.join(lines), """\
 Send Ppp mailing list submissions to
-       ppp@zzz.org
+        ppp@zzz.org
 
 To subscribe or unsubscribe via the World Wide Web, visit
-       http://www.zzz.org/mailman/listinfo/ppp
+        http://www.zzz.org/mailman/listinfo/ppp
 or, via email, send a message with subject or body 'help' to
-       ppp-request@zzz.org
+        ppp-request@zzz.org
 
 You can reach the person managing the list at
-       ppp-admin@zzz.org
+        ppp-admin@zzz.org
 
 When replying, please edit your Subject line so it is more specific
 than "Re: Contents of Ppp digest..."
@@ -863,7 +863,7 @@ to reflect upon our own
 """)
 
 
-\f
+
 def suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(TestMessageAPI))
@@ -882,7 +882,7 @@ def suite():
     return suite
 
 
-\f
+
 if __name__ == '__main__':
     unittest.main(defaultTest='suite')
 else:
index 257b61d8931e94ea5cfc4d5ec446c5e82a16f5ee..5bd7ba44a5bec54f1dbd85300b5b56eaf1c23aed 100644 (file)
@@ -648,7 +648,7 @@ class TestCase(unittest.TestCase):
         try:
             self.assertRaises(TypeError, f.writelines, None)
             self.assertRaises(TypeError, f.writelines, 42)
-    
+
             f.writelines(["1\n", "2\n"])
             f.writelines(("3\n", "4\n"))
             f.writelines({'5\n': None})
@@ -678,14 +678,14 @@ class TestCase(unittest.TestCase):
 
                 def __iter__(self):
                     return Iterator(self.start, self.finish)
-                    
-            f.writelines(Whatever(6, 6+2000))            
+
+            f.writelines(Whatever(6, 6+2000))
             f.close()
 
             f = file(TESTFN)
             expected = [str(i) + "\n" for i in range(1, 2006)]
             self.assertEqual(list(f), expected)
-            
+
         finally:
             f.close()
             try:
index 460d56fdfabd9d791a01d8c70ca04fcaf8553ff1..6ff5811817e11da42d5850072579132385dcf1b0 100644 (file)
@@ -7,7 +7,7 @@ import profile
 # (We can't use a helper function increment the timer since it would be
 # included in the profile and would appear to consume all the time.)
 ticks = 0
-    
+
 def test_main():
     global ticks
     ticks = 0
index b0d024b16fa77f353d98217caa3e583717cfd28f..68eae13115d2a3a6072c48183f61490fe35d873a 100644 (file)
@@ -409,7 +409,7 @@ utfTests = [(u'A\u2262\u0391.', 'A+ImIDkQ.'),  # RFC2152 example
 for x,y in utfTests:
     verify( x.encode('utf-7') == y )
 
-try:        
+try:
     unicode('+3ADYAA-', 'utf-7') # surrogates not supported
 except UnicodeError:
     pass