comparison roundup/date.py @ 3210:ea29d69f7415

fix error message formatting in Date.__init__; fix vim modeline
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Fri, 25 Feb 2005 17:20:42 +0000
parents 6feac4fcf883
children 4a5893bfd70d
comparison
equal deleted inserted replaced
3208:d4d58c36d0bf 3210:ea29d69f7415
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: date.py,v 1.79 2005-02-14 00:06:54 richard Exp $ 18 # $Id: date.py,v 1.80 2005-02-25 17:15:47 a1s Exp $
19 19
20 """Date, time and time interval handling. 20 """Date, time and time interval handling.
21 """ 21 """
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
148 self.year, self.month, self.day, self.hour, self.minute, \ 148 self.year, self.month, self.day, self.hour, self.minute, \
149 self.second, x, x, x = time.gmtime(ts) 149 self.second, x, x, x = time.gmtime(ts)
150 # we lost the fractional part 150 # we lost the fractional part
151 self.second = self.second + frac 151 self.second = self.second + frac
152 except: 152 except:
153 raise ValueError, 'Unknown spec %r'%spec 153 raise ValueError, 'Unknown spec %r' % (spec,)
154 154
155 def set(self, spec, offset=0, date_re=re.compile(r''' 155 def set(self, spec, offset=0, date_re=re.compile(r'''
156 ((?P<y>\d\d\d\d)([/-](?P<m>\d\d?)([/-](?P<d>\d\d?))?)? # yyyy[-mm[-dd]] 156 ((?P<y>\d\d\d\d)([/-](?P<m>\d\d?)([/-](?P<d>\d\d?))?)? # yyyy[-mm[-dd]]
157 |(?P<a>\d\d?)[/-](?P<b>\d\d?))? # or mm-dd 157 |(?P<a>\d\d?)[/-](?P<b>\d\d?))? # or mm-dd
158 (?P<n>\.)? # . 158 (?P<n>\.)? # .
937 print `Date(date) + Interval(interval)` 937 print `Date(date) + Interval(interval)`
938 938
939 if __name__ == '__main__': 939 if __name__ == '__main__':
940 test() 940 test()
941 941
942 # vim: set filetype=python ts=4 sw=4 et si 942 # vim: set filetype=python sts=4 sw=4 et si :

Roundup Issue Tracker: http://roundup-tracker.org/