[Python-checkins] python/dist/src/Lib calendar.py,1.27,1.28
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
Wed, 19 Jun 2002 20:38:14 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv8954
Modified Files:
calendar.py
Log Message:
SF 570727 indexer() class no longer needed since lists now support slicing
Index: calendar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** calendar.py 23 Mar 2002 03:26:53 -0000 1.27
--- calendar.py 20 Jun 2002 03:38:12 -0000 1.28
***************
*** 10,14 ****
# Import functions and variables from time module
from time import localtime, mktime, strftime
- from types import SliceType
__all__ = ["error","setfirstweekday","firstweekday","isleap",
--- 10,13 ----
***************
*** 32,44 ****
# fresh on each call, in case the user changes locale between calls.
! class _indexer:
! def __getitem__(self, i):
! if isinstance(i, SliceType):
! return self.data[i.start : i.stop]
! else:
! # May raise an appropriate exception.
! return self.data[i]
!
! class _localized_month(_indexer):
def __init__(self, format):
self.format = format
--- 31,35 ----
# fresh on each call, in case the user changes locale between calls.
! class _localized_month:
def __init__(self, format):
self.format = format
***************
*** 48,57 ****
for j in range(1, 13)]
self.data.insert(0, "")
! return _indexer.__getitem__(self, i)
def __len__(self):
return 13
! class _localized_day(_indexer):
def __init__(self, format):
self.format = format
--- 39,48 ----
for j in range(1, 13)]
self.data.insert(0, "")
! return self.data[i]
def __len__(self):
return 13
! class _localized_day:
def __init__(self, format):
self.format = format
***************
*** 61,65 ****
self.data = [strftime(self.format, (2001, 1, j+1, 12, 0, 0, j, j+1, 0))
for j in range(7)]
! return _indexer.__getitem__(self, i)
def __len__(self_):
--- 52,56 ----
self.data = [strftime(self.format, (2001, 1, j+1, 12, 0, 0, j, j+1, 0))
for j in range(7)]
! return self.data[i]
def __len__(self_):