diff options
author | niemeyer <> | 2007-11-20 00:07:34 +0000 |
---|---|---|
committer | niemeyer <> | 2007-11-20 00:07:34 +0000 |
commit | d0bbacbaa23fa53ae8ac0225f4a7a324ee47a1a4 (patch) | |
tree | 9c5c2b68401eebc70baef5a322dadba43ac732f2 | |
parent | 2e30204106e746d8ebe3ca013244212e1728ff16 (diff) | |
download | dateutil-d0bbacbaa23fa53ae8ac0225f4a7a324ee47a1a4.tar.gz |
All code is now compatible with new-style division.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | dateutil/__init__.py | 2 | ||||
-rw-r--r-- | dateutil/easter.py | 20 | ||||
-rw-r--r-- | dateutil/parser.py | 2 | ||||
-rw-r--r-- | dateutil/relativedelta.py | 14 | ||||
-rw-r--r-- | dateutil/rrule.py | 2 | ||||
-rw-r--r-- | dateutil/tz.py | 2 |
7 files changed, 23 insertions, 21 deletions
@@ -14,6 +14,8 @@ Version 1.3 - Version is now published in dateutil.__version__, as requested by Darren Dale. +- All code is compatible with new-style division. + Version 1.2 ----------- diff --git a/dateutil/__init__.py b/dateutil/__init__.py index e126992..bc9aeb3 100644 --- a/dateutil/__init__.py +++ b/dateutil/__init__.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> +Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. diff --git a/dateutil/easter.py b/dateutil/easter.py index e55afdb..d794410 100644 --- a/dateutil/easter.py +++ b/dateutil/easter.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> +Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. @@ -70,23 +70,23 @@ def easter(year, method=EASTER_WESTERN): 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)) diff --git a/dateutil/parser.py b/dateutil/parser.py index 2f34b77..951c09e 100644 --- a/dateutil/parser.py +++ b/dateutil/parser.py @@ -210,7 +210,7 @@ class parserinfo(object): 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 = {} diff --git a/dateutil/relativedelta.py b/dateutil/relativedelta.py index cdb63b3..562a7d3 100644 --- a/dateutil/relativedelta.py +++ b/dateutil/relativedelta.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> +Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. @@ -201,27 +201,27 @@ Here is the behavior of operations with relativedelta: 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 @@ Here is the behavior of operations with relativedelta: 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 diff --git a/dateutil/rrule.py b/dateutil/rrule.py index 2167d52..4c21d2d 100644 --- a/dateutil/rrule.py +++ b/dateutil/rrule.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> +Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. diff --git a/dateutil/tz.py b/dateutil/tz.py index 208a7e7..61fe2c1 100644 --- a/dateutil/tz.py +++ b/dateutil/tz.py @@ -1,5 +1,5 @@ """ -Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> +Copyright (c) 2003-2007 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. |