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

Skip to content

Commit e0124bd

Browse files
committed
Merged revisions 69998-69999,70002,70022-70023,70025-70026,70061,70086,70145,70171,70183,70188,70235,70244,70275,70281 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r69998 | benjamin.peterson | 2009-02-26 13:04:40 -0600 (Thu, 26 Feb 2009) | 1 line the startship is rather outdated now ........ r69999 | benjamin.peterson | 2009-02-26 13:05:59 -0600 (Thu, 26 Feb 2009) | 1 line comma ........ r70002 | andrew.kuchling | 2009-02-26 16:34:30 -0600 (Thu, 26 Feb 2009) | 1 line The curses panel library is now supported ........ r70022 | georg.brandl | 2009-02-27 10:23:18 -0600 (Fri, 27 Feb 2009) | 1 line #5361: fix typo. ........ r70023 | georg.brandl | 2009-02-27 10:39:26 -0600 (Fri, 27 Feb 2009) | 1 line #5363: fix cmpfiles() docs. Another instance where a prose description is twice as long as the code. ........ r70025 | georg.brandl | 2009-02-27 10:52:55 -0600 (Fri, 27 Feb 2009) | 1 line #5344: fix punctuation. ........ r70026 | georg.brandl | 2009-02-27 10:59:03 -0600 (Fri, 27 Feb 2009) | 1 line #5365: add quick look conversion table for different time representations. ........ r70061 | hirokazu.yamamoto | 2009-02-28 09:24:00 -0600 (Sat, 28 Feb 2009) | 1 line Binary flag is needed on windows. ........ r70086 | benjamin.peterson | 2009-03-01 21:35:12 -0600 (Sun, 01 Mar 2009) | 1 line fix a silly problem of caching gone wrong #5401 ........ r70145 | benjamin.peterson | 2009-03-03 16:51:57 -0600 (Tue, 03 Mar 2009) | 1 line making the writing more formal ........ r70171 | facundo.batista | 2009-03-04 15:18:17 -0600 (Wed, 04 Mar 2009) | 3 lines Fixed a typo. ........ r70183 | benjamin.peterson | 2009-03-04 18:17:57 -0600 (Wed, 04 Mar 2009) | 1 line add example ........ r70188 | hirokazu.yamamoto | 2009-03-05 03:34:14 -0600 (Thu, 05 Mar 2009) | 1 line Fixed memory leak on failure. ........ r70235 | benjamin.peterson | 2009-03-07 18:21:17 -0600 (Sat, 07 Mar 2009) | 1 line fix funky indentation ........ r70244 | martin.v.loewis | 2009-03-08 09:06:19 -0500 (Sun, 08 Mar 2009) | 2 lines Add Chris Withers. ........ r70275 | georg.brandl | 2009-03-09 11:35:48 -0500 (Mon, 09 Mar 2009) | 2 lines Add missing space. ........ r70281 | benjamin.peterson | 2009-03-09 15:38:56 -0500 (Mon, 09 Mar 2009) | 1 line gzip and bz2 are context managers ........
1 parent 07c0a75 commit e0124bd

14 files changed

Lines changed: 78 additions & 26 deletions

File tree

Doc/howto/curses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ quirks, and provide complete lists of all the functions, attributes, and
426426
Because the curses API is so large, some functions aren't supported in the
427427
Python interface, not because they're difficult to implement, but because no one
428428
has needed them yet. Feel free to add them and then submit a patch. Also, we
429-
don't yet have support for the menus or panels libraries associated with
429+
don't yet have support for the menu library associated with
430430
ncurses; feel free to add that.
431431

432432
If you write an interesting little program, feel free to contribute it as

Doc/library/bz2.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
5858
reading. Instances support iteration in the same way as normal :class:`file`
5959
instances.
6060

61+
:class:`BZ2File` supports the :keyword:`with` statement.
62+
63+
.. versionchanged:: 2.7
64+
Support for the :keyword:`with` statement was added.
65+
6166

6267
.. method:: close()
6368

Doc/library/filecmp.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,24 @@ The :mod:`filecmp` module defines the following functions:
3131

3232
.. function:: cmpfiles(dir1, dir2, common[, shallow])
3333

34-
Returns three lists of file names: *match*, *mismatch*, *errors*. *match*
35-
contains the list of files match in both directories, *mismatch* includes the
36-
names of those that don't, and *errros* lists the names of files which could not
37-
be compared. Files may be listed in *errors* because the user may lack
38-
permission to read them or many other reasons, but always that the comparison
39-
could not be done for some reason.
40-
41-
The *common* parameter is a list of file names found in both directories. The
42-
*shallow* parameter has the same meaning and default value as for
34+
Compare the files in the two directories *dir1* and *dir2* whose names are
35+
given by *common*.
36+
37+
Returns three lists of file names: *match*, *mismatch*,
38+
*errors*. *match* contains the list of files that match, *mismatch* contains
39+
the names of those that don't, and *errors* lists the names of files which
40+
could not be compared. Files are listed in *errors* if they don't exist in
41+
one of the directories, the user lacks permission to read them or if the
42+
comparison could not be done for some other reason.
43+
44+
The *shallow* parameter has the same meaning and default value as for
4345
:func:`filecmp.cmp`.
4446

47+
For example, ``cmpfiles('a', 'b', ['c', 'd/e'])`` will compare ``a/c`` with
48+
``b/c`` and ``a/d/e`` with ``b/d/e``. ``'c'`` and ``'d/e'`` will each be in
49+
one of the three returned lists.
50+
51+
4552
Example::
4653

4754
>>> import filecmp

Doc/library/gzip.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The module defines the following items:
5353
``9`` is slowest and produces the most compression. The default is ``9``.
5454

5555
The *mtime* argument is an optional numeric timestamp to be written to
56-
the stream when compressing. All :program:`gzip`compressed streams are
56+
the stream when compressing. All :program:`gzip` compressed streams are
5757
required to contain a timestamp. If omitted or ``None``, the current
5858
time is used. This module ignores the timestamp when decompressing;
5959
however, some programs, such as :program:`gunzip`\ , make use of it.
@@ -67,6 +67,11 @@ The module defines the following items:
6767
writing as *fileobj*, and retrieve the resulting memory buffer using the
6868
:class:`StringIO` object's :meth:`getvalue` method.
6969

70+
:class:`GzipFile` supports the :keyword:`with` statement.
71+
72+
.. versionchanged:: 2.7
73+
Support for the :keyword:`with` statement was added.
74+
7075

7176
.. function:: open(filename[, mode[, compresslevel]])
7277

Doc/library/mmap.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
9393
import mmap
9494

9595
# write a simple example file
96-
with open("hello.txt", "w") as f:
96+
with open("hello.txt", "wb") as f:
9797
f.write("Hello Python!\n")
9898

99-
with open("hello.txt", "r+") as f:
99+
with open("hello.txt", "r+b") as f:
100100
# memory-map the file, size 0 means whole file
101101
map = mmap.mmap(f.fileno(), 0)
102102
# read content via standard file methods

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ The conversion types are:
12471247
+------------+-----------------------------------------------------+-------+
12481248
| ``'o'`` | Signed octal value. | \(1) |
12491249
+------------+-----------------------------------------------------+-------+
1250-
| ``'u'`` | Obselete type -- it is identical to ``'d'``. | \(7) |
1250+
| ``'u'`` | Obsolete type -- it is identical to ``'d'``. | \(7) |
12511251
+------------+-----------------------------------------------------+-------+
12521252
| ``'x'`` | Signed hexadecimal (lowercase). | \(2) |
12531253
+------------+-----------------------------------------------------+-------+

Doc/library/struct.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The module defines the following exception and functions:
4848

4949
.. function:: unpack_from(fmt, buffer[,offset=0])
5050

51-
Unpack the *buffer* according to tthe given format. The result is a tuple even
51+
Unpack the *buffer* according to the given format. The result is a tuple even
5252
if it contains exactly one item. The *buffer* must contain at least the amount
5353
of data required by the format (``len(buffer[offset:])`` must be at least
5454
``calcsize(fmt)``).

Doc/library/symtable.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ Examining Symbol Tables
164164
If the name is used as the target of a function or class statement, this
165165
will be true.
166166

167+
For example::
168+
169+
>>> table = symtable.symtable("def some_func(): pass", "string", "exec")
170+
>>> table.lookup("some_func").is_namespace()
171+
True
172+
167173
Note that a single name can be bound to multiple objects. If the result
168174
is ``True``, the name may also be bound to other objects, like an int or
169175
list, that does not introduce a new namespace.

Doc/library/time.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,25 @@ An explanation of some terminology and conventions is in order.
114114
:class:`struct_time`, or having elements of the wrong type, a :exc:`TypeError`
115115
is raised.
116116

117+
* Use the following functions to convert between time representations:
118+
119+
+-------------------------+-------------------------+-------------------------+
120+
| From | To | Use |
121+
+=========================+=========================+=========================+
122+
| seconds since the epoch | :class:`struct_time` in | :func:`gmtime` |
123+
| | UTC | |
124+
+-------------------------+-------------------------+-------------------------+
125+
| seconds since the epoch | :class:`struct_time` in | :func:`localtime` |
126+
| | local time | |
127+
+-------------------------+-------------------------+-------------------------+
128+
| :class:`struct_time` in | seconds since the epoch | :func:`calendar.timegm` |
129+
| UTC | | |
130+
+-------------------------+-------------------------+-------------------------+
131+
| :class:`struct_time` in | seconds since the epoch | :func:`mktime` |
132+
| local time | | |
133+
+-------------------------+-------------------------+-------------------------+
134+
135+
117136
The module defines the following functions and data items:
118137

119138

Doc/whatsnew/2.6.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ structure is::
274274

275275
The expression is evaluated, and it should result in an object that supports the
276276
context management protocol (that is, has :meth:`__enter__` and :meth:`__exit__`
277-
methods.
277+
methods).
278278

279279
The object's :meth:`__enter__` is called before *with-block* is executed and
280280
therefore can run set-up code. It also may return a value that is bound to the

0 commit comments

Comments
 (0)