@@ -47,7 +47,7 @@ def decode_header(header):
4747 # If it is a Header object, we can just return the encoded chunks.
4848 if hasattr (header , '_chunks' ):
4949 return [(_charset ._encode (string , str (charset )), str (charset ))
50- for string , charset in header ._chunks ]
50+ for string , charset in header ._chunks ]
5151 # If no encoding, just return the header with no charset.
5252 if not ecre .search (header ):
5353 return [(header , None )]
@@ -72,10 +72,9 @@ def decode_header(header):
7272 words .append ((encoded , encoding , charset ))
7373 # Now loop over words and remove words that consist of whitespace
7474 # between two encoded strings.
75- import sys
7675 droplist = []
7776 for n , w in enumerate (words ):
78- if n > 1 and w [1 ] and words [n - 2 ][1 ] and words [n - 1 ][0 ].isspace ():
77+ if n > 1 and w [1 ] and words [n - 2 ][1 ] and words [n - 1 ][0 ].isspace ():
7978 droplist .append (n - 1 )
8079 for d in reversed (droplist ):
8180 del words [d ]
@@ -92,7 +91,8 @@ def decode_header(header):
9291 word = quoprimime .header_decode (encoded_string )
9392 decoded_words .append ((word , charset ))
9493 elif encoding == 'b' :
95- paderr = len (encoded_string ) % 4 # Postel's law: add missing padding
94+ # Postel's law: add missing padding
95+ paderr = len (encoded_string ) % 4
9696 if paderr :
9797 encoded_string += '===' [:4 - paderr ]
9898 try :
@@ -124,4 +124,3 @@ def decode_header(header):
124124 last_word += word
125125 collapsed .append ((last_word , last_charset ))
126126 return collapsed
127-
0 commit comments