Move source links to consistent location and remove wordy, big yellow boxes.

This commit is contained in:
Raymond Hettinger 2011-01-10 03:26:08 +00:00
parent a4815caa7c
commit 1048094037
26 changed files with 37 additions and 114 deletions

View File

@ -7,6 +7,7 @@
.. sectionauthor:: Martin v. Löwis <martin@v.loewis.de>
.. sectionauthor:: Georg Brandl <georg@python.org>
**Source code:** :source:`Lib/ast.py`
The :mod:`ast` module helps Python applications to process trees of the Python
abstract syntax grammar. The abstract syntax itself might change with each
@ -19,9 +20,6 @@ helper provided in this module. The result will be a tree of objects whose
classes all inherit from :class:`ast.AST`. An abstract syntax tree can be
compiled into a Python code object using the built-in :func:`compile` function.
.. seealso::
Latest version of the :source:`ast module Python source code <Lib/ast.py>`
Node classes
------------

View File

@ -7,6 +7,8 @@
.. sectionauthor:: Raymond Hettinger <python at rcn.com>
.. example based on the PyModules FAQ entry by Aaron Watters <arw@pythonpros.com>
**Source code:** :source:`Lib/bisect.py`
This module provides support for maintaining a list in sorted order without
having to sort the list after each insertion. For long lists of items with
expensive comparison operations, this can be an improvement over the more common
@ -14,11 +16,6 @@ approach. The module is called :mod:`bisect` because it uses a basic bisection
algorithm to do its work. The source code may be most useful as a working
example of the algorithm (the boundary conditions are already right!).
.. seealso::
Latest version of the :source:`bisect module Python source code
<Lib/bisect.py>`
The following functions are provided:

View File

@ -6,6 +6,7 @@
of the Unix cal program.
.. sectionauthor:: Drew Csillag <drew_csillag@geocities.com>
**Source code:** :source:`Lib/calendar.py`
This module allows you to output calendars like the Unix :program:`cal` program,
and provides additional useful functions related to the calendar. By default,
@ -309,6 +310,3 @@ The :mod:`calendar` module exports the following data attributes:
Module :mod:`time`
Low-level time related functions.
Latest version of the :source:`calendar module Python source code
<Lib/calendar.py>`

View File

@ -5,16 +5,13 @@
:synopsis: Build line-oriented command interpreters.
.. sectionauthor:: Eric S. Raymond <esr@snark.thyrsus.com>
**Source code:** :source:`Lib/cmd.py`
The :class:`Cmd` class provides a simple framework for writing line-oriented
command interpreters. These are often useful for test harnesses, administrative
tools, and prototypes that will later be wrapped in a more sophisticated
interface.
.. seealso::
Latest version of the :source:`cmd module Python source code <Lib/cmd.py>`
.. class:: Cmd(completekey='tab', stdin=None, stdout=None)
A :class:`Cmd` instance or subclass instance is a line-oriented interpreter

View File

@ -12,6 +12,8 @@
import itertools
__name__ = '<doctest>'
**Source code:** :source:`Lib/collections.py`
This module implements specialized container datatypes providing alternatives to
Python's general purpose built-in containers, :class:`dict`, :class:`list`,
:class:`set`, and :class:`tuple`.
@ -31,11 +33,6 @@ In addition to the concrete container classes, the collections module provides
:ref:`abstract-base-classes` that can be used to test whether a class provides a
particular interface, for example, whether it is hashable or a mapping.
.. seealso::
Latest version of the :source:`collections module Python source code
<Lib/collections.py>`
:class:`Counter` objects
------------------------

View File

@ -4,16 +4,12 @@
.. module:: contextlib
:synopsis: Utilities for with-statement contexts.
**Source code:** :source:`Lib/contextlib.py`
This module provides utilities for common tasks involving the :keyword:`with`
statement. For more information see also :ref:`typecontextmanager` and
:ref:`context-managers`.
.. seealso::
Latest version of the :source:`contextlib Python source code
<Lib/contextlib.py>`
Functions provided:

View File

@ -4,19 +4,16 @@
.. module:: dis
:synopsis: Disassembler for Python bytecode.
**Source code:** :source:`Lib/dis.py`
The :mod:`dis` module supports the analysis of CPython :term:`bytecode` by
disassembling it. The CPython bytecode which this module takes as an
input is defined in the file :file:`Include/opcode.h` and used by the compiler
and the interpreter.
.. seealso::
Latest version of the :source:`dis module Python source code <Lib/dis.py>`
.. impl-detail::
Bytecode is an implementation detail of the CPython interpreter! No
Bytecode is an implementation detail of the CPython interpreter. No
guarantees are made that bytecode will not be added, removed, or changed
between versions of Python. Use of this module should not be considered to
work across Python VMs or Python releases.

View File

@ -5,16 +5,12 @@
:synopsis: Compare files efficiently.
.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
**Source code:** :source:`Lib/filecmp.py`
The :mod:`filecmp` module defines functions to compare files and directories,
with various optional time/correctness trade-offs. For comparing files,
see also the :mod:`difflib` module.
.. seealso::
Latest version of the :source:`filecmp Python source code
<Lib/filecmp.py>`
The :mod:`filecmp` module defines the following functions:

View File

@ -6,6 +6,7 @@
.. moduleauthor:: Guido van Rossum <guido@python.org>
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
**Source code:** :source:`Lib/fileinput.py`
This module implements a helper class and functions to quickly write a
loop over standard input or a list of files. If you just want to read or
@ -44,11 +45,6 @@ hook must be a function that takes two arguments, *filename* and *mode*, and
returns an accordingly opened file-like object. Two useful hooks are already
provided by this module.
.. seealso::
Latest version of the :source:`fileinput Python source code
<Lib/fileinput.py>`
The following function is the primary interface of this module:

View File

@ -9,6 +9,8 @@
.. index:: module: re
**Source code:** :source:`Lib/fnmatch.py`
This module provides support for Unix shell-style wildcards, which are *not* the
same as regular expressions (which are documented in the :mod:`re` module). The
special characters used in shell-style wildcards are:
@ -88,6 +90,3 @@ patterns.
Module :mod:`glob`
Unix shell-style path expansion.
Latest version of the :source:`fnmatch Python source code
<Lib/fnmatch.py>`

View File

@ -7,6 +7,8 @@
.. index:: single: filenames; pathname expansion
**Source code:** :source:`Lib/glob.py`
The :mod:`glob` module finds all the pathnames matching a specified pattern
according to the rules used by the Unix shell. No tilde expansion is done, but
``*``, ``?``, and character ranges expressed with ``[]`` will be correctly
@ -50,5 +52,3 @@ preserved. ::
Module :mod:`fnmatch`
Shell-style filename (not path) expansion
Latest version of the :source:`glob module Python source code <Lib/glob.py>`

View File

@ -8,14 +8,11 @@
.. sectionauthor:: François Pinard
.. sectionauthor:: Raymond Hettinger
**Source code:** :source:`Lib/heapq.py`
This module provides an implementation of the heap queue algorithm, also known
as the priority queue algorithm.
.. seealso::
Latest version of the :source:`heapq Python source code
<Lib/heapq.py>`
Heaps are binary trees for which every parent node has a value less than or
equal to any of its children. This implementation uses arrays for which
``heap[k] <= heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k*, counting

View File

@ -4,6 +4,7 @@
.. module:: keyword
:synopsis: Test whether a string is a keyword in Python.
**Source code:** :source:`Lib/keyword.py`
This module allows a Python program to determine if a string is a keyword.
@ -18,9 +19,3 @@ This module allows a Python program to determine if a string is a keyword.
Sequence containing all the keywords defined for the interpreter. If any
keywords are defined to only be active when particular :mod:`__future__`
statements are in effect, these will be included as well.
.. seealso::
Latest version of the :source:`keyword module Python source code
<Lib/keyword.py>`

View File

@ -5,17 +5,13 @@
:synopsis: This module provides random access to individual lines from text files.
.. sectionauthor:: Moshe Zadka <moshez@zadka.site.co.il>
**Source code:** :source:`Lib/linecache.py`
The :mod:`linecache` module allows one to get any line from any file, while
attempting to optimize internally, using a cache, the common case where many
lines are read from a single file. This is used by the :mod:`traceback` module
to retrieve source lines for inclusion in the formatted traceback.
.. seealso::
Latest version of the :source:`linecache module Python source code
<Lib/linecache.py>`
The :mod:`linecache` module defines the following functions:

View File

@ -6,6 +6,7 @@
.. moduleauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
**Source code:** :source:`Lib/pprint.py`
The :mod:`pprint` module provides a capability to "pretty-print" arbitrary
Python data structures in a form which can be used as input to the interpreter.
@ -21,11 +22,6 @@ width constraint.
Dictionaries are sorted by key before the display is computed.
.. seealso::
Latest version of the :source:`pprint module Python source code
<Lib/pprint.py>`
The :mod:`pprint` module defines one class:
.. First the implementation class:

View File

@ -4,6 +4,7 @@
.. module:: queue
:synopsis: A synchronized queue class.
**Source code:** :source:`Lib/queue.py`
The :mod:`queue` module implements multi-producer, multi-consumer queues.
It is especially useful in threaded programming when information must be
@ -181,5 +182,3 @@ Example of how to wait for enqueued tasks to be completed::
queues with fast atomic :func:`append` and :func:`popleft` operations that
do not require locking.
Latest version of the :source:`queue module Python source code
<Lib/queue.py>`

View File

@ -4,15 +4,11 @@
.. module:: random
:synopsis: Generate pseudo-random numbers with various common distributions.
**Source code:** :source:`Lib/random.py`
This module implements pseudo-random number generators for various
distributions.
.. seealso::
Latest version of the :source:`random module Python source code
<Lib/random.py>`
For integers, there is uniform selection from a range. For sequences, there is
uniform selection of a random element, a function to generate a random
permutation of a list in-place, and a function for random sampling without
@ -45,8 +41,8 @@ The :mod:`random` module also provides the :class:`SystemRandom` class which
uses the system function :func:`os.urandom` to generate random numbers
from sources provided by the operating system.
Bookkeeping functions:
Bookkeeping functions:
.. function:: seed([x], version=2)

View File

@ -7,14 +7,11 @@
.. index:: single: event scheduling
**Source code:** :source:`Lib/sched.py`
The :mod:`sched` module defines a class which implements a general purpose event
scheduler:
.. seealso::
Latest version of the :source:`sched module Python source code
<Lib/sched.py>`
.. class:: scheduler(timefunc, delayfunc)
The :class:`scheduler` class defines a generic interface to scheduling events.

View File

@ -7,16 +7,14 @@
.. index:: module: pickle
**Source code:** :source:`Lib/shelve.py`
A "shelf" is a persistent, dictionary-like object. The difference with "dbm"
databases is that the values (not the keys!) in a shelf can be essentially
arbitrary Python objects --- anything that the :mod:`pickle` module can handle.
This includes most class instances, recursive data types, and objects containing
lots of shared sub-objects. The keys are ordinary strings.
.. seealso::
Latest version of the :source:`shelve module Python source code
<Lib/shelve.py>`
.. function:: open(filename, flag='c', protocol=None, writeback=False)

View File

@ -10,20 +10,17 @@
single: file; copying
single: copying files
**Source code:** :source:`Lib/shutil.py`
The :mod:`shutil` module offers a number of high-level operations on files and
collections of files. In particular, functions are provided which support file
copying and removal. For operations on individual files, see also the
:mod:`os` module.
.. seealso::
Latest version of the :source:`shutil module Python source code
<Lib/shutil.py>`
.. warning::
Even the higher-level file copying functions (:func:`copy`, :func:`copy2`)
can't copy all file metadata.
cannot copy all file metadata.
On POSIX platforms, this means that file owner and group are lost as well
as ACLs. On Mac OS, the resource fork and other metadata are not used.

View File

@ -11,9 +11,7 @@
:ref:`string-methods`
Latest version of the :source:`string module Python source code
<Lib/string.py>`
**Source code:** :source:`Lib/string.py`
String constants
----------------

View File

@ -6,6 +6,7 @@
.. moduleauthor:: Greg Ward <gward@python.net>
.. sectionauthor:: Greg Ward <gward@python.net>
**Source code:** :source:`Lib/textwrap.py`
The :mod:`textwrap` module provides two convenience functions, :func:`wrap` and
:func:`fill`, as well as :class:`TextWrapper`, the class that does all the work,
@ -13,11 +14,6 @@ and a utility function :func:`dedent`. If you're just wrapping or filling one
or two text strings, the convenience functions should be good enough;
otherwise, you should use an instance of :class:`TextWrapper` for efficiency.
.. seealso::
Latest version of the :source:`textwrap module Python source code
<Lib/textwrap.py>`
.. function:: wrap(text, width=70, **kwargs)
Wraps the single paragraph in *text* (a string) so every line is at most

View File

@ -4,6 +4,7 @@
.. module:: threading
:synopsis: Thread-based parallelism.
**Source code:** :source:`Lib/threading.py`
This module constructs higher-level threading interfaces on top of the lower
level :mod:`_thread` module. See also the :mod:`queue` module.
@ -28,11 +29,6 @@ The :mod:`dummy_threading` module is provided for situations where
However, threading is still an appropriate model if you want to run
multiple I/O-bound tasks simultaneously.
.. seealso::
Latest version of the :source:`threading module Python source code
<Lib/threading.py>`
This module defines the following functions and objects:

View File

@ -6,17 +6,13 @@
.. moduleauthor:: Ka Ping Yee
.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
**Source code:** :source:`Lib/tokenize.py`
The :mod:`tokenize` module provides a lexical scanner for Python source code,
implemented in Python. The scanner in this module returns comments as tokens
as well, making it useful for implementing "pretty-printers," including
colorizers for on-screen displays.
.. seealso::
Latest version of the :source:`tokenize module Python source code
<Lib/tokenize.py>`
The primary entry point is a :term:`generator`:
.. function:: tokenize(readline)

View File

@ -4,17 +4,13 @@
.. module:: trace
:synopsis: Trace or track Python statement execution.
**Source code:** :source:`Lib/trace.py`
The :mod:`trace` module allows you to trace program execution, generate
annotated statement coverage listings, print caller/callee relationships and
list functions executed during a program run. It can be used in another program
or from the command line.
.. seealso::
Latest version of the :source:`trace module Python source code
<Lib/trace.py>`
.. _trace-cli:
Command-Line Usage

View File

@ -5,6 +5,7 @@
:synopsis: Encode and decode files in uuencode format.
.. moduleauthor:: Lance Ellinghouse
**Source code:** :source:`Lib/uu.py`
This module encodes and decodes files in uuencode format, allowing arbitrary
binary data to be transferred over ASCII-only connections. Wherever a file
@ -56,5 +57,3 @@ The :mod:`uu` module defines the following functions:
Module :mod:`binascii`
Support module containing ASCII-to-binary and binary-to-ASCII conversions.
Latest version of the :source:`uu module Python source code <Lib/uu.py>`