Branch merge

This commit is contained in:
Éric Araujo 2011-09-02 17:33:10 +02:00
commit b71c15d407
12 changed files with 50 additions and 34 deletions

View File

@ -126,7 +126,7 @@ Process-wide parameters
program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The program name is ``'/usr/local/bin/python'``, the prefix is ``'/usr/local'``. The
returned string points into static storage; the caller should not modify its returned string points into static storage; the caller should not modify its
value. This corresponds to the :makevar:`prefix` variable in the top-level value. This corresponds to the :makevar:`prefix` variable in the top-level
:file:`Makefile` and the :option:`--prefix` argument to the :program:`configure` :file:`Makefile` and the ``--prefix`` argument to the :program:`configure`
script at build time. The value is available to Python code as ``sys.prefix``. script at build time. The value is available to Python code as ``sys.prefix``.
It is only useful on Unix. See also the next function. It is only useful on Unix. See also the next function.
@ -139,7 +139,7 @@ Process-wide parameters
program name is ``'/usr/local/bin/python'``, the exec-prefix is program name is ``'/usr/local/bin/python'``, the exec-prefix is
``'/usr/local'``. The returned string points into static storage; the caller ``'/usr/local'``. The returned string points into static storage; the caller
should not modify its value. This corresponds to the :makevar:`exec_prefix` should not modify its value. This corresponds to the :makevar:`exec_prefix`
variable in the top-level :file:`Makefile` and the :option:`--exec-prefix` variable in the top-level :file:`Makefile` and the ``--exec-prefix``
argument to the :program:`configure` script at build time. The value is argument to the :program:`configure` script at build time. The value is
available to Python code as ``sys.exec_prefix``. It is only useful on Unix. available to Python code as ``sys.exec_prefix``. It is only useful on Unix.

View File

@ -17,9 +17,9 @@ installed Python and Subversion, you can just run ::
cd Doc cd Doc
make html make html
to check out the necessary toolset in the `tools/` subdirectory and build the to check out the necessary toolset in the :file:`tools/` subdirectory and build
HTML output files. To view the generated HTML, point your favorite browser at the HTML output files. To view the generated HTML, point your favorite browser
the top-level index `build/html/index.html` after running "make". at the top-level index :file:`build/html/index.html` after running "make".
Available make targets are: Available make targets are:
@ -50,10 +50,10 @@ Available make targets are:
* "pydoc-topics", which builds a Python module containing a dictionary with * "pydoc-topics", which builds a Python module containing a dictionary with
plain text documentation for the labels defined in plain text documentation for the labels defined in
`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and :file:`tools/sphinxext/pyspecific.py` -- pydoc needs these to show topic and
keyword help. keyword help.
A "make update" updates the Subversion checkouts in `tools/`. A "make update" updates the Subversion checkouts in :file:`tools/`.
Without make Without make

View File

@ -472,7 +472,10 @@ in a different style:
.. describe:: keyword .. describe:: keyword
The name of a keyword in Python. The name of a Python keyword. Using this role will generate a link to the
documentation of the keyword. ``True``, ``False`` and ``None`` do not use
this role, but simple code markup (````True````), given that they're
fundamental to the language and should be known to any programmer.
.. describe:: mailheader .. describe:: mailheader

View File

@ -684,7 +684,7 @@ construction of large programs.
Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base Classes
(ABCs). You can then use :func:`isinstance` and :func:`issubclass` to check (ABCs). You can then use :func:`isinstance` and :func:`issubclass` to check
whether an instance or a class implements a particular ABC. The whether an instance or a class implements a particular ABC. The
:mod:`collections` modules defines a set of useful ABCs such as :mod:`collections` module defines a set of useful ABCs such as
:class:`Iterable`, :class:`Container`, and :class:`MutableMapping`. :class:`Iterable`, :class:`Container`, and :class:`MutableMapping`.
For Python, many of the advantages of interface specifications can be obtained For Python, many of the advantages of interface specifications can be obtained

View File

@ -542,7 +542,7 @@ A trick to get it to run an arbitrary file is to construct a call to
:func:`execfile` with the name of your file as argument. :func:`execfile` with the name of your file as argument.
Also note that you can not mix-and-match Debug and Release versions. If you Also note that you can not mix-and-match Debug and Release versions. If you
wish to use the Debug Multithreaded DLL, then your module *must* have an "_d" wish to use the Debug Multithreaded DLL, then your module *must* have ``_d``
appended to the base name. appended to the base name.

View File

@ -153,7 +153,7 @@ ArgumentParser objects
conflicting optionals. conflicting optionals.
* prog_ - The name of the program (default: * prog_ - The name of the program (default:
:data:`sys.argv[0]`) ``sys.argv[0]``)
* usage_ - The string describing the program usage (default: generated) * usage_ - The string describing the program usage (default: generated)

View File

@ -248,6 +248,8 @@ keyword. If it's a number, it refers to a positional argument, and if it's a ke
it refers to a named keyword argument. If the numerical arg_names in a format string it refers to a named keyword argument. If the numerical arg_names in a format string
are 0, 1, 2, ... in sequence, they can all be omitted (not just some) are 0, 1, 2, ... in sequence, they can all be omitted (not just some)
and the numbers 0, 1, 2, ... will be automatically inserted in that order. and the numbers 0, 1, 2, ... will be automatically inserted in that order.
Because *arg_name* is not quote-delimited, it is not possible to specify arbitrary
dictionary keys (e.g., the strings ``'10'`` or ``':-]'``) within a format string.
The *arg_name* can be followed by any number of index or The *arg_name* can be followed by any number of index or
attribute expressions. An expression of the form ``'.name'`` selects the named attribute expressions. An expression of the form ``'.name'`` selects the named
attribute using :func:`getattr`, while an expression of the form ``'[index]'`` attribute using :func:`getattr`, while an expression of the form ``'[index]'``

View File

@ -22,8 +22,8 @@ structs and the intended conversion to/from Python values.
alignment is taken into account when unpacking. This behavior is chosen so alignment is taken into account when unpacking. This behavior is chosen so
that the bytes of a packed struct correspond exactly to the layout in memory that the bytes of a packed struct correspond exactly to the layout in memory
of the corresponding C struct. To handle platform-independent data formats of the corresponding C struct. To handle platform-independent data formats
or omit implicit pad bytes, use `standard` size and alignment instead of or omit implicit pad bytes, use ``standard`` size and alignment instead of
`native` size and alignment: see :ref:`struct-alignment` for details. ``native`` size and alignment: see :ref:`struct-alignment` for details.
Functions and Exceptions Functions and Exceptions
------------------------ ------------------------

View File

@ -307,7 +307,7 @@ as the start directory.
Test discovery loads tests by importing them. Once test discovery has Test discovery loads tests by importing them. Once test discovery has
found all the test files from the start directory you specify it turns the found all the test files from the start directory you specify it turns the
paths into package names to import. For example `foo/bar/baz.py` will be paths into package names to import. For example :file:`foo/bar/baz.py` will be
imported as ``foo.bar.baz``. imported as ``foo.bar.baz``.
If you have a package installed globally and attempt test discovery on If you have a package installed globally and attempt test discovery on
@ -905,11 +905,11 @@ Test cases
+---------------------------------------------------------+--------------------------------------+------------+ +---------------------------------------------------------+--------------------------------------+------------+
| Method | Checks that | New in | | Method | Checks that | New in |
+=========================================================+======================================+============+ +=========================================================+======================================+============+
| :meth:`assertRaises(exc, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `exc` | | | :meth:`assertRaises(exc, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *exc* | |
| <TestCase.assertRaises>` | | | | <TestCase.assertRaises>` | | |
+---------------------------------------------------------+--------------------------------------+------------+ +---------------------------------------------------------+--------------------------------------+------------+
| :meth:`assertRaisesRegexp(exc, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises `exc` | 2.7 | | :meth:`assertRaisesRegexp(exc, re, fun, *args, **kwds) | ``fun(*args, **kwds)`` raises *exc* | 2.7 |
| <TestCase.assertRaisesRegexp>` | and the message matches `re` | | | <TestCase.assertRaisesRegexp>` | and the message matches *re* | |
+---------------------------------------------------------+--------------------------------------+------------+ +---------------------------------------------------------+--------------------------------------+------------+
.. method:: assertRaises(exception, callable, *args, **kwds) .. method:: assertRaises(exception, callable, *args, **kwds)
@ -995,7 +995,7 @@ Test cases
| <TestCase.assertItemsEqual>` | works with unhashable objs | | | <TestCase.assertItemsEqual>` | works with unhashable objs | |
+---------------------------------------+--------------------------------+--------------+ +---------------------------------------+--------------------------------+--------------+
| :meth:`assertDictContainsSubset(a, b) | all the key/value pairs | 2.7 | | :meth:`assertDictContainsSubset(a, b) | all the key/value pairs | 2.7 |
| <TestCase.assertDictContainsSubset>` | in `a` exist in `b` | | | <TestCase.assertDictContainsSubset>` | in *a* exist in *b* | |
+---------------------------------------+--------------------------------+--------------+ +---------------------------------------+--------------------------------+--------------+

View File

@ -36,7 +36,7 @@ The :mod:`urllib2` module defines the following functions:
:mimetype:`application/x-www-form-urlencoded` format. The :mimetype:`application/x-www-form-urlencoded` format. The
:func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and :func:`urllib.urlencode` function takes a mapping or sequence of 2-tuples and
returns a string in this format. urllib2 module sends HTTP/1.1 requests with returns a string in this format. urllib2 module sends HTTP/1.1 requests with
`Connection:close` header included. ``Connection:close`` header included.
The optional *timeout* parameter specifies a timeout in seconds for blocking The optional *timeout* parameter specifies a timeout in seconds for blocking
operations like the connection attempt (if not specified, the global default operations like the connection attempt (if not specified, the global default

View File

@ -1,4 +1,4 @@
"""Module/script to "compile" all .py files to .pyc (or .pyo) file. """Module/script to byte-compile all .py files to .pyc (or .pyo) files.
When called as a script with arguments, this compiles the directories When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from given as arguments recursively; the -l option prevents it from
@ -26,8 +26,8 @@ def compile_dir(dir, maxlevels=10, ddir=None,
dir: the directory to byte-compile dir: the directory to byte-compile
maxlevels: maximum recursion level (default 10) maxlevels: maximum recursion level (default 10)
ddir: if given, purported directory name (this is the ddir: the directory that will be prepended to the path to the
directory name that will show up in error messages) file as it is compiled into each byte-code file.
force: if 1, force compilation, even if timestamps are up-to-date force: if 1, force compilation, even if timestamps are up-to-date
quiet: if 1, be quiet during compilation quiet: if 1, be quiet during compilation
""" """
@ -64,8 +64,8 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
Arguments (only fullname is required): Arguments (only fullname is required):
fullname: the file to byte-compile fullname: the file to byte-compile
ddir: if given, purported directory name (this is the ddir: if given, the directory name compiled in to the
directory name that will show up in error messages) byte-code file.
force: if 1, force compilation, even if timestamps are up-to-date force: if 1, force compilation, even if timestamps are up-to-date
quiet: if 1, be quiet during compilation quiet: if 1, be quiet during compilation
""" """
@ -157,14 +157,27 @@ def main():
print msg print msg
print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \ print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
"[-x regexp] [-i list] [directory|file ...]" "[-x regexp] [-i list] [directory|file ...]"
print "-l: don't recurse down" print
print "arguments: zero or more file and directory names to compile; " \
"if no arguments given, "
print " defaults to the equivalent of -l sys.path"
print
print "options:"
print "-l: don't recurse into subdirectories"
print "-f: force rebuild even if timestamps are up-to-date" print "-f: force rebuild even if timestamps are up-to-date"
print "-q: quiet operation" print "-q: output only error messages"
print "-d destdir: purported directory name for error messages" print "-d destdir: directory to prepend to file paths for use in " \
print " if no directory arguments, -l sys.path is assumed" "compile-time tracebacks and in"
print "-x regexp: skip files matching the regular expression regexp" print " runtime tracebacks in cases where the source " \
print " the regexp is searched for in the full path of the file" "file is unavailable"
print "-i list: expand list with its content (file and directory names)" print "-x regexp: skip files matching the regular expression regexp; " \
"the regexp is searched for"
print " in the full path of each file considered for " \
"compilation"
print "-i file: add all the files and directories listed in file to " \
"the list considered for"
print ' compilation; if "-", names are read from stdin'
sys.exit(2) sys.exit(2)
maxlevels = 10 maxlevels = 10
ddir = None ddir = None
@ -205,7 +218,7 @@ def main():
else: else:
success = compile_path() success = compile_path()
except KeyboardInterrupt: except KeyboardInterrupt:
print "\n[interrupt]" print "\n[interrupted]"
success = 0 success = 0
return success return success

View File

@ -54,8 +54,6 @@ for the built-in function open() or for os.popen().
To create a new template object initialized to a given one: To create a new template object initialized to a given one:
t2 = t.clone() t2 = t.clone()
For an example, see the function test() at the end of the file.
""" # ' """ # '