diff options
author | Guido van Rossum <guido@python.org> | 2000-02-04 15:28:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-02-04 15:28:42 (GMT) |
commit | e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757 (patch) | |
tree | e1dda862f680cf4a1169220af2ecbca3322caf4d /Lib/quopri.py | |
parent | 54f22ed30bab2e64909ba2d79205cb4b87c69db2 (diff) | |
download | cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.zip cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.tar.gz cpython-e7b146fb3bdca62a0d5ecc06dbf3348e5a4fe757.tar.bz2 |
The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.
A new docstring was added to formatter. The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
Diffstat (limited to 'Lib/quopri.py')
-rwxr-xr-x | Lib/quopri.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/quopri.py b/Lib/quopri.py index 6b45597..cd2f5eb 100755 --- a/Lib/quopri.py +++ b/Lib/quopri.py @@ -1,6 +1,7 @@ #! /usr/bin/env python -# Conversions to/from quoted-printable transport encoding as per RFC-1521 +"""Conversions to/from quoted-printable transport encoding as per RFC-1521.""" + # (Dec 1991 version). ESCAPE = '=' @@ -8,11 +9,15 @@ MAXLINESIZE = 76 HEX = '0123456789ABCDEF' def needsquoting(c, quotetabs): + """Decide whether a particular character needs to be quoted. + + The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~') def quote(c): + """Quote a single character.""" if c == ESCAPE: return ESCAPE * 2 else: @@ -20,6 +25,10 @@ def quote(c): return ESCAPE + HEX[i/16] + HEX[i%16] def encode(input, output, quotetabs): + """Read 'input', apply quoted-printable encoding, and write to 'output'. + + 'input' and 'output' are files with readline() and write() methods. + The 'quotetabs' flag indicates whether tabs should be quoted.""" while 1: line = input.readline() if not line: break @@ -42,6 +51,9 @@ def encode(input, output, quotetabs): output.write(new + '\n') def decode(input, output): + """Read 'input', apply quoted-printable decoding, and write to 'output'. + + 'input' and 'output' are files with readline() and write() methods.""" new = '' while 1: line = input.readline() @@ -73,9 +85,11 @@ def decode(input, output): output.write(new) def ishex(c): + """Return true if the character 'c' is a hexadecimal digit.""" return '0' <= c <= '9' or 'a' <= c <= 'f' or 'A' <= c <= 'F' def unhex(s): + """Get the integer value of a hexadecimal number.""" bits = 0 for c in s: if '0' <= c <= '9': |