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

Skip to content

Commit 38e5d27

Browse files
committed
Merged changes from the 1.5.2p2 release.
(Very rough.)
1 parent 659ebfa commit 38e5d27

59 files changed

Lines changed: 1252 additions & 520 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/lib/internet.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ \chapter{Internet Protocols and Support \label{internet}}
66

77
The modules described in this chapter implement Internet protocols and
88
support for related technology. They are all implemented in Python.
9-
Some of these modules require the presence of the system-dependent
10-
module \refmodule{socket}\refbimodindex{socket}, which is currently only
11-
fully supported on \UNIX{} and Windows NT. Here is an overview:
9+
Most of these modules require the presence of the system-dependent
10+
module \refmodule{socket}\refbimodindex{socket}, which is currently
11+
supported on most popular platforms. Here is an overview:
1212

1313
\localmoduletable

Doc/lib/libarray.tex

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ \section{\module{array} ---
7676
operations are applied to it.
7777
\end{methoddesc}
7878

79-
\begin{methoddesc}[array]{byteswap}{x}
79+
\begin{methoddesc}[array]{byteswap}{}
8080
``Byteswap'' all items of the array. This is only supported for
81-
integer values; for other types of values, \exception{RuntimeError} is
82-
raised. It is useful when reading data from a file written on a
83-
machine with a different byte order.
81+
values which are 1, 2, 4, or 8 bytes in size; for other types of
82+
values, \exception{RuntimeError} is raised. It is useful when reading
83+
data from a file written on a machine with a different byte order.
8484
\end{methoddesc}
8585

8686
\begin{methoddesc}[array]{fromfile}{f, n}
@@ -150,7 +150,8 @@ \section{\module{array} ---
150150
string if the \var{typecode} is \code{'c'}, otherwise it is a list of
151151
numbers. The string is guaranteed to be able to be converted back to
152152
an array with the same type and value using reverse quotes
153-
(\code{``}). Examples:
153+
(\code{``}), so long as the \function{array()} function has been
154+
imported using \samp{from array import array}. Examples:
154155
155156
\begin{verbatim}
156157
array('l')
@@ -163,4 +164,10 @@ \section{\module{array} ---
163164
\begin{seealso}
164165
\seemodule{struct}{packing and unpacking of heterogeneous binary data}
165166
\seemodule{xdrlib}{packing and unpacking of XDR data}
167+
\seetext{The Numeric Python extension (NumPy) defines another array
168+
type; see \emph{The Numerical Python Manual} for additional
169+
information (available online at
170+
\url{ftp://ftp-icf.llnl.gov/pub/python/numericalpython.pdf}).
171+
Further information about NumPy is available at
172+
\url{http://www.python.org/topics/scicomp/numpy.html}.}
166173
\end{seealso}

Doc/lib/libasyncore.tex

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
\section{\module{asyncore} ---
2-
Asyncronous socket handler}
2+
Asynchronous socket handler}
33

44
\declaremodule{builtin}{asyncore}
5-
\modulesynopsis{A base class for developing asyncronous socket
5+
\modulesynopsis{A base class for developing asynchronous socket
66
handling services.}
77
\moduleauthor{Sam Rushing}{[email protected]}
88
\sectionauthor{Christopher Petrilli}{[email protected]}
99
% Heavily adapted from original documentation by Sam Rushing.
1010

11-
This module provides the basic infrastructure for writing asyncronous
11+
This module provides the basic infrastructure for writing asynchronous
1212
socket service clients and servers.
1313

14-
%\subsection{Why Asyncronous?}
15-
1614
There are only two ways to have a program on a single processor do
1715
``more than one thing at a time.'' Multi-threaded programming is the
1816
simplest and most popular way to do it, but there is another very

Doc/lib/libbase64.tex

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ \section{\module{base64} ---
1010

1111
This module performs base64 encoding and decoding of arbitrary binary
1212
strings into text strings that can be safely emailed or posted. The
13-
encoding scheme is defined in \rfc{1421} (``Privacy Enhancement for
14-
Internet Electronic Mail: Part I: Message Encryption and
15-
Authentication Procedures'', section 4.3.2.4, ``Step 4: Printable
16-
Encoding'') and is used for MIME email and
17-
various other Internet-related applications; it is not the same as the
18-
output produced by the \program{uuencode} program. For example, the
19-
string \code{'www.python.org'} is encoded as the string
20-
\code{'d3d3LnB5dGhvbi5vcmc=\e n'}.
13+
encoding scheme is defined in \rfc{1521} (\emph{MIME
14+
(Multipurpose Internet Mail Extensions) Part One: Mechanisms for
15+
Specifying and Describing the Format of Internet Message Bodies},
16+
section 5.2, ``Base64 Content-Transfer-Encoding'') and is used for
17+
MIME email and various other Internet-related applications; it is not
18+
the same as the output produced by the \program{uuencode} program.
19+
For example, the string \code{'www.python.org'} is encoded as the
20+
string \code{'d3d3LnB5dGhvbi5vcmc=\e n'}.
2121

2222

2323
\begin{funcdesc}{decode}{input, output}
@@ -52,4 +52,9 @@ \section{\module{base64} ---
5252
\begin{seealso}
5353
\seemodule{binascii}{support module containing \ASCII{}-to-binary
5454
and binary-to-\ASCII{} conversions}
55+
\seetext{Internet \rfc{1521}, \emph{MIME (Multipurpose Internet
56+
Mail Extensions) Part One: Mechanisms for Specifying and
57+
Describing the Format of Internet Message Bodies}, section
58+
5.2, ``Base64 Content-Transfer-Encoding,'' provides the
59+
definition of the base64 encoding.}
5560
\end{seealso}

Doc/lib/libbisect.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
% LaTeX produced by Fred L. Drake, Jr. <[email protected]>, with an
2-
% example based on the PyModules FAQ entry by Aaron Watters
3-
4-
51
\section{\module{bisect} ---
62
Array bisection algorithm}
73

84
\declaremodule{standard}{bisect}
95
\modulesynopsis{Array bisection algorithms for binary searching.}
6+
\sectionauthor{Fred L. Drake, Jr.}{[email protected]}
7+
% LaTeX produced by Fred L. Drake, Jr. <[email protected]>, with an
8+
% example based on the PyModules FAQ entry by Aaron Watters
9+
1010

1111

1212
This module provides support for maintaining a list in sorted order

Doc/lib/libbsddb.tex

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,71 @@ \section{\module{bsddb} ---
77
\sectionauthor{Skip Montanaro}{[email protected]}
88

99

10-
The \module{bsddb} module provides an interface to the Berkeley DB library.
11-
Users can create hash, btree or record based library files using the
12-
appropriate open call. Bsddb objects behave generally like dictionaries.
13-
Keys and values must be strings, however, so to use other objects as keys or
14-
to store other kinds of objects the user must serialize them somehow,
15-
typically using marshal.dumps or pickle.dumps.
16-
17-
The \module{bsddb} module is only available on \UNIX{} systems, so it is not
18-
built by default in the standard Python distribution. Also, there are two
19-
incompatible versions of the underlying library. Version 1.85 is widely
20-
available, but has some known bugs. Version 2 is not quite as widely used,
21-
but does offer some improvements. The \module{bsddb} module uses the 1.85
22-
interface. Users wishing to use version 2 of the Berkeley DB library will
23-
have to modify the source for the module to include db_185.h instead of
24-
db.h.
10+
The \module{bsddb} module provides an interface to the Berkeley DB
11+
library. Users can create hash, btree or record based library files
12+
using the appropriate open call. Bsddb objects behave generally like
13+
dictionaries. Keys and values must be strings, however, so to use
14+
other objects as keys or to store other kinds of objects the user must
15+
serialize them somehow, typically using marshal.dumps or pickle.dumps.
16+
17+
The \module{bsddb} module is only available on \UNIX{} systems, so it
18+
is not built by default in the standard Python distribution. Also,
19+
there are two incompatible versions of the underlying library.
20+
Version 1.85 is widely available, but has some known bugs. Version 2
21+
is not quite as widely used, but does offer some improvements. The
22+
\module{bsddb} module uses the 1.85 interface. Users wishing to use
23+
version 2 of the Berkeley DB library will have to modify the source
24+
for the module to include \file{db_185.h} instead of
25+
\file{db.h} (\file{db_185.h} contains the version 1.85 compatibility
26+
interface).
2527

2628
The \module{bsddb} module defines the following functions that create
27-
objects that access the appropriate type of Berkeley DB file. The first two
28-
arguments of each function are the same. For ease of portability, only the
29-
first two arguments should be used in most instances.
29+
objects that access the appropriate type of Berkeley DB file. The
30+
first two arguments of each function are the same. For ease of
31+
portability, only the first two arguments should be used in most
32+
instances.
3033

3134
\begin{funcdesc}{hashopen}{filename\optional{, flag\optional{,
32-
mode\optional{, bsize\optional{, ffactor\optional{, nelem\optional{,
33-
cachesize\optional{, hash\optional{, lorder}}}}}}}}}
34-
Open the hash format file named \var{filename}. The optional \var{flag}
35-
identifies the mode used to open the file. It may be ``r'' (read only),
36-
``w'' (read-write), ``c'' (read-write - create if necessary) or ``n''
37-
(read-write - truncate to zero length). The other arguments are rarely used
38-
and are just passed to the low-level dbopen function. Consult the
39-
Berkeley DB documentation for their use and interpretation.
35+
mode\optional{, bsize\optional{,
36+
ffactor\optional{, nelem\optional{,
37+
cachesize\optional{, hash\optional{,
38+
lorder}}}}}}}}}
39+
Open the hash format file named \var{filename}. The optional
40+
\var{flag} identifies the mode used to open the file. It may be
41+
\character{r} (read only), \character{w} (read-write),
42+
\character{c} (read-write - create if necessary) or
43+
\character{n} (read-write - truncate to zero length). The other
44+
arguments are rarely used and are just passed to the low-level
45+
\cfunction{dbopen()} function. Consult the Berkeley DB documentation
46+
for their use and interpretation.
4047
\end{funcdesc}
4148

42-
4349
\begin{funcdesc}{btopen}{filename\optional{, flag\optional{,
4450
mode\optional{, btflags\optional{, cachesize\optional{, maxkeypage\optional{,
4551
minkeypage\optional{, psize\optional{, lorder}}}}}}}}}
46-
Open the btree format file named \var{filename}. The optional \var{flag}
47-
identifies the mode used to open the file. It may be ``r'' (read only),
48-
``w'' (read-write), ``c'' (read-write - create if necessary) or ``n''
49-
(read-write - truncate to zero length). The other arguments are rarely used
50-
and are just passed to the low-level dbopen function. Consult the
51-
Berkeley DB documentation for their use and interpretation.
52+
53+
Open the btree format file named \var{filename}. The optional
54+
\var{flag} identifies the mode used to open the file. It may be
55+
\character{r} (read only), \character{w} (read-write),
56+
\character{c} (read-write - create if necessary) or
57+
\character{n} (read-write - truncate to zero length). The other
58+
arguments are rarely used and are just passed to the low-level dbopen
59+
function. Consult the Berkeley DB documentation for their use and
60+
interpretation.
5261
\end{funcdesc}
5362

5463
\begin{funcdesc}{rnopen}{filename\optional{, flag\optional{, mode\optional{,
5564
rnflags\optional{, cachesize\optional{, psize\optional{, lorder\optional{,
5665
reclen\optional{, bval\optional{, bfname}}}}}}}}}}
57-
Open a DB record format file named \var{filename}. The optional \var{flag}
58-
identifies the mode used to open the file. It may be ``r'' (read only),
59-
``w'' (read-write), ``c'' (read-write - create if necessary) or ``n''
60-
(read-write - truncate to zero length). The other arguments are rarely used
61-
and are just passed to the low-level dbopen function. Consult the
62-
Berkeley DB documentation for their use and interpretation.
66+
67+
Open a DB record format file named \var{filename}. The optional
68+
\var{flag} identifies the mode used to open the file. It may be
69+
\character{r} (read only), \character{w} (read-write),
70+
\character{c} (read-write - create if necessary) or
71+
\character{n} (read-write - truncate to zero length). The other
72+
arguments are rarely used and are just passed to the low-level dbopen
73+
function. Consult the Berkeley DB documentation for their use and
74+
interpretation.
6375
\end{funcdesc}
6476

6577

@@ -86,7 +98,7 @@ \subsection{Hash, BTree and Record Objects \label{bsddb-objects}}
8698
\end{methoddesc}
8799

88100
\begin{methoddesc}{has_key}{key}
89-
Return 1 if the DB file contains the argument as a key.
101+
Return \code{1} if the DB file contains the argument as a key.
90102
\end{methoddesc}
91103

92104
\begin{methoddesc}{set_location}{key}

Doc/lib/libcalendar.tex

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
% This section was contributed by Drew Csillag <[email protected]>.
2-
31
\section{\module{calendar} ---
4-
Functions that emulate the \UNIX{} \program{cal} program.}
5-
\declaremodule{standard}{calendar}
6-
7-
\modulesynopsis{Functions that emulate the \UNIX{} \program{cal}
8-
program.}
2+
General calendar-related functions}
93

4+
\declaremodule{standard}{calendar}
5+
\modulesynopsis{General functions for working with the calendar,
6+
including some emulation of the \UNIX{} \program{cal}
7+
program.}
8+
\sectionauthor{Drew Csillag}{[email protected]}
109

1110
This module allows you to output calendars like the \UNIX{}
12-
\manpage{cal}{1} program.
11+
\program{cal} program, and provides additional useful functions
12+
related to the calendar.
1313

1414
\begin{funcdesc}{isleap}{year}
15-
Returns \code{1} if \var{year} is a leap year.
15+
Returns true if \var{year} is a leap year.
1616
\end{funcdesc}
1717

1818
\begin{funcdesc}{leapdays}{year1, year2}
@@ -48,9 +48,14 @@ \section{\module{calendar} ---
4848
\end{funcdesc}
4949

5050
\begin{funcdesc}{timegm}{tuple}
51-
An unrelated but handy function that takes a time tuple such are
52-
returned by the \function{gmtime()} function in the \module{time}
51+
An unrelated but handy function that takes a time tuple such as
52+
returned by the \function{gmtime()} function in the \refmodule{time}
5353
module, and returns the corresponding Unix timestamp value, assuming
5454
an epoch of 1970, and the POSIX encoding. In fact,
55-
\function{gmtime()} and \function{timegm()} are each others inverse.
55+
\function{time.gmtime()} and \function{timegm()} are each others' inverse.
5656
\end{funcdesc}
57+
58+
59+
\begin{seealso}
60+
\seemodule{time}{Low-level time related functions.}
61+
\end{seealso}

Doc/lib/libcfgparser.tex

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ \section{\module{ConfigParser} ---
33

44
\declaremodule{standard}{ConfigParser}
55
\modulesynopsis{Configuration file parser.}
6+
\moduleauthor{Ken Manheimer}{[email protected]}
7+
\moduleauthor{Barry Warsaw}{[email protected]}
68
\sectionauthor{Christopher G. Petrilli}{[email protected]}
79

810
This module defines the class \class{ConfigParser}.
@@ -16,24 +18,27 @@ \section{\module{ConfigParser} ---
1618
The configuration file consists of sections, lead by a
1719
\samp{[section]} header and followed by \samp{name: value} entries,
1820
with continuations in the style of \rfc{822}; \samp{name=value} is
19-
also accepted. The optional values can contain format strings which
20-
refer to other values in the same section, or values in a special
21+
also accepted. Note that leading whitespace is removed from values.
22+
The optional values can contain format strings which refer to other
23+
values in the same section, or values in a special
2124
\code{DEFAULT} section. Additional defaults can be provided upon
22-
initialization and retrieval. Lines beginning with \character{\#} are
23-
ignored and may be used to provide comments.
25+
initialization and retrieval. Lines beginning with \character{\#} or
26+
\character{;} are ignored and may be used to provide comments.
2427

2528
For example:
2629

2730
\begin{verbatim}
2831
foodir: %(dir)s/whatever
32+
dir=frob
2933
\end{verbatim}
3034

31-
would resolve the \samp{\%(dir)s} to the value of dir. All reference
32-
expansions are done late, on demand.
35+
would resolve the \samp{\%(dir)s} to the value of
36+
\samp{dir} (\samp{frob} in this case). All reference expansions are
37+
done on demand.
3338

34-
Intrinsic defaults can be specified by passing them into the
35-
\class{ConfigParser} constructor as a dictionary. Additional defaults
36-
may be passed into the \method{get} method which will override all
39+
Default values can be specified by passing them into the
40+
\class{ConfigParser} constructor as a dictionary. Additional defaults
41+
may be passed into the \method{get()} method which will override all
3742
others.
3843

3944
\begin{classdesc}{ConfigParser}{\optional{defaults}}
@@ -50,7 +55,9 @@ \section{\module{ConfigParser} ---
5055
\end{excdesc}
5156

5257
\begin{excdesc}{DuplicateSectionError}
53-
Exception raised when mutliple sections with the same name are found.
58+
Exception raised when mutliple sections with the same name are found,
59+
or if \method{add_section()} is called with the name of a section that
60+
is already present.
5461
\end{excdesc}
5562

5663
\begin{excdesc}{NoOptionError}
@@ -87,7 +94,14 @@ \subsection{ConfigParser Objects \label{ConfigParser-objects}}
8794
\end{methoddesc}
8895

8996
\begin{methoddesc}{sections}{}
90-
Return a list of the sections available.
97+
Return a list of the sections available; \code{DEFAULT} is not
98+
included in the list.
99+
\end{methoddesc}
100+
101+
\begin{methoddesc}{add_section}{section}
102+
Add a section named \var{section} to the instance. If a section by
103+
the given name already exists, \exception{DuplicateSectionError} is
104+
raised.
91105
\end{methoddesc}
92106

93107
\begin{methoddesc}{has_section}{section}
@@ -123,6 +137,6 @@ \subsection{ConfigParser Objects \label{ConfigParser-objects}}
123137
\begin{methoddesc}{getboolean}{section, option}
124138
A convenience method which coerces the \var{option} in the specified
125139
\var{section} to a boolean value. Note that the only accepted values
126-
for the option are \code{0} and \code{1}, any others will raise
140+
for the option are \samp{0} and \samp{1}, any others will raise
127141
\exception{ValueError}.
128142
\end{methoddesc}

Doc/lib/libcgi.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ \subsection{Functions}
195195
Parse a query string given as a string argument (data of type
196196
\mimetype{application/x-www-form-urlencoded}). Data are
197197
returned as a dictionary. The dictionary keys are the unique query
198-
variable names and the values are lists of vales for each name.
198+
variable names and the values are lists of values for each name.
199199

200200
The optional argument \var{keep_blank_values} is
201201
a flag indicating whether blank values in

Doc/lib/libcgihttp.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ \section{\module{CGIHTTPServer} ---
33

44

55
\declaremodule{standard}{CGIHTTPServer}
6+
\platform{Unix}
67
\sectionauthor{Moshe Zadka}{[email protected]}
78
\modulesynopsis{This module provides a request handler for HTTP servers
89
which can run CGI scripts.}
@@ -14,6 +15,9 @@ \section{\module{CGIHTTPServer} ---
1415
from \class{SimpleHTTPServer.SimpleHTTPRequestHandler} but can also
1516
run CGI scripts.
1617

18+
\strong{Note:} This module is \UNIX{} dependent since it creates the
19+
CGI process using \function{os.fork()} and \function{os.exec()}.
20+
1721
The \module{CGIHTTPServer} module defines the following class:
1822

1923
\begin{classdesc}{CGIHTTPRequestHandler}{request, client_address, server}

0 commit comments

Comments
 (0)