|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: date.py,v 1.81 2005-03-03 04:49:16 richard Exp $ |
| 18 | +# $Id: date.py,v 1.82 2005-06-08 03:47:09 anthonybaxter Exp $ |
19 | 19 |
|
20 | 20 | """Date, time and time interval handling. |
21 | 21 | """ |
22 | 22 | __docformat__ = 'restructuredtext' |
23 | 23 |
|
24 | 24 | import time, re, calendar |
25 | | -from types import * |
26 | 25 | import i18n |
27 | 26 |
|
28 | 27 | try: |
@@ -483,9 +482,9 @@ def __init__(self, spec, sign=1, allowdate=1, add_granularity=0, |
483 | 482 | ): |
484 | 483 | """Construct an interval given a specification.""" |
485 | 484 | self.setTranslator(translator) |
486 | | - if type(spec) in (IntType, FloatType, LongType): |
| 485 | + if isinstance(spec, (int, float, long)): |
487 | 486 | self.from_seconds(spec) |
488 | | - elif type(spec) in (StringType, UnicodeType): |
| 487 | + elif isinstance(spec, basestring): |
489 | 488 | self.set(spec, allowdate=allowdate, add_granularity=add_granularity) |
490 | 489 | elif isinstance(spec, Interval): |
491 | 490 | (self.sign, self.year, self.month, self.day, self.hour, |
|
0 commit comments