Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4b8c6ea

Browse files
committed
Actually, the previous batch's comment should have been different;
*this* set of patches is Ka-Ping's final sweep: 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.
1 parent e7b146f commit 4b8c6ea

20 files changed

Lines changed: 99 additions & 48 deletions

Lib/asynchat.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,31 @@
2525
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2626
# ======================================================================
2727

28+
"""A class supporting chat-style (command/response) protocols.
29+
30+
This class adds support for 'chat' style protocols - where one side
31+
sends a 'command', and the other sends a response (examples would be
32+
the common internet protocols - smtp, nntp, ftp, etc..).
33+
34+
The handle_read() method looks at the input stream for the current
35+
'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
36+
for multi-line output), calling self.found_terminator() on its
37+
receipt.
38+
39+
for example:
40+
Say you build an async nntp client using this class. At the start
41+
of the connection, you'll have self.terminator set to '\r\n', in
42+
order to process the single-line greeting. Just before issuing a
43+
'LIST' command you'll set it to '\r\n.\r\n'. The output of the LIST
44+
command will be accumulated (using your own 'collect_incoming_data'
45+
method) up to the terminator, and then control will be returned to
46+
you - by calling your self.found_terminator() method.
47+
"""
48+
2849
import socket
2950
import asyncore
3051
import string
3152

32-
# This class adds support for 'chat' style protocols - where one side
33-
# sends a 'command', and the other sends a response (examples would be
34-
# the common internet protocols - smtp, nntp, ftp, etc..).
35-
36-
# The handle_read() method looks at the input stream for the current
37-
# 'terminator' (usually '\r\n' for single-line responses, '\r\n.\r\n'
38-
# for multi-line output), calling self.found_terminator() on its
39-
# receipt.
40-
41-
# for example:
42-
# Say you build an async nntp client using this class. At the start
43-
# of the connection, you'll have self.terminator set to '\r\n', in
44-
# order to process the single-line greeting. Just before issuing a
45-
# 'LIST' command you'll set it to '\r\n.\r\n'. The output of the LIST
46-
# command will be accumulated (using your own 'collect_incoming_data'
47-
# method) up to the terminator, and then control will be returned to
48-
# you - by calling your self.found_terminator() method
49-
5053
class async_chat (asyncore.dispatcher):
5154
"""This is an abstract class. You must derive from this class, and add
5255
the two methods collect_incoming_data() and found_terminator()"""

Lib/asyncore.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@
2525
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2626
# ======================================================================
2727

28+
"""Basic infrastructure for asynchronous socket service clients and servers.
29+
30+
There are only two ways to have a program on a single processor do "more
31+
than one thing at a time". Multi-threaded programming is the simplest and
32+
most popular way to do it, but there is another very different technique,
33+
that lets you have nearly all the advantages of multi-threading, without
34+
actually using multiple threads. it's really only practical if your program
35+
is largely I/O bound. If your program is CPU bound, then pre-emptive
36+
scheduled threads are probably what you really need. Network servers are
37+
rarely CPU-bound, however.
38+
39+
If your operating system supports the select() system call in its I/O
40+
library (and nearly all do), then you can use it to juggle multiple
41+
communication channels at once; doing other work while your I/O is taking
42+
place in the "background." Although this strategy can seem strange and
43+
complex, especially at first, it is in many ways easier to understand and
44+
control than multi-threaded programming. The module documented here solves
45+
many of the difficult problems for you, making the task of building
46+
sophisticated high-performance network servers and clients a snap.
47+
"""
48+
2849
import select
2950
import socket
3051
import string

Lib/binhex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""binhex - Macintosh binhex compression/decompression
1+
"""Macintosh binhex compression/decompression.
22
33
easy interface:
44
binhex(inputfilename, outputfilename)

Lib/copy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""\
2-
Generic (shallow and deep) copying operations
3-
=============================================
1+
"""Generic (shallow and deep) copying operations.
42
53
Interface summary:
64

Lib/dircache.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
"""Return a sorted list of the files in a directory, using a cache
2-
to avoid reading the directory more often than necessary.
3-
Also contains a subroutine to append slashes to directories."""
1+
"""Read and cache directory listings.
2+
3+
The listdir() routine returns a sorted list of the files in a directory,
4+
using a cache to avoid reading the directory more often than necessary.
5+
The annotate() routine appends slashes to directories."""
46

57
import os
68

Lib/dospath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module 'dospath' -- common operations on DOS pathnames"""
1+
"""Common operations on DOS pathnames."""
22

33
import os
44
import stat

Lib/formatter.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
"""Generic output formatting.
2+
3+
Formatter objects transform an abstract flow of formatting events into
4+
specific output events on writer objects. Formatters manage several stack
5+
structures to allow various properties of a writer object to be changed and
6+
restored; writers need not be able to handle relative changes nor any sort
7+
of ``change back'' operation. Specific writer properties which may be
8+
controlled via formatter objects are horizontal alignment, font, and left
9+
margin indentations. A mechanism is provided which supports providing
10+
arbitrary, non-exclusive style settings to a writer as well. Additional
11+
interfaces facilitate formatting events which are not reversible, such as
12+
paragraph separation.
13+
14+
Writer objects encapsulate device interfaces. Abstract devices, such as
15+
file formats, are supported as well as physical devices. The provided
16+
implementations all work with abstract devices. The interface makes
17+
available mechanisms for setting the properties which formatter objects
18+
manage and inserting data into the output.
19+
"""
20+
121
import string
222
import sys
323
from types import StringType

Lib/ftplib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
'''An FTP client class, and some helper functions.
1+
"""An FTP client class and some helper functions.
2+
23
Based on RFC 959: File Transfer Protocol
34
(FTP), by J. Postel and J. Reynolds
45
@@ -31,7 +32,7 @@
3132
3233
A nice test that reveals some of the network dialogue would be:
3334
python ftplib.py -d localhost -l -p -l
34-
'''
35+
"""
3536

3637

3738
import os

Lib/getopt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module getopt -- Parser for command line options.
1+
"""Parser for command line options.
22
33
This module helps scripts to parse the command line arguments in
44
sys.argv. It supports the same conventions as the Unix getopt()

Lib/gzip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""This module implements a function that reads and writes a gzipped file.
1+
"""Functions that read and write gzipped files.
2+
23
The user of the file doesn't have to worry about the compression,
34
but random access is not allowed."""
45

0 commit comments

Comments
 (0)