comparison roundup/date.py @ 1186:9d69c5cdb7e7

bad RE
author Richard Jones <richard@users.sourceforge.net>
date Mon, 23 Sep 2002 07:27:23 +0000
parents 945369929bf8
children 9f533e9657e8
comparison
equal deleted inserted replaced
1185:3b0735ef8207 1186:9d69c5cdb7e7
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.30 2002-09-23 07:09:15 richard Exp $ 18 # $Id: date.py,v 1.31 2002-09-23 07:27:23 richard Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Date, time and time interval handling. 21 Date, time and time interval handling.
22 """ 22 """
23 23
213 self.day, self.hour, self.minute, self.second, 0, 0, 0)) 213 self.day, self.hour, self.minute, self.second, 0, 0, 0))
214 if str[0] == '0': return ' ' + str[1:] 214 if str[0] == '0': return ' ' + str[1:]
215 return str 215 return str
216 216
217 def set(self, spec, offset=0, date_re=re.compile(r''' 217 def set(self, spec, offset=0, date_re=re.compile(r'''
218 (((?P<y>\d{4}-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd 218 ((?P<y>\d\d\d\d-)?((?P<m>\d\d?)-(?P<d>\d\d?))?)? # yyyy-mm-dd
219 (?P<n>\.)? # . 219 (?P<n>\.)? # .
220 (((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss 220 (((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d))?)? # hh:mm:ss
221 (?P<o>.+)? # offset 221 (?P<o>.+)? # offset
222 ''', re.VERBOSE), serialised_re=re.compile(''' 222 ''', re.VERBOSE), serialised_re=re.compile(r'''
223 (\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d) 223 (\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)
224 ''', re.VERBOSE)): 224 ''', re.VERBOSE)):
225 ''' set the date to the value in spec 225 ''' set the date to the value in spec
226 ''' 226 '''
227 m = serialised_re.match(spec) 227 m = serialised_re.match(spec)

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