diff options
Diffstat (limited to 'Lib/mimify.py')
-rwxr-xr-x | Lib/mimify.py | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/Lib/mimify.py b/Lib/mimify.py index cb967cd..354cdb7 100755 --- a/Lib/mimify.py +++ b/Lib/mimify.py @@ -2,7 +2,7 @@ '''Mimification and unmimification of mail messages. -decode quoted-printable parts of a mail message or encode using +Decode quoted-printable parts of a mail message or encode using quoted-printable. Usage: @@ -39,9 +39,8 @@ mime_head = re.compile('=\\?iso-8859-1\\?q\\?([^? \t\n]+)\\?=', re.I) repl = re.compile('^subject:\\s+re: ', re.I) class File: - '''A simple fake file object that knows about limited - read-ahead and boundaries. - The only supported method is readline().''' + """A simple fake file object that knows about limited read-ahead and + boundaries. The only supported method is readline().""" def __init__(self, file, boundary): self.file = file @@ -87,7 +86,7 @@ class HeaderFile: self.peek = None def mime_decode(line): - '''Decode a single line of quoted-printable text to 8bit.''' + """Decode a single line of quoted-printable text to 8bit.""" newline = '' pos = 0 while 1: @@ -100,7 +99,7 @@ def mime_decode(line): return newline + line[pos:] def mime_decode_header(line): - '''Decode a header line to 8bit.''' + """Decode a header line to 8bit.""" newline = '' pos = 0 while 1: @@ -115,7 +114,7 @@ def mime_decode_header(line): return newline + line[pos:] def unmimify_part(ifile, ofile, decode_base64 = 0): - '''Convert a quoted-printable part of a MIME mail message to 8bit.''' + """Convert a quoted-printable part of a MIME mail message to 8bit.""" multipart = None quoted_printable = 0 is_base64 = 0 @@ -200,7 +199,7 @@ def unmimify_part(ifile, ofile, decode_base64 = 0): ofile.write(pref + line) def unmimify(infile, outfile, decode_base64 = 0): - '''Convert quoted-printable parts of a MIME mail message to 8bit.''' + """Convert quoted-printable parts of a MIME mail message to 8bit.""" if type(infile) == type(''): ifile = open(infile) if type(outfile) == type('') and infile == outfile: @@ -221,8 +220,8 @@ mime_char = re.compile('[=\177-\377]') # quote these chars in body mime_header_char = re.compile('[=?\177-\377]') # quote these in header def mime_encode(line, header): - '''Code a single line as quoted-printable. - If header is set, quote some extra characters.''' + """Code a single line as quoted-printable. + If header is set, quote some extra characters.""" if header: reg = mime_header_char else: @@ -255,7 +254,7 @@ def mime_encode(line, header): mime_header = re.compile('([ \t(]|^)([-a-zA-Z0-9_+]*[\177-\377][-a-zA-Z0-9_+\177-\377]*)([ \t)]|\n)') def mime_encode_header(line): - '''Code a single header line as quoted-printable.''' + """Code a single header line as quoted-printable.""" newline = '' pos = 0 while 1: @@ -273,7 +272,7 @@ cte = re.compile('^content-transfer-encoding:', re.I) iso_char = re.compile('[\177-\377]') def mimify_part(ifile, ofile, is_mime): - '''Convert an 8bit part of a MIME mail message to quoted-printable.''' + """Convert an 8bit part of a MIME mail message to quoted-printable.""" has_cte = is_qp = is_base64 = 0 multipart = None must_quote_body = must_quote_header = has_iso_chars = 0 @@ -408,7 +407,7 @@ def mimify_part(ifile, ofile, is_mime): ofile.write(line) def mimify(infile, outfile): - '''Convert 8bit parts of a MIME mail message to quoted-printable.''' + """Convert 8bit parts of a MIME mail message to quoted-printable.""" if type(infile) == type(''): ifile = open(infile) if type(outfile) == type('') and infile == outfile: |