[Zope-Checkins] CVS: Packages/DateTime - DateTime.py:1.85.12.9
Andreas Jung
andreas at andreas-jung.com
Fri Jun 25 10:37:19 EDT 2004
Update of /cvs-repository/Packages/DateTime
In directory cvs.zope.org:/tmp/cvs-serv11882/lib/python/DateTime
Modified Files:
Tag: Zope-2_7-branch
DateTime.py
Log Message:
getting rid of unused imports and type() comparisons
=== Packages/DateTime/DateTime.py 1.85.12.8 => 1.85.12.9 ===
--- Packages/DateTime/DateTime.py:1.85.12.8 Tue Mar 2 12:25:35 2004
+++ Packages/DateTime/DateTime.py Fri Jun 25 10:37:18 2004
@@ -15,10 +15,9 @@
__version__='$Revision$'[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
try:
@@ -708,7 +707,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))
@@ -717,7 +716,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]=='-':
@@ -725,7 +724,6 @@
else:
yr,mo,dy,hr,mn,sc,tz=self._parse(arg, datefmt)
-
if not self._validDate(yr,mo,dy):
raise DateError, 'Invalid date: %s' % arg
if not self._validTime(hr,mn,int(sc)):
@@ -754,7 +752,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