28
# svn diff http://svn.python.org/projects/python/tags/r252 http://svn.python.org/projects/python/branches/release25-maint
28
# svn diff http://svn.python.org/projects/python/tags/r253 http://svn.python.org/projects/python/branches/release25-maint
29
29
# diff -urN --exclude=.svn Python-2.5 svn
31
Index: Doc/dist/dist.tex
32
===================================================================
33
--- Doc/dist/dist.tex (.../tags/r252) (Revision 67348)
34
+++ Doc/dist/dist.tex (.../branches/release25-maint) (Revision 67348)
36
be included in the source distribution:
38
\item all files in the Distutils ``build'' tree (default \file{build/})
39
-\item all files in directories named \file{RCS}, \file{CVS} or \file{.svn}
40
+\item all files in directories named \file{RCS}, \file{CVS}, \file{.svn},
41
+ \file{.hg}, \file{.git}, \file{.bzr}, or \file{\_darcs}
43
Now we have our complete list of files, which is written to the manifest
44
for future reference, and then used to build the source distribution
46
\code{prune} command in the manifest template comes after the
47
\code{recursive-include} command
48
\item exclude the entire \file{build} tree, and any \file{RCS},
49
- \file{CVS} and \file{.svn} directories
50
+ \file{CVS}, \file{.svn}, \file{.hg}, \file{.git}, \file{.bzr}, or
51
+ \file{\_darcs} directories
53
Just like in the setup script, file and directory names in the manifest
54
template should always be slash-separated; the Distutils will take care
55
Index: Doc/lib/emailmessage.tex
56
===================================================================
57
--- Doc/lib/emailmessage.tex (.../tags/r252) (Revision 67348)
58
+++ Doc/lib/emailmessage.tex (.../branches/release25-maint) (Revision 67348)
62
\begin{methoddesc}[Message]{as_string}{\optional{unixfrom}}
63
-Return the entire message flatten as a string. When optional
64
+Return the entire message flattened as a string. When optional
65
\var{unixfrom} is \code{True}, the envelope header is included in the
66
returned string. \var{unixfrom} defaults to \code{False}.
68
Index: Doc/lib/tzinfo-examples.py
69
===================================================================
70
--- Doc/lib/tzinfo-examples.py (.../tags/r252) (Revision 67348)
71
+++ Doc/lib/tzinfo-examples.py (.../branches/release25-maint) (Revision 67348)
73
dt += timedelta(days_to_go)
76
-# In the US, DST starts at 2am (standard time) on the first Sunday in April.
77
-DSTSTART = datetime(1, 4, 1, 2)
78
-# and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct.
79
-# which is the first Sunday on or after Oct 25.
80
-DSTEND = datetime(1, 10, 25, 1)
84
+# This is a simplified (i.e., wrong for a few cases) set of rules for US
85
+# DST start and end times. For a complete and up-to-date set of DST rules
86
+# and timezone definitions, visit the Olson Database (or try pytz):
87
+# http://www.twinsun.com/tz/tz-link.htm
88
+# http://sourceforge.net/projects/pytz/ (might not be up-to-date)
90
+# In the US, since 2007, DST starts at 2am (standard time) on the second
91
+# Sunday in March, which is the first Sunday on or after Mar 8.
92
+DSTSTART_2007 = datetime(1, 3, 8, 2)
93
+# and ends at 2am (DST time; 1am standard time) on the first Sunday of Nov.
94
+DSTEND_2007 = datetime(1, 11, 1, 1)
95
+# From 1987 to 2006, DST used to start at 2am (standard time) on the first
96
+# Sunday in April and to end at 2am (DST time; 1am standard time) on the last
97
+# Sunday of October, which is the first Sunday on or after Oct 25.
98
+DSTSTART_1987_2006 = datetime(1, 4, 1, 2)
99
+DSTEND_1987_2006 = datetime(1, 10, 25, 1)
100
+# From 1967 to 1986, DST used to start at 2am (standard time) on the last
101
+# Sunday in April (the one on or after April 24) and to end at 2am (DST time;
102
+# 1am standard time) on the last Sunday of October, which is the first Sunday
103
+# on or after Oct 25.
104
+DSTSTART_1967_1986 = datetime(1, 4, 24, 2)
105
+DSTEND_1967_1986 = DSTEND_1987_2006
107
class USTimeZone(tzinfo):
109
def __init__(self, hours, reprname, stdname, dstname):
110
@@ -122,10 +142,20 @@
112
assert dt.tzinfo is self
114
- # Find first Sunday in April & the last in October.
115
- start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year))
116
- end = first_sunday_on_or_after(DSTEND.replace(year=dt.year))
117
+ # Find start and end times for US DST. For years before 1967, return
120
+ dststart, dstend = DSTSTART_2007, DSTEND_2007
121
+ elif 1986 < dt.year < 2007:
122
+ dststart, dstend = DSTSTART_1987_2006, DSTEND_1987_2006
123
+ elif 1966 < dt.year < 1987:
124
+ dststart, dstend = DSTSTART_1967_1986, DSTEND_1967_1986
128
+ start = first_sunday_on_or_after(dststart.replace(year=dt.year))
129
+ end = first_sunday_on_or_after(dstend.replace(year=dt.year))
131
# Can't compare naive to aware objects, so strip the timezone from
133
if start <= dt.replace(tzinfo=None) < end:
134
Index: Doc/lib/libitertools.tex
135
===================================================================
136
--- Doc/lib/libitertools.tex (.../tags/r252) (Revision 67348)
137
+++ Doc/lib/libitertools.tex (.../branches/release25-maint) (Revision 67348)
141
def chain(*iterables):
142
+ # chain('ABC', 'DEF') --> A B C D E F
150
+ # count(10) --> 10 11 12 13 14 ...
158
+ # cycle('ABCD') --> A B C D A B C D A B C D ...
160
for element in iterable:
165
def dropwhile(predicate, iterable):
166
+ # dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1
167
iterable = iter(iterable)
173
class groupby(object):
174
+ # [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
175
+ # [(list(g)) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
176
def __init__(self, iterable, key=None):
182
def ifilter(predicate, iterable):
183
+ # ifilter(lambda x: x%2, range(10)) --> 1 3 5 7 9
184
if predicate is None:
190
def ifilterfalse(predicate, iterable):
191
+ # ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8
192
if predicate is None:
198
def imap(function, *iterables):
199
+ # imap(pow, (2,3,10), (5,2,3)) --> 32 9 1000
200
iterables = map(iter, iterables)
202
args = [i.next() for i in iterables]
206
def islice(iterable, *args):
207
+ # islice('ABCDEFG', 2) --> A B
208
+ # islice('ABCDEFG', 2, 4) --> C D
209
+ # islice('ABCDEFG', 2, None) --> C D E F G
210
+ # islice('ABCDEFG', 0, None, 2) --> A C E G
212
it = iter(xrange(s.start or 0, s.stop or sys.maxint, s.step or 1))
217
def izip(*iterables):
218
+ # izip('ABCD', 'xy') --> Ax By
219
iterables = map(iter, iterables)
221
result = [it.next() for it in iterables]
225
def repeat(object, times=None):
226
+ # repeat(10, 3) --> 10 10 10
233
def starmap(function, iterable):
234
+ # starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000
235
iterable = iter(iterable)
237
yield function(*iterable.next())
241
def takewhile(predicate, iterable):
242
+ # takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4
250
->>> amounts = [120.15, 764.05, 823.14]
251
->>> for checknum, amount in izip(count(1200), amounts):
252
-... print 'Check %d is for $%.2f' % (checknum, amount)
254
-Check 1200 is for $120.15
255
-Check 1201 is for $764.05
256
-Check 1202 is for $823.14
259
->>> for cube in imap(operator.pow, xrange(1,5), repeat(3)):
267
->>> reportlines = ['EuroPython', 'Roster', '', 'alex', '', 'laura',
268
- '', 'martin', '', 'walter', '', 'mark']
269
->>> for name in islice(reportlines, 3, None, 2):
270
-... print name.title()
278
# Show a dictionary sorted and grouped by value
279
>>> from operator import itemgetter
280
>>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3)
282
def pairwise(iterable):
283
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
287
- except StopIteration:
293
def grouper(n, iterable, padvalue=None):
295
"Return a new dict with swapped keys and values"
296
return dict(izip(d.itervalues(), d))
298
+def roundrobin(*iterables):
299
+ "roundrobin('abc', 'd', 'ef') --> 'a', 'd', 'e', 'b', 'f', 'c'"
300
+ # Recipe credited to George Sakkis
301
+ pending = len(iterables)
302
+ nexts = cycle(iter(it).next for it in iterables)
307
+ except StopIteration:
309
+ nexts = cycle(islice(nexts, pending))
311
+def powerset(iterable):
312
+ "powerset('ab') --> set([]), set(['a']), set(['b']), set(['a', 'b'])"
313
+ # Recipe credited to Eric Raymond
314
+ pairs = [(2**i, x) for i, x in enumerate(iterable)]
315
+ for n in xrange(2**len(pairs)):
316
+ yield set(x for m, x in pairs if m&n)
319
Index: Doc/lib/libuserdict.tex
320
===================================================================
321
--- Doc/lib/libuserdict.tex (.../tags/r252) (Revision 67348)
322
+++ Doc/lib/libuserdict.tex (.../branches/release25-maint) (Revision 67348)
324
greatly simplifies writing classes that need to be substitutable for
325
dictionaries (such as the shelve module).
327
-This also module defines a class, \class{UserDict}, that acts as a wrapper
328
+This module also defines a class, \class{UserDict}, that acts as a wrapper
329
around dictionary objects. The need for this class has been largely
330
supplanted by the ability to subclass directly from \class{dict} (a feature
331
that became available starting with Python version 2.2). Prior to the
332
Index: Doc/inst/inst.tex
333
===================================================================
334
--- Doc/inst/inst.tex (.../tags/r252) (Revision 67348)
335
+++ Doc/inst/inst.tex (.../branches/release25-maint) (Revision 67348)
337
Paths can be absolute or relative, in which case they're relative to
338
the directory containing the \file{.pth} file. Any directories added
339
to the search path will be scanned in turn for \file{.pth} files. See
340
-\citetitle[http://www.python.org/doc/devel/lib/module-site.html]
341
+\citetitle[http://docs.python.org/lib/module-site.html]
342
{site module documentation} for more information.
344
A slightly less convenient way is to edit the \file{site.py} file in