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

Skip to content

Commit 86def6c

Browse files
committed
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make. ........ r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines #1087741: make mmap.mmap the type of mmap objects, not a factory function. Allow it to be subclassed. ........ r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines mmap is an extension module. ........ r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines Fix example. ........ r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines #1555501: document plistlib and move it to the general library. ........ r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines Add a stub for bundlebuilder documentation. ........ r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines Removing bundlebuilder docs again -- it's not to be used anymore (see #779825). ........ r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines #997912: acknowledge nested scopes in tutorial. ........ r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski. ........ r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines Adapt pydoc to new doc URLs. ........ r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines Fix old link. ........ r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines #1726198: replace while 1: fp.readline() with file iteration. ........ r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines Clarify $ behavior in re docstring. #1631394. ........ r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line Minor documentation change - hyperlink tidied up. ........ r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines #1530959: change distutils build dir for --with-pydebug python builds. ........ r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line Updated to include news on recent logging fixes and documentation changes. ........ r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines Issue #1882: when compiling code from a string, encoding cookies in the second line of code were not always recognized correctly. ........ r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines Add NEWS entry for #1882. ........ r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines Use original location of document, which has translations. ........ r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines Follow PEP 8 in module docstring. ........ r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines Adapt to latest doctools refactoring. ........
1 parent e1c9811 commit 86def6c

25 files changed

Lines changed: 382 additions & 133 deletions

File tree

Doc/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ taken on the bug.
4949

5050
.. seealso::
5151

52-
`How to Report Bugs Effectively <http://www-mice.cs.ucl.ac.uk/multimedia/software/documentation/ReportingBugs.html>`_
52+
`How to Report Bugs Effectively <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>`_
5353
Article which goes into some detail about how to create a useful bug report.
5454
This describes what kind of information is useful and why it is useful.
5555

Doc/conf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,27 @@
77
# The contents of this file are pickled, so don't put values in the namespace
88
# that aren't pickleable (module imports are okay, they're removed automatically).
99

10+
import sys, os, time
11+
sys.path.append('tools/sphinxext')
12+
1013
# General configuration
1114
# ---------------------
1215

1316
# General substitutions.
1417
project = 'Python'
15-
copyright = '1990-2007, Python Software Foundation'
18+
copyright = '1990-%s, Python Software Foundation' % time.strftime('%Y')
1619

1720
# The default replacements for |version| and |release|.
18-
# If '<auto>', Sphinx looks for the Include/patchlevel.h file in the current Python
19-
# source tree and replaces the values accordingly.
2021
#
2122
# The short X.Y version.
2223
# version = '2.6'
23-
version = '<auto>'
2424
# The full version, including alpha/beta/rc tags.
2525
# release = '2.6a0'
26-
release = '<auto>'
26+
27+
# We look for the Include/patchlevel.h file in the current Python source tree
28+
# and replace the values accordingly.
29+
import patchlevel
30+
version, release = patchlevel.get_version_info()
2731

2832
# There are two options for replacing |today|: either, you set today to some
2933
# non-false value, then it is used:
@@ -119,7 +123,6 @@
119123
'What\'s New in Python', 'A. M. Kuchling', 'howto'),
120124
]
121125
# Collect all HOWTOs individually
122-
import os
123126
latex_documents.extend(('howto/' + fn, 'howto-' + fn[:-4] + '.tex',
124127
'HOWTO', _stdauthor, 'howto')
125128
for fn in os.listdir('howto')

Doc/extending/building.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ example below. ::
8080
description = 'This is a demo package',
8181
author = 'Martin v. Loewis',
8282
author_email = '[email protected]',
83-
url = 'http://www.python.org/doc/current/ext/building.html',
83+
url = 'http://docs.python.org/extending/building',
8484
long_description = '''
8585
This is really just a demo package.
8686
''',

Doc/howto/regex.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,8 @@ Performing Matches
335335

336336
Once you have an object representing a compiled regular expression, what do you
337337
do with it? :class:`RegexObject` instances have several methods and attributes.
338-
Only the most significant ones will be covered here; consult `the Library
339-
Reference <http://www.python.org/doc/lib/module-re.html>`_ for a complete
340-
listing.
338+
Only the most significant ones will be covered here; consult the :mod:`re` docs
339+
for a complete listing.
341340

342341
+------------------+-----------------------------------------------+
343342
| Method/Attribute | Purpose |

Doc/library/configparser.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,5 @@ The function ``opt_move`` below can be used to move options between sections::
420420
# Create non-existent section
421421
config.add_section(section2)
422422
opt_move(config, section1, section2, option)
423+
else:
424+
config.remove_option(section1, option)

Doc/library/fileformats.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ that aren't markup languages or are related to e-mail.
1616
robotparser.rst
1717
netrc.rst
1818
xdrlib.rst
19+
plistlib.rst

Doc/library/logging.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,13 +1180,13 @@ also illustrates what dict-like behaviour is needed from an arbitrary
11801180
"dict-like" object for use in the constructor::
11811181

11821182
import logging
1183-
1183+
11841184
class ConnInfo:
11851185
"""
11861186
An example class which shows how an arbitrary class can be used as
11871187
the 'extra' context information repository passed to a LoggerAdapter.
11881188
"""
1189-
1189+
11901190
def __getitem__(self, name):
11911191
"""
11921192
To allow this instance to look like a dict.
@@ -1199,7 +1199,7 @@ also illustrates what dict-like behaviour is needed from an arbitrary
11991199
else:
12001200
result = self.__dict__.get(name, "?")
12011201
return result
1202-
1202+
12031203
def __iter__(self):
12041204
"""
12051205
To allow iteration over keys, which will be merged into
@@ -1208,7 +1208,7 @@ also illustrates what dict-like behaviour is needed from an arbitrary
12081208
keys = ["ip", "user"]
12091209
keys.extend(self.__dict__.keys())
12101210
return keys.__iter__()
1211-
1211+
12121212
if __name__ == "__main__":
12131213
from random import choice
12141214
levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
@@ -2133,7 +2133,10 @@ LoggerAdapter Objects
21332133
.. versionadded:: 2.6
21342134

21352135
:class:`LoggerAdapter` instances are used to conveniently pass contextual
2136-
information into logging calls. For a usage example , see context-info_.
2136+
information into logging calls. For a usage example , see the section on
2137+
`adding contextual information to your logging output`__.
2138+
2139+
__ context-info_
21372140

21382141
.. class:: LoggerAdapter(logger, extra)
21392142

Doc/library/mmap.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ substring by assigning to a slice: ``obj[i1:i2] = '...'``. You can also read
1515
and write data starting at the current file position, and :meth:`seek` through
1616
the file to different positions.
1717

18-
A memory-mapped file is created by the :func:`mmap` function, which is different
18+
A memory-mapped file is created by the :class:`mmap` constructor, which is different
1919
on Unix and on Windows. In either case you must provide a file descriptor for a
2020
file opened for update. If you wish to map an existing Python file object, use
2121
its :meth:`fileno` method to obtain the correct value for the *fileno*
2222
parameter. Otherwise, you can open the file using the :func:`os.open` function,
2323
which returns a file descriptor directly (the file still needs to be closed when
2424
done).
2525

26-
For both the Unix and Windows versions of the function, *access* may be
26+
For both the Unix and Windows versions of the constructor, *access* may be
2727
specified as an optional keyword parameter. *access* accepts one of three
2828
values: :const:`ACCESS_READ`, :const:`ACCESS_WRITE`, or :const:`ACCESS_COPY` to
2929
specify readonly, write-through or copy-on-write memory respectively. *access*
@@ -37,11 +37,10 @@ not update the underlying file.
3737

3838
To map anonymous memory, -1 should be passed as the fileno along with the length.
3939

40-
41-
.. function:: mmap(fileno, length[, tagname[, access[, offset]]])
40+
.. class:: mmap(fileno, length[, tagname[, access[, offset]]])
4241

4342
**(Windows version)** Maps *length* bytes from the file specified by the file
44-
handle *fileno*, and returns a mmap object. If *length* is larger than the
43+
handle *fileno*, and creates a mmap object. If *length* is larger than the
4544
current size of the file, the file is extended to contain *length* bytes. If
4645
*length* is ``0``, the maximum length of the map is the current size of the
4746
file, except that if the file is empty Windows raises an exception (you cannot
@@ -59,12 +58,12 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
5958
*offset* must be a multiple of the ALLOCATIONGRANULARITY.
6059

6160

62-
.. function:: mmap(fileno, length[, flags[, prot[, access[, offset]]]])
61+
.. class:: mmap(fileno, length[, flags[, prot[, access[, offset]]]])
6362
:noindex:
6463

6564
**(Unix version)** Maps *length* bytes from the file specified by the file
6665
descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the
67-
maximum length of the map will be the current size of the file when :func:`mmap`
66+
maximum length of the map will be the current size of the file when :class:`mmap`
6867
is called.
6968

7069
*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a
@@ -85,7 +84,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
8584
be relative to the offset from the beginning of the file. *offset* defaults to 0.
8685
*offset* must be a multiple of the PAGESIZE or ALLOCATIONGRANULARITY.
8786

88-
This example shows a simple way of using :func:`mmap`::
87+
This example shows a simple way of using :class:`mmap`::
8988

9089
import mmap
9190

Doc/library/plistlib.rst

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
:mod:`plistlib` --- Generate and parse MacOS X ``.plist`` files
2+
===============================================================
3+
4+
.. module:: plistlib
5+
:synopsis: Generate and parse MacOS X plist files.
6+
.. moduleauthor:: Jack Jansen
7+
.. sectionauthor:: Georg Brandl <[email protected]>
8+
.. (harvested from docstrings in the original file)
9+
10+
.. versionchanged:: 2.6
11+
This module was previously only available in the Mac-specific library, it is
12+
now available for all platforms.
13+
14+
.. index::
15+
pair: plist; file
16+
single: property list
17+
18+
This module provides an interface for reading and writing the "property list"
19+
XML files used mainly by MacOS X.
20+
21+
The property list (``.plist``) file format is a simple XML pickle supporting
22+
basic object types, like dictionaries, lists, numbers and strings. Usually the
23+
top level object is a dictionary.
24+
25+
Values can be strings, integers, floats, booleans, tuples, lists, dictionaries
26+
(but only with string keys), :class:`Data` or :class:`datetime.datetime`
27+
objects. String values (including dictionary keys) may be unicode strings --
28+
they will be written out as UTF-8.
29+
30+
The ``<data>`` plist type is supported through the :class:`Data` class. This is
31+
a thin wrapper around a Python string. Use :class:`Data` if your strings
32+
contain control characters.
33+
34+
.. seealso::
35+
36+
`PList manual page <http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html>`
37+
Apple's documentation of the file format.
38+
39+
40+
This module defines the following functions:
41+
42+
.. function:: readPlist(pathOrFile)
43+
44+
Read a plist file. *pathOrFile* may either be a file name or a (readable)
45+
file object. Return the unpacked root object (which usually is a
46+
dictionary).
47+
48+
The XML data is parsed using the Expat parser from :mod:`xml.parsers.expat`
49+
-- see its documentation for possible exceptions on ill-formed XML.
50+
Unknown elements will simply be ignored by the plist parser.
51+
52+
53+
.. function:: writePlist(rootObject, pathOrFile)
54+
55+
Write *rootObject* to a plist file. *pathOrFile* may either be a file name
56+
or a (writable) file object.
57+
58+
A :exc:`TypeError` will be raised if the object is of an unsupported type or
59+
a container that contains objects of unsupported types.
60+
61+
62+
.. function:: readPlistFromString(data)
63+
64+
Read a plist from a string. Return the root object.
65+
66+
67+
.. function:: writePlistToString(rootObject)
68+
69+
Return *rootObject* as a plist-formatted string.
70+
71+
72+
73+
.. function:: readPlistFromResource(path[, restype='plst'[, resid=0]])
74+
75+
Read a plist from the resource with type *restype* from the resource fork of
76+
*path*. Availability: MacOS X.
77+
78+
79+
.. function:: writePlistToResource(rootObject, path[, restype='plst'[, resid=0]])
80+
81+
Write *rootObject* as a resource with type *restype* to the resource fork of
82+
*path*. Availability: MacOS X.
83+
84+
85+
The following class is available:
86+
87+
.. class:: Data(data)
88+
89+
Return a "data" wrapper object around the string *data*. This is used in
90+
functions converting from/to plists to represent the ``<data>`` type
91+
available in plists.
92+
93+
It has one attribute, :attr:`data`, that can be used to retrieve the Python
94+
string stored in it.
95+
96+
97+
Examples
98+
--------
99+
100+
Generating a plist::
101+
102+
pl = dict(
103+
aString="Doodah",
104+
aList=["A", "B", 12, 32.1, [1, 2, 3]],
105+
aFloat = 0.1,
106+
anInt = 728,
107+
aDict=dict(
108+
anotherString="<hello & hi there!>",
109+
aUnicodeValue=u'M\xe4ssig, Ma\xdf',
110+
aTrueValue=True,
111+
aFalseValue=False,
112+
),
113+
someData = Data("<binary gunk>"),
114+
someMoreData = Data("<lots of binary gunk>" * 10),
115+
aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
116+
)
117+
# unicode keys are possible, but a little awkward to use:
118+
pl[u'\xc5benraa'] = "That was a unicode key."
119+
writePlist(pl, fileName)
120+
121+
Parsing a plist::
122+
123+
pl = readPlist(pathOrFile)
124+
print pl["aKey"]

Doc/library/pydoc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ documents precisely the version of the module you would get if you started the
5757
Python interpreter and typed ``import spam``.
5858

5959
Module docs for core modules are assumed to reside in
60-
http://www.python.org/doc/current/lib/. This can be overridden by setting the
60+
http://docs.python.org/library/. This can be overridden by setting the
6161
:envvar:`PYTHONDOCS` environment variable to a different URL or to a local
6262
directory containing the Library Reference Manual pages.
6363

0 commit comments

Comments
 (0)