[Zope-Checkins] SVN: Zope/trunk/lib/python/DateTime/DateTime.py - removed unused imports

Andreas Jung andreas at andreas-jung.com
Fri Jun 25 10:42:18 EDT 2004


Log message for revision 25982:
- removed unused imports
- replaced type() comparisons with faster isinstance() calls



-=-
Modified: Zope/trunk/lib/python/DateTime/DateTime.py
===================================================================
--- Zope/trunk/lib/python/DateTime/DateTime.py	2004-06-25 14:32:00 UTC (rev 25981)
+++ Zope/trunk/lib/python/DateTime/DateTime.py	2004-06-25 14:42:18 UTC (rev 25982)
@@ -15,10 +15,9 @@
 __version__='$Revision: 1.99 $'[11:-2]
 
 
-import os, re, math,  DateTimeZone
-from time import time, gmtime, localtime, asctime
+import re, math,  DateTimeZone
+from time import time, gmtime, localtime
 from time import daylight, timezone, altzone, strftime
-from types import InstanceType, IntType, FloatType, StringType, UnicodeType
 
 from App.config import getConfiguration
 
@@ -689,7 +688,7 @@
             if arg=='':
                 raise SyntaxError, arg
 
-            if type(arg) in [StringType,UnicodeType] and arg.lower() in self._tzinfo._zidx:
+            if isinstance(arg, (unicode, str)) and arg.lower() in self._tzinfo._zidx:
                 # Current time, to be displayed in specified timezone
                 t,tz=time(),self._tzinfo._zmap[arg.lower()]
                 ms=(t-math.floor(t))
@@ -698,7 +697,7 @@
                 x = _calcDependentSecond(tz, t)
                 yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, ms)
 
-            elif type(arg) in [StringType,UnicodeType]:
+            elif isinstance(arg, (unicode, str)):
                 # Date/time string
 
                 if arg.find(' ')==-1 and arg[4]=='-':
@@ -735,7 +734,7 @@
                 sc=sc+ms
 
         elif ac==2:
-            if type(args[1])==StringType:
+            if isinstance(args[1], str):
                 # Seconds from epoch (gmt) and timezone
                 t,tz=args
                 ms = (t - math.floor(t))



More information about the Zope-Checkins mailing list