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

Skip to content

Commit cc62a7d

Browse files
committed
update pytz to 2010o
svn path=/branches/v1_0_maint/; revision=8876
1 parent 4c43a08 commit cc62a7d

109 files changed

Lines changed: 85 additions & 29 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/animation/animation_blit_gtk.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,28 @@
2929
# for profiling
3030
tstart = time.time()
3131

32+
def on_draw(event):
33+
background = canvas.copy_from_bbox(ax.bbox)
34+
if on_draw.background is None:
35+
gobject.idle_add(update_line)
36+
37+
on_draw.background = background
38+
39+
on_draw.background = None
40+
41+
fig.canvas.mpl_connect('draw_event', on_draw)
42+
3243
def update_line(*args):
33-
print 'you are here', update_line.cnt
34-
if update_line.background is None:
35-
update_line.background = canvas.copy_from_bbox(ax.bbox)
44+
if on_draw.background is None:
45+
return True
46+
47+
print 'frame', update_line.cnt
3648

3749
# restore the clean slate background
38-
canvas.restore_region(update_line.background)
50+
canvas.restore_region(on_draw.background)
3951
# update the data
4052
line.set_ydata(np.sin(x+update_line.cnt/10.0))
53+
4154
# just draw the animated artist
4255
ax.draw_artist(line)
4356

@@ -54,14 +67,6 @@ def update_line(*args):
5467
return True
5568

5669
update_line.cnt = 0
57-
update_line.background = None
58-
59-
60-
def start_anim(event):
61-
gobject.idle_add(update_line)
62-
canvas.mpl_disconnect(start_anim.cid)
63-
64-
start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
6570

6671

6772

examples/animation/animation_blit_gtk2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020

2121
class UpdateLine(object):
2222
def get_bg_bbox(self):
23-
23+
2424
return self.ax.bbox.padded(-3)
25-
25+
2626
def __init__(self, canvas, ax):
2727
self.cnt = 0
2828
self.canvas = canvas
@@ -31,7 +31,7 @@ def __init__(self, canvas, ax):
3131
self.prev_time = time.time()
3232
self.start_time = self.prev_time
3333
self.prev_pixel_offset = 0.
34-
34+
3535

3636
self.x0 = 0
3737
self.phases = np.random.random_sample((20,)) * np.pi * 2
@@ -70,7 +70,7 @@ def restore_background_shifted(self, dx_pixel):
7070
# restore the clean slate background
7171
self.canvas.restore_region(self.background1)
7272

73-
# restore subregion (x1+dx, y1, x2, y2) of the second bg
73+
# restore subregion (x1+dx, y1, x2, y2) of the second bg
7474
# in a offset position (x1-dx, y1)
7575
x1, y1, x2, y2 = self.background2.get_extents()
7676
self.canvas.restore_region(self.background2,
@@ -82,18 +82,18 @@ def restore_background_shifted(self, dx_pixel):
8282
def on_draw(self, *args):
8383
self.save_bg()
8484
return False
85-
85+
8686
def update_line(self, *args):
8787

8888
if self.background1 is None:
8989
return True
90-
90+
9191
cur_time = time.time()
9292
pixel_offset = int((cur_time - self.start_time)*100.)
9393
dx_pixel = pixel_offset - self.prev_pixel_offset
9494
self.prev_pixel_offset = pixel_offset
9595
dx_data = self.get_dx_data(dx_pixel) #cur_time - self.prev_time)
96-
96+
9797
x0 = self.x0
9898
self.x0 += dx_data
9999
self.prev_time = cur_time
@@ -109,7 +109,7 @@ def update_line(self, *args):
109109

110110
self.line.set_color(self.color_cycle.next())
111111

112-
# now plot line segment within [x0, x0+dx_data],
112+
# now plot line segment within [x0, x0+dx_data],
113113
# Note that we're only plotting a line between [x0, x0+dx_data].
114114
xx = np.array([x0, self.x0])
115115
self.line.set_xdata(xx)

lib/pytz/__init__.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'''
1010

1111
# The Olson database is updated several times a year.
12-
OLSON_VERSION = '2010h'
12+
OLSON_VERSION = '2010o'
1313
VERSION = OLSON_VERSION
1414
# Version format for a patch release - only one so far.
1515
#VERSION = OLSON_VERSION + '.2'
@@ -358,7 +358,7 @@ def __reduce__(self):
358358
return FixedOffset, (self._minutes, )
359359

360360
def dst(self, dt):
361-
return None
361+
return ZERO
362362

363363
def tzname(self, dt):
364364
return None
@@ -387,12 +387,16 @@ def FixedOffset(offset, _tzinfos = {}):
387387
pytz.FixedOffset(-330)
388388
>>> one.utcoffset(datetime.datetime.now())
389389
datetime.timedelta(-1, 66600)
390+
>>> one.dst(datetime.datetime.now())
391+
datetime.timedelta(0)
390392
391393
>>> two = FixedOffset(1380)
392394
>>> two
393395
pytz.FixedOffset(1380)
394396
>>> two.utcoffset(datetime.datetime.now())
395397
datetime.timedelta(0, 82800)
398+
>>> two.dst(datetime.datetime.now())
399+
datetime.timedelta(0)
396400
397401
The datetime.timedelta must be between the range of -1 and 1 day,
398402
non-inclusive.
@@ -530,6 +534,7 @@ def _test():
530534
'America/Atikokan',
531535
'America/Atka',
532536
'America/Bahia',
537+
'America/Bahia_Banderas',
533538
'America/Barbados',
534539
'America/Belem',
535540
'America/Belize',
@@ -956,6 +961,7 @@ def _test():
956961
'Pacific/Apia',
957962
'Pacific/Auckland',
958963
'Pacific/Chatham',
964+
'Pacific/Chuuk',
959965
'Pacific/Easter',
960966
'Pacific/Efate',
961967
'Pacific/Enderbury',
@@ -981,6 +987,7 @@ def _test():
981987
'Pacific/Pago_Pago',
982988
'Pacific/Palau',
983989
'Pacific/Pitcairn',
990+
'Pacific/Pohnpei',
984991
'Pacific/Ponape',
985992
'Pacific/Port_Moresby',
986993
'Pacific/Rarotonga',
@@ -1095,6 +1102,7 @@ def _test():
10951102
'America/Asuncion',
10961103
'America/Atikokan',
10971104
'America/Bahia',
1105+
'America/Bahia_Banderas',
10981106
'America/Barbados',
10991107
'America/Belem',
11001108
'America/Belize',
@@ -1155,6 +1163,7 @@ def _test():
11551163
'America/Maceio',
11561164
'America/Managua',
11571165
'America/Manaus',
1166+
'America/Marigot',
11581167
'America/Martinique',
11591168
'America/Matamoros',
11601169
'America/Mazatlan',
@@ -1195,6 +1204,8 @@ def _test():
11951204
'America/Santo_Domingo',
11961205
'America/Sao_Paulo',
11971206
'America/Scoresbysund',
1207+
'America/Shiprock',
1208+
'America/St_Barthelemy',
11981209
'America/St_Johns',
11991210
'America/St_Kitts',
12001211
'America/St_Lucia',
@@ -1220,8 +1231,10 @@ def _test():
12201231
'Antarctica/McMurdo',
12211232
'Antarctica/Palmer',
12221233
'Antarctica/Rothera',
1234+
'Antarctica/South_Pole',
12231235
'Antarctica/Syowa',
12241236
'Antarctica/Vostok',
1237+
'Arctic/Longyearbyen',
12251238
'Asia/Aden',
12261239
'Asia/Almaty',
12271240
'Asia/Amman',
@@ -1331,42 +1344,54 @@ def _test():
13311344
'Europe/Athens',
13321345
'Europe/Belgrade',
13331346
'Europe/Berlin',
1347+
'Europe/Bratislava',
13341348
'Europe/Brussels',
13351349
'Europe/Bucharest',
13361350
'Europe/Budapest',
13371351
'Europe/Chisinau',
13381352
'Europe/Copenhagen',
13391353
'Europe/Dublin',
13401354
'Europe/Gibraltar',
1355+
'Europe/Guernsey',
13411356
'Europe/Helsinki',
1357+
'Europe/Isle_of_Man',
13421358
'Europe/Istanbul',
1359+
'Europe/Jersey',
13431360
'Europe/Kaliningrad',
13441361
'Europe/Kiev',
13451362
'Europe/Lisbon',
1363+
'Europe/Ljubljana',
13461364
'Europe/London',
13471365
'Europe/Luxembourg',
13481366
'Europe/Madrid',
13491367
'Europe/Malta',
1368+
'Europe/Mariehamn',
13501369
'Europe/Minsk',
13511370
'Europe/Monaco',
13521371
'Europe/Moscow',
13531372
'Europe/Oslo',
13541373
'Europe/Paris',
1374+
'Europe/Podgorica',
13551375
'Europe/Prague',
13561376
'Europe/Riga',
13571377
'Europe/Rome',
13581378
'Europe/Samara',
1379+
'Europe/San_Marino',
1380+
'Europe/Sarajevo',
13591381
'Europe/Simferopol',
1382+
'Europe/Skopje',
13601383
'Europe/Sofia',
13611384
'Europe/Stockholm',
13621385
'Europe/Tallinn',
13631386
'Europe/Tirane',
13641387
'Europe/Uzhgorod',
13651388
'Europe/Vaduz',
1389+
'Europe/Vatican',
13661390
'Europe/Vienna',
13671391
'Europe/Vilnius',
13681392
'Europe/Volgograd',
13691393
'Europe/Warsaw',
1394+
'Europe/Zagreb',
13701395
'Europe/Zaporozhye',
13711396
'Europe/Zurich',
13721397
'GMT',
@@ -1384,6 +1409,7 @@ def _test():
13841409
'Pacific/Apia',
13851410
'Pacific/Auckland',
13861411
'Pacific/Chatham',
1412+
'Pacific/Chuuk',
13871413
'Pacific/Easter',
13881414
'Pacific/Efate',
13891415
'Pacific/Enderbury',
@@ -1409,14 +1435,13 @@ def _test():
14091435
'Pacific/Pago_Pago',
14101436
'Pacific/Palau',
14111437
'Pacific/Pitcairn',
1412-
'Pacific/Ponape',
1438+
'Pacific/Pohnpei',
14131439
'Pacific/Port_Moresby',
14141440
'Pacific/Rarotonga',
14151441
'Pacific/Saipan',
14161442
'Pacific/Tahiti',
14171443
'Pacific/Tarawa',
14181444
'Pacific/Tongatapu',
1419-
'Pacific/Truk',
14201445
'Pacific/Wake',
14211446
'Pacific/Wallis',
14221447
'US/Alaska',

lib/pytz/tests/test_tzinfo.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
# I test for expected version to ensure the correct version of pytz is
1818
# actually being tested.
19-
EXPECTED_VERSION='2010h'
19+
EXPECTED_VERSION='2010o'
2020

2121
fmt = '%Y-%m-%d %H:%M:%S %Z%z'
2222

@@ -44,6 +44,7 @@ def prettydt(dt):
4444
dt.hour, dt.minute, dt.second,
4545
dt.tzname(), offset)
4646

47+
4748
class BasicTest(unittest.TestCase):
4849

4950
def testVersion(self):
@@ -643,6 +644,28 @@ def no_testCreateLocaltime(self):
643644
'2004-10-31 02:00:00 CET+0100'
644645
)
645646

647+
648+
class CommonTimezonesTestCase(unittest.TestCase):
649+
def test_bratislava(self):
650+
# Bratislava is the default timezone for Slovakia, but our
651+
# heuristics where not adding it to common_timezones. Ideally,
652+
# common_timezones should be populated from zone.tab at runtime,
653+
# but I'm hesitant to pay the startup cost as loading the list
654+
# on demand whilst remaining backwards compatible seems
655+
# difficult.
656+
self.failUnless('Europe/Bratislava' in pytz.common_timezones)
657+
self.failUnless('Europe/Bratislava' in pytz.common_timezones_set)
658+
659+
def test_us_eastern(self):
660+
self.failUnless('US/Eastern' in pytz.common_timezones)
661+
self.failUnless('US/Eastern' in pytz.common_timezones_set)
662+
663+
def test_belfast(self):
664+
# Belfast uses London time.
665+
self.failUnless('Europe/Belfast' in pytz.all_timezones_set)
666+
self.failIf('Europe/Belfast' in pytz.common_timezones)
667+
self.failIf('Europe/Belfast' in pytz.common_timezones_set)
668+
646669
def test_suite():
647670
suite = unittest.TestSuite()
648671
suite.addTest(doctest.DocTestSuite('pytz'))
@@ -651,6 +674,7 @@ def test_suite():
651674
suite.addTest(unittest.defaultTestLoader.loadTestsFromModule(test_tzinfo))
652675
return suite
653676

677+
654678
if __name__ == '__main__':
655679
unittest.main(defaultTest='test_suite')
656680

lib/pytz/zoneinfo/Africa/Bamako

16 Bytes
Binary file not shown.

lib/pytz/zoneinfo/Africa/Cairo

28 Bytes
Binary file not shown.
44 Bytes
Binary file not shown.

lib/pytz/zoneinfo/Africa/Conakry

16 Bytes
Binary file not shown.
16 Bytes
Binary file not shown.

lib/pytz/zoneinfo/Africa/Kampala

16 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)