Mercurial > p > roundup > code
diff roundup/anypy/email_.py @ 6022:70a6ebad4df4
flake8 fix: rm unused sys import; formatting fixes.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 02 Jan 2020 20:55:37 -0500 |
| parents | 611737bc7261 |
| children | f21ec1414591 |
line wrap: on
line diff
--- a/roundup/anypy/email_.py Thu Jan 02 20:50:41 2020 -0500 +++ b/roundup/anypy/email_.py Thu Jan 02 20:55:37 2020 -0500 @@ -47,7 +47,7 @@ # If it is a Header object, we can just return the encoded chunks. if hasattr(header, '_chunks'): return [(_charset._encode(string, str(charset)), str(charset)) - for string, charset in header._chunks] + for string, charset in header._chunks] # If no encoding, just return the header with no charset. if not ecre.search(header): return [(header, None)] @@ -72,10 +72,9 @@ words.append((encoded, encoding, charset)) # Now loop over words and remove words that consist of whitespace # between two encoded strings. - import sys droplist = [] for n, w in enumerate(words): - if n>1 and w[1] and words[n-2][1] and words[n-1][0].isspace(): + if n > 1 and w[1] and words[n-2][1] and words[n-1][0].isspace(): droplist.append(n-1) for d in reversed(droplist): del words[d] @@ -92,7 +91,8 @@ word = quoprimime.header_decode(encoded_string) decoded_words.append((word, charset)) elif encoding == 'b': - paderr = len(encoded_string) % 4 # Postel's law: add missing padding + # Postel's law: add missing padding + paderr = len(encoded_string) % 4 if paderr: encoded_string += '==='[:4 - paderr] try: @@ -124,4 +124,3 @@ last_word += word collapsed.append((last_word, last_charset)) return collapsed -
