summaryrefslogtreecommitdiffstats
path: root/Lib/mimetools.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-02-04 15:10:34 (GMT)
committerGuido van Rossum <guido@python.org>2000-02-04 15:10:34 (GMT)
commit54f22ed30bab2e64909ba2d79205cb4b87c69db2 (patch)
treeed398e54a04bf75e3f26845e7aacb72452a10627 /Lib/mimetools.py
parent8b6323d3ef78042118c08703f26cb2adf741ea2e (diff)
downloadcpython-54f22ed30bab2e64909ba2d79205cb4b87c69db2.zip
cpython-54f22ed30bab2e64909ba2d79205cb4b87c69db2.tar.gz
cpython-54f22ed30bab2e64909ba2d79205cb4b87c69db2.tar.bz2
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.
Diffstat (limited to 'Lib/mimetools.py')
-rw-r--r--Lib/mimetools.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/Lib/mimetools.py b/Lib/mimetools.py
index fc72c79..b519c54 100644
--- a/Lib/mimetools.py
+++ b/Lib/mimetools.py
@@ -1,4 +1,4 @@
-# Various tools used by MIME-reading or MIME-writing programs.
+"""Various tools used by MIME-reading or MIME-writing programs."""
import os
@@ -7,10 +7,9 @@ import string
import tempfile
-# A derived class of rfc822.Message that knows about MIME headers and
-# contains some hooks for decoding encoded and multipart messages.
-
class Message(rfc822.Message):
+ """A derived class of rfc822.Message that knows about MIME headers and
+ contains some hooks for decoding encoded and multipart messages."""
def __init__(self, fp, seekable = 1):
rfc822.Message.__init__(self, fp, seekable)
@@ -96,17 +95,17 @@ class Message(rfc822.Message):
# -----------------
-# Return a random string usable as a multipart boundary.
-# The method used is so that it is *very* unlikely that the same
-# string of characters will every occur again in the Universe,
-# so the caller needn't check the data it is packing for the
-# occurrence of the boundary.
-#
-# The boundary contains dots so you have to quote it in the header.
-
_prefix = None
def choose_boundary():
+ """Return a random string usable as a multipart boundary.
+ The method used is so that it is *very* unlikely that the same
+ string of characters will every occur again in the Universe,
+ so the caller needn't check the data it is packing for the
+ occurrence of the boundary.
+
+ The boundary contains dots so you have to quote it in the header."""
+
global _prefix
import time
import random
@@ -131,6 +130,7 @@ def choose_boundary():
# Subroutines for decoding some common content-transfer-types
def decode(input, output, encoding):
+ """Decode common content-transfer-encodings (base64, quopri, uuencode)."""
if encoding == 'base64':
import base64
return base64.decode(input, output)
@@ -147,6 +147,7 @@ def decode(input, output, encoding):
'unknown Content-Transfer-Encoding: %s' % encoding
def encode(input, output, encoding):
+ """Encode common content-transfer-encodings (base64, quopri, uuencode)."""
if encoding == 'base64':
import base64
return base64.encode(input, output)