More trivial comment -> docstring transformations by Ka-Ping Yee,

who writes:

Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.

I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.

The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings.  Hope this is
okay.
This commit is contained in:
Guido van Rossum 2000-02-04 15:10:34 +00:00
parent 8b6323d3ef
commit 54f22ed30b
30 changed files with 1547 additions and 1792 deletions

View file

@ -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: