|
From: <ef...@us...> - 2010-06-06 20:34:17
|
Revision: 8388
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8388&view=rev
Author: efiring
Date: 2010-06-06 20:34:09 +0000 (Sun, 06 Jun 2010)
Log Message:
-----------
[3009273] and [2875065] update dateutil to 1.5
Modified Paths:
--------------
trunk/matplotlib/lib/dateutil/NEWS
trunk/matplotlib/lib/dateutil/__init__.py
trunk/matplotlib/lib/dateutil/easter.py
trunk/matplotlib/lib/dateutil/parser.py
trunk/matplotlib/lib/dateutil/relativedelta.py
trunk/matplotlib/lib/dateutil/rrule.py
trunk/matplotlib/lib/dateutil/tz.py
Added Paths:
-----------
trunk/matplotlib/lib/dateutil/zoneinfo/zoneinfo-2010g.tar.gz
Removed Paths:
-------------
trunk/matplotlib/lib/dateutil/zoneinfo/zoneinfo-2008e.tar.gz
Modified: trunk/matplotlib/lib/dateutil/NEWS
===================================================================
--- trunk/matplotlib/lib/dateutil/NEWS 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/NEWS 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,3 +1,19 @@
+
+Version 1.5
+-----------
+
+- As reported by Mathieu Bridon, rrules were matching the bysecond rules
+ incorrectly against byminute in some circumstances when the SECONDLY
+ frequency was in use, due to a copy & paste bug. The problem has been
+ unittested and corrected.
+
+- Adam Ryan reported a problem in the relativedelta implementation which
+ affected the yearday parameter in the month of January specifically.
+ This has been unittested and fixed.
+
+- Updated timezone information.
+
+
Version 1.4.1
-------------
Modified: trunk/matplotlib/lib/dateutil/__init__.py
===================================================================
--- trunk/matplotlib/lib/dateutil/__init__.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/__init__.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,9 +1,9 @@
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2010 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
"""
__author__ = "Gustavo Niemeyer <gu...@ni...>"
__license__ = "PSF License"
-__version__ = "1.2-mpl"
+__version__ = "1.5"
Modified: trunk/matplotlib/lib/dateutil/easter.py
===================================================================
--- trunk/matplotlib/lib/dateutil/easter.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/easter.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,5 +1,5 @@
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2007 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
@@ -70,23 +70,23 @@
if method < 3:
# Old method
i = (19*g+15)%30
- j = (y+y/4+i)%7
+ j = (y+y//4+i)%7
if method == 2:
# Extra dates to convert Julian to Gregorian date
e = 10
if y > 1600:
- e = e+y/100-16-(y/100-16)/4
+ e = e+y//100-16-(y//100-16)//4
else:
# New method
- c = y/100
- h = (c-c/4-(8*c+13)/25+19*g+15)%30
- i = h-(h/28)*(1-(h/28)*(29/(h+1))*((21-g)/11))
- j = (y+y/4+i+2-c+c/4)%7
+ c = y//100
+ h = (c-c//4-(8*c+13)//25+19*g+15)%30
+ i = h-(h//28)*(1-(h//28)*(29//(h+1))*((21-g)//11))
+ j = (y+y//4+i+2-c+c//4)%7
# p can be from -6 to 56 corresponding to dates 22 March to 23 May
# (later dates apply to method 2, although 23 May never actually occurs)
p = i-j+e
- d = 1+(p+27+(p+6)/40)%31
- m = 3+(p+26)/30
- return datetime.date(y,m,d)
+ d = 1+(p+27+(p+6)//40)%31
+ m = 3+(p+26)//30
+ return datetime.date(int(y),int(m),int(d))
Modified: trunk/matplotlib/lib/dateutil/parser.py
===================================================================
--- trunk/matplotlib/lib/dateutil/parser.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/parser.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,6 +1,6 @@
# -*- coding:iso-8859-1 -*-
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2007 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
@@ -8,17 +8,24 @@
__author__ = "Gustavo Niemeyer <gu...@ni...>"
__license__ = "PSF License"
-import os.path
+import datetime
import string
+import time
import sys
-import time
+import os
-import datetime
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+
import relativedelta
import tz
+
__all__ = ["parse", "parserinfo"]
+
# Some pointers:
#
# http://www.cl.cam.ac.uk/~mgk25/iso-time.html
@@ -28,12 +35,9 @@
# http://search.cpan.org/author/MUIR/Time-modules-2003.0211/lib/Time/ParseDate.pm
# http://stein.cshl.org/jade/distrib/docs/java.text.SimpleDateFormat.html
-try:
- from cStringIO import StringIO
-except ImportError:
- from StringIO import StringIO
-class _timelex:
+class _timelex(object):
+
def __init__(self, instream):
if isinstance(instream, basestring):
instream = StringIO(instream)
@@ -139,6 +143,7 @@
return list(cls(s))
split = classmethod(split)
+
class _resultbase(object):
def __init__(self):
@@ -156,8 +161,9 @@
def __repr__(self):
return self._repr(self.__class__.__name__)
-class parserinfo:
+class parserinfo(object):
+
# m from a.m/p.m, t from ISO T separator
JUMP = [" ", ".", ",", ";", "-", "/", "'",
"at", "on", "and", "ad", "m", "t", "of",
@@ -204,7 +210,7 @@
self.yearfirst = yearfirst
self._year = time.localtime().tm_year
- self._century = self._year/100*100
+ self._century = self._year//100*100
def _convert(self, lst):
dct = {}
@@ -281,15 +287,10 @@
return True
-class parser:
+class parser(object):
- def __init__(self, info=parserinfo):
- if issubclass(info, parserinfo):
- self.info = parserinfo()
- elif isinstance(info, parserinfo):
- self.info = info
- else:
- raise TypeError, "Unsupported parserinfo type"
+ def __init__(self, info=None):
+ self.info = info or parserinfo()
def parse(self, timestr, default=None,
ignoretz=False, tzinfos=None,
@@ -360,9 +361,11 @@
# Check if it's a number
try:
- value = float(l[i])
+ value_repr = l[i]
+ value = float(value_repr)
except ValueError:
value = None
+
if value is not None:
# Token is a number
len_li = len(l[i])
@@ -386,10 +389,7 @@
# 19990101T235959[.59]
res.hour = int(s[:2])
res.minute = int(s[2:4])
- value = float(s[4:])
- res.second = int(value)
- if value%1:
- res.microsecond = int(1000000*(value%1))
+ res.second, res.microsecond = _parsems(s[4:])
elif len_li == 8:
# YYYYMMDD
s = l[i-1]
@@ -423,15 +423,15 @@
if value%1:
res.second = int(60*(value%1))
elif idx == 2:
- res.second = int(value)
- if value%1:
- res.microsecond = int(1000000*(value%1))
+ res.second, res.microsecond = \
+ _parsems(value_repr)
i += 1
if i >= len_l or idx == 2:
break
# 12h00
try:
- value = float(l[i])
+ value_repr = l[i]
+ value = float(value_repr)
except ValueError:
break
else:
@@ -451,10 +451,7 @@
res.second = int(60*(value%1))
i += 1
if i < len_l and l[i] == ':':
- value = float(l[i+1])
- res.second = int(value)
- if value%1:
- res.microsecond = int(1000000*(value%1))
+ res.second, res.microsecond = _parsems(l[i+1])
i += 2
elif i < len_l and l[i] in ('-', '/', '.'):
sep = l[i]
@@ -699,8 +696,9 @@
else:
return DEFAULTPARSER.parse(timestr, **kwargs)
-class _tzparser:
+class _tzparser(object):
+
class _result(_resultbase):
__slots__ = ["stdabbr", "stdoffset", "dstabbr", "dstoffset",
@@ -743,6 +741,8 @@
if (i < len_l and
(l[i] in ('+', '-') or l[i][0] in "0123456789")):
if l[i] in ('+', '-'):
+ # Yes, that's right. See the TZ variable
+ # documentation.
signal = (1,-1)[l[i] == '+']
i += 1
else:
@@ -865,11 +865,22 @@
except (IndexError, ValueError, AssertionError):
return None
-
+
return res
+
DEFAULTTZPARSER = _tzparser()
def _parsetz(tzstr):
return DEFAULTTZPARSER.parse(tzstr)
+
+def _parsems(value):
+ """Parse a I[.F] seconds value into (seconds, microseconds)."""
+ if "." not in value:
+ return int(value), 0
+ else:
+ i, f = value.split(".")
+ return int(i), int(f.ljust(6, "0")[:6])
+
+
# vim:ts=4:sw=4:et
Modified: trunk/matplotlib/lib/dateutil/relativedelta.py
===================================================================
--- trunk/matplotlib/lib/dateutil/relativedelta.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/relativedelta.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,5 +1,5 @@
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2010 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
@@ -190,7 +190,7 @@
if yday <= ydays:
self.month = idx+1
if idx == 0:
- self.day = ydays
+ self.day = yday
else:
self.day = yday-ydayidx[idx-1]
break
@@ -201,27 +201,27 @@
def _fix(self):
if abs(self.microseconds) > 999999:
- s = self.microseconds/abs(self.microseconds)
+ s = self.microseconds//abs(self.microseconds)
div, mod = divmod(self.microseconds*s, 1000000)
self.microseconds = mod*s
self.seconds += div*s
if abs(self.seconds) > 59:
- s = self.seconds/abs(self.seconds)
+ s = self.seconds//abs(self.seconds)
div, mod = divmod(self.seconds*s, 60)
self.seconds = mod*s
self.minutes += div*s
if abs(self.minutes) > 59:
- s = self.minutes/abs(self.minutes)
+ s = self.minutes//abs(self.minutes)
div, mod = divmod(self.minutes*s, 60)
self.minutes = mod*s
self.hours += div*s
if abs(self.hours) > 23:
- s = self.hours/abs(self.hours)
+ s = self.hours//abs(self.hours)
div, mod = divmod(self.hours*s, 24)
self.hours = mod*s
self.days += div*s
if abs(self.months) > 11:
- s = self.months/abs(self.months)
+ s = self.months//abs(self.months)
div, mod = divmod(self.months*s, 12)
self.months = mod*s
self.years += div*s
@@ -235,7 +235,7 @@
def _set_months(self, months):
self.months = months
if abs(self.months) > 11:
- s = self.months/abs(self.months)
+ s = self.months//abs(self.months)
div, mod = divmod(self.months*s, 12)
self.months = mod*s
self.years = div*s
Modified: trunk/matplotlib/lib/dateutil/rrule.py
===================================================================
--- trunk/matplotlib/lib/dateutil/rrule.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/rrule.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,5 +1,5 @@
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2010 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
@@ -439,7 +439,7 @@
(freq >= MINUTELY and
self._byminute and minute not in self._byminute) or
(freq >= SECONDLY and
- self._bysecond and minute not in self._bysecond)):
+ self._bysecond and second not in self._bysecond)):
timeset = ()
else:
timeset = gettimeset(hour, minute, second)
Modified: trunk/matplotlib/lib/dateutil/tz.py
===================================================================
--- trunk/matplotlib/lib/dateutil/tz.py 2010-06-06 18:58:43 UTC (rev 8387)
+++ trunk/matplotlib/lib/dateutil/tz.py 2010-06-06 20:34:09 UTC (rev 8388)
@@ -1,5 +1,5 @@
"""
-Copyright (c) 2003-2005 Gustavo Niemeyer <gu...@ni...>
+Copyright (c) 2003-2007 Gustavo Niemeyer <gu...@ni...>
This module offers extensions to the standard python 2.3+
datetime module.
@@ -438,7 +438,7 @@
# The documentation says that utcoffset()-dst() must
# be constant for every dt.
- return self._find_ttinfo(dt, laststd=1).delta-tti.delta
+ return tti.delta-self._find_ttinfo(dt, laststd=1).delta
# An alternative for that would be:
#
@@ -492,12 +492,12 @@
self._dst_offset = self._std_offset+datetime.timedelta(hours=+1)
else:
self._dst_offset = ZERO
- if start is None:
+ if dstabbr and start is None:
self._start_delta = relativedelta.relativedelta(
hours=+2, month=4, day=1, weekday=relativedelta.SU(+1))
else:
self._start_delta = start
- if end is None:
+ if dstabbr and end is None:
self._end_delta = relativedelta.relativedelta(
hours=+1, month=10, day=31, weekday=relativedelta.SU(-1))
else:
@@ -524,7 +524,7 @@
def _isdst(self, dt):
if not self._start_delta:
return False
- year = datetime.date(dt.year,1,1)
+ year = datetime.datetime(dt.year,1,1)
start = year+self._start_delta
end = year+self._end_delta
dt = dt.replace(tzinfo=None)
@@ -563,6 +563,11 @@
if res is None:
raise ValueError, "unknown string format"
+ # Here we break the compatibility with the TZ variable handling.
+ # GMT-3 actually *means* the timezone -3.
+ if res.stdabbr in ("GMT", "UTC"):
+ res.stdoffset *= -1
+
# We must initialize it first, since _delta() needs
# _std_offset and _dst_offset set. Use False in start/end
# to avoid building it two times.
@@ -570,9 +575,13 @@
res.dstabbr, res.dstoffset,
start=False, end=False)
- self._start_delta = self._delta(res.start)
- if self._start_delta:
- self._end_delta = self._delta(res.end, isend=1)
+ if not res.dstabbr:
+ self._start_delta = None
+ self._end_delta = None
+ else:
+ self._start_delta = self._delta(res.start)
+ if self._start_delta:
+ self._end_delta = self._delta(res.end, isend=1)
def _delta(self, x, isend=0):
kwargs = {}
@@ -753,6 +762,8 @@
else:
i += 1
+ tzid = None
+ comps = []
invtz = False
comptype = None
for line in lines:
Deleted: trunk/matplotlib/lib/dateutil/zoneinfo/zoneinfo-2008e.tar.gz
===================================================================
(Binary files differ)
Added: trunk/matplotlib/lib/dateutil/zoneinfo/zoneinfo-2010g.tar.gz
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/dateutil/zoneinfo/zoneinfo-2010g.tar.gz
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|