[Python-checkins] r65449 - in python/trunk/Lib/email: base64mime.py charset.py generator.py header.py message.py quoprimime.py

brett.cannon python-checkins at python.org
Mon Aug 4 01:27:32 CEST 2008


Author: brett.cannon
Date: Mon Aug  4 01:27:32 2008
New Revision: 65449

Log:
Remove Barry's love of deprecated syntax to silence warnings in the email
package, when run under -3, about using <>.


Modified:
   python/trunk/Lib/email/base64mime.py
   python/trunk/Lib/email/charset.py
   python/trunk/Lib/email/generator.py
   python/trunk/Lib/email/header.py
   python/trunk/Lib/email/message.py
   python/trunk/Lib/email/quoprimime.py

Modified: python/trunk/Lib/email/base64mime.py
==============================================================================
--- python/trunk/Lib/email/base64mime.py	(original)
+++ python/trunk/Lib/email/base64mime.py	Mon Aug  4 01:27:32 2008
@@ -145,7 +145,7 @@
         # BAW: should encode() inherit b2a_base64()'s dubious behavior in
         # adding a newline to the encoded string?
         enc = b2a_base64(s[i:i + max_unencoded])
-        if enc.endswith(NL) and eol <> NL:
+        if enc.endswith(NL) and eol != NL:
             enc = enc[:-1] + eol
         encvec.append(enc)
     return EMPTYSTRING.join(encvec)

Modified: python/trunk/Lib/email/charset.py
==============================================================================
--- python/trunk/Lib/email/charset.py	(original)
+++ python/trunk/Lib/email/charset.py	Mon Aug  4 01:27:32 2008
@@ -253,7 +253,7 @@
         Returns "base64" if self.body_encoding is BASE64.
         Returns "7bit" otherwise.
         """
-        assert self.body_encoding <> SHORTEST
+        assert self.body_encoding != SHORTEST
         if self.body_encoding == QP:
             return 'quoted-printable'
         elif self.body_encoding == BASE64:
@@ -263,7 +263,7 @@
 
     def convert(self, s):
         """Convert a string from the input_codec to the output_codec."""
-        if self.input_codec <> self.output_codec:
+        if self.input_codec != self.output_codec:
             return unicode(s, self.input_codec).encode(self.output_codec)
         else:
             return s

Modified: python/trunk/Lib/email/generator.py
==============================================================================
--- python/trunk/Lib/email/generator.py	(original)
+++ python/trunk/Lib/email/generator.py	Mon Aug  4 01:27:32 2008
@@ -211,7 +211,7 @@
         # doesn't preserve newlines/continuations in headers.  This is no big
         # deal in practice, but turns out to be inconvenient for the unittest
         # suite.
-        if msg.get_boundary() <> boundary:
+        if msg.get_boundary() != boundary:
             msg.set_boundary(boundary)
         # If there's a preamble, write it out, with a trailing CRLF
         if msg.preamble is not None:

Modified: python/trunk/Lib/email/header.py
==============================================================================
--- python/trunk/Lib/email/header.py	(original)
+++ python/trunk/Lib/email/header.py	Mon Aug  4 01:27:32 2008
@@ -249,7 +249,7 @@
         elif not isinstance(charset, Charset):
             charset = Charset(charset)
         # If the charset is our faux 8bit charset, leave the string unchanged
-        if charset <> '8bit':
+        if charset != '8bit':
             # We need to test that the string can be converted to unicode and
             # back to a byte string, given the input and output codecs of the
             # charset.
@@ -455,7 +455,7 @@
                 # If this part is longer than maxlen and we aren't already
                 # splitting on whitespace, try to recursively split this line
                 # on whitespace.
-                if partlen > maxlen and ch <> ' ':
+                if partlen > maxlen and ch != ' ':
                     subl = _split_ascii(part, maxlen, restlen,
                                         continuation_ws, ' ')
                     lines.extend(subl[:-1])

Modified: python/trunk/Lib/email/message.py
==============================================================================
--- python/trunk/Lib/email/message.py	(original)
+++ python/trunk/Lib/email/message.py	Mon Aug  4 01:27:32 2008
@@ -252,7 +252,7 @@
                             charset=charset.get_output_charset())
         else:
             self.set_param('charset', charset.get_output_charset())
-        if str(charset) <> charset.get_output_charset():
+        if str(charset) != charset.get_output_charset():
             self._payload = charset.body_encode(self._payload)
         if not self.has_key('Content-Transfer-Encoding'):
             cte = charset.get_body_encoding()
@@ -301,7 +301,7 @@
         name = name.lower()
         newheaders = []
         for k, v in self._headers:
-            if k.lower() <> name:
+            if k.lower() != name:
                 newheaders.append((k, v))
         self._headers = newheaders
 
@@ -438,7 +438,7 @@
             return self.get_default_type()
         ctype = paramre.split(value)[0].lower().strip()
         # RFC 2045, section 5.2 says if its invalid, use text/plain
-        if ctype.count('/') <> 1:
+        if ctype.count('/') != 1:
             return 'text/plain'
         return ctype
 
@@ -601,7 +601,7 @@
                     ctype = append_param
                 else:
                     ctype = SEMISPACE.join([ctype, append_param])
-        if ctype <> self.get(header):
+        if ctype != self.get(header):
             del self[header]
             self[header] = ctype
 
@@ -617,13 +617,13 @@
             return
         new_ctype = ''
         for p, v in self.get_params(header=header, unquote=requote):
-            if p.lower() <> param.lower():
+            if p.lower() != param.lower():
                 if not new_ctype:
                     new_ctype = _formatparam(p, v, requote)
                 else:
                     new_ctype = SEMISPACE.join([new_ctype,
                                                 _formatparam(p, v, requote)])
-        if new_ctype <> self.get(header):
+        if new_ctype != self.get(header):
             del self[header]
             self[header] = new_ctype
 

Modified: python/trunk/Lib/email/quoprimime.py
==============================================================================
--- python/trunk/Lib/email/quoprimime.py	(original)
+++ python/trunk/Lib/email/quoprimime.py	Mon Aug  4 01:27:32 2008
@@ -287,7 +287,7 @@
         n = len(line)
         while i < n:
             c = line[i]
-            if c <> '=':
+            if c != '=':
                 decoded += c
                 i += 1
             # Otherwise, c == "=".  Are we at the end of the line?  If so, add


More information about the Python-checkins mailing list