summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 149c7ad..e243255 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -45,7 +45,7 @@ mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class _localized_month:
- _months = [datetime.date(2001, i+1, 1).strftime for i in xrange(12)]
+ _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
_months.insert(0, lambda x: "")
def __init__(self, format):
@@ -65,7 +65,7 @@ class _localized_month:
class _localized_day:
# January 1, 2001, was a Monday.
- _days = [datetime.date(2001, 1, i+1).strftime for i in xrange(7)]
+ _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)]
def __init__(self, format):
self.format = format
@@ -144,7 +144,7 @@ class Calendar(object):
Return a iterator for one week of weekday numbers starting with the
configured first one.
"""
- for i in xrange(self.firstweekday, self.firstweekday + 7):
+ for i in range(self.firstweekday, self.firstweekday + 7):
yield i%7
def itermonthdates(self, year, month):
@@ -192,7 +192,7 @@ class Calendar(object):
Each row represents a week; week entries are datetime.date values.
"""
dates = list(self.itermonthdates(year, month))
- return [ dates[i:i+7] for i in xrange(0, len(dates), 7) ]
+ return [ dates[i:i+7] for i in range(0, len(dates), 7) ]
def monthdays2calendar(self, year, month):
"""
@@ -202,7 +202,7 @@ class Calendar(object):
are zero.
"""
days = list(self.itermonthdays2(year, month))
- return [ days[i:i+7] for i in xrange(0, len(days), 7) ]
+ return [ days[i:i+7] for i in range(0, len(days), 7) ]
def monthdayscalendar(self, year, month):
"""
@@ -210,7 +210,7 @@ class Calendar(object):
Each row represents a week; days outside this month are zero.
"""
days = list(self.itermonthdays(year, month))
- return [ days[i:i+7] for i in xrange(0, len(days), 7) ]
+ return [ days[i:i+7] for i in range(0, len(days), 7) ]
def yeardatescalendar(self, year, width=3):
"""
@@ -221,9 +221,9 @@ class Calendar(object):
"""
months = [
self.monthdatescalendar(year, i)
- for i in xrange(January, January+12)
+ for i in range(January, January+12)
]
- return [months[i:i+width] for i in xrange(0, len(months), width) ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
def yeardays2calendar(self, year, width=3):
"""
@@ -234,9 +234,9 @@ class Calendar(object):
"""
months = [
self.monthdays2calendar(year, i)
- for i in xrange(January, January+12)
+ for i in range(January, January+12)
]
- return [months[i:i+width] for i in xrange(0, len(months), width) ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
def yeardayscalendar(self, year, width=3):
"""
@@ -246,9 +246,9 @@ class Calendar(object):
"""
months = [
self.monthdayscalendar(year, i)
- for i in xrange(January, January+12)
+ for i in range(January, January+12)
]
- return [months[i:i+width] for i in xrange(0, len(months), width) ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
class TextCalendar(Calendar):
@@ -341,7 +341,7 @@ class TextCalendar(Calendar):
header = self.formatweekheader(w)
for (i, row) in enumerate(self.yeardays2calendar(theyear, m)):
# months in this row
- months = xrange(m*i+1, min(m*(i+1)+1, 13))
+ months = range(m*i+1, min(m*(i+1)+1, 13))
a('\n'*l)
names = (self.formatmonthname(theyear, k, colwidth, False)
for k in months)
@@ -352,7 +352,7 @@ class TextCalendar(Calendar):
a('\n'*l)
# max number of weeks for this row
height = max(len(cal) for cal in row)
- for j in xrange(height):
+ for j in range(height):
weeks = []
for cal in row:
if j >= len(cal):
@@ -444,9 +444,9 @@ class HTMLCalendar(Calendar):
a('<table border="0" cellpadding="0" cellspacing="0" class="year">')
a('\n')
a('<tr><th colspan="%d" class="year">%s</th></tr>' % (width, theyear))
- for i in xrange(January, January+12, width):
+ for i in range(January, January+12, width):
# months in this row
- months = xrange(i, min(i+width, 13))
+ months = range(i, min(i+width, 13))
a('<tr>')
for m in months:
a('<td>')