[Zope3-checkins] CVS: Zope3/src/datetime - __init__.py:1.3 _datetime.py:1.22

Tim Peters tim.one@comcast.net
Wed, 8 Jan 2003 15:18:56 -0500


Update of /cvs-repository/Zope3/src/datetime
In directory cvs.zope.org:/tmp/cvs-serv7272/src/datetime

Modified Files:
	__init__.py _datetime.py 
Log Message:
Collapsing datetime and datetimetz into datetime, and time and timetz
into time, as discussed on Zope3-Dev.


=== Zope3/src/datetime/__init__.py 1.2 => 1.3 ===
--- Zope3/src/datetime/__init__.py:1.2	Wed Dec 25 09:12:11 2002
+++ Zope3/src/datetime/__init__.py	Wed Jan  8 15:18:23 2003
@@ -7,6 +7,5 @@
 
 from datetime._datetime import MINYEAR, MAXYEAR
 from datetime._datetime import timedelta
-from datetime._datetime import time, timetz
-from datetime._datetime import date, datetime, datetimetz
+from datetime._datetime import time, date, datetime
 from datetime._datetime import tzinfo


=== Zope3/src/datetime/_datetime.py 1.21 => 1.22 === (951/1051 lines abridged)
--- Zope3/src/datetime/_datetime.py:1.21	Sat Jan  4 13:33:23 2003
+++ Zope3/src/datetime/_datetime.py	Wed Jan  8 15:18:23 2003
@@ -849,168 +849,12 @@
         yhi, ylo, self.__month, self.__day = map(ord, string)
         self.__year = yhi * 256 + ylo
 
+_date_class = date  # so functions w/ args named "date" can get at the class
+
 date.min = date(1, 1, 1)
 date.max = date(9999, 12, 31)
 date.resolution = timedelta(days=1)
 
-
-class time(object):
-    """Concrete time type.
-
-    Constructors:
-
-    __init__()
-
-    Operators:
-
-    __repr__, __str__
-    __cmp__, __hash__
-
-    Methods:
-
-    strftime()
-    isoformat()
-
-    Properties (readonly):
-    hour, minute, second, microsecond
-    """
-
-    def __init__(self, hour=0, minute=0, second=0, microsecond=0):
-        """Constructor.
-
-        Arguments:
-
-        hour, minute (required)
-        second, microsecond (default to zero)
-        """
-        _check_time_fields(hour, minute, second, microsecond)
-        self.__hour = hour
-        self.__minute = minute
-        self.__second = second
-        self.__microsecond = microsecond
-
-    # Read-only field accessors
-    hour = property(lambda self: self.__hour, doc="hour (0-23)")

[-=- -=- -=- 951 lines omitted -=- -=- -=-]

-    return _timetz_unpickler, (state,)
+    return _time_unpickler, (state,)
 
-def _timetz_unpickler(state):
-    self = timetz()
+def _time_unpickler(state):
+    self = time()
     self.__setstate__(state)
     return self
 
-def _datetimetz_pickler(dtz):
+def _datetime_pickler(dtz):
     state = dtz.__getstate__()
-    return _datetimetz_unpickler, (state,)
+    return _datetime_unpickler, (state,)
 
-def _datetimetz_unpickler(state):
-    self = datetimetz(1, 1, 1)
+def _datetime_unpickler(state):
+    self = datetime(1, 1, 1)
     self.__setstate__(state)
     return self
 
 # Register pickle/unpickle functions.
 from copy_reg import pickle
 pickle(date, _date_pickler, _date_unpickler)
-pickle(datetime, _datetime_pickler, _datetime_unpickler)
-pickle(time, _time_pickler, _time_unpickler)
 pickle(tzinfo, _tzinfo_pickler, _tzinfo_unpickler)
-pickle(timetz, _timetz_pickler, _timetz_unpickler)
-pickle(datetimetz, _datetimetz_pickler, _datetimetz_unpickler)
+pickle(time, _time_pickler, _time_unpickler)
+pickle(datetime, _datetime_pickler, _datetime_unpickler)
 del pickle
 
 """
-Some time zone algebra.  For a datetimetz x, let
+Some time zone algebra.  For a datetime x, let
     x.n = x stripped of its timezone -- its naive time.
     x.o = x.utcoffset(), and assuming that doesn't raise an exception or
           return None
@@ -1920,7 +1637,7 @@
 (meaning that the various tzinfo methods exist, and don't blow up or return
 None when called).
 
-The function wants to return a datetimetz y with timezone tz, equivalent to x.
+The function wants to return a datetime y with timezone tz, equivalent to x.
 
 By #3, we want