mò wH(?(?(?\D)s(?P=sep)s(?!\d)tymdtdmytmdys(?P[012]?\d)s(?P[0-6]\d)s(?P[0-6]\d(?:\.\d+)?)t:s(?::s)?ièicCs6d|jo djno|t}n|}|S(sÏ According to ISO 8601, a two-digit year in an all-numeric date expression refers to the current century. If year has exactly two digits, add the century. Otherwise, return it unchanged. iidN(tyeart _THIS_CENTURYtresult(RR((tG/data/zmath/lib/python2.4/site-packages/mx/DateTime/Examples/numdate.pyt_iso_add_century>s s ymd mdy dmycCs^|d jod Snd }|iƒ}t|ƒdj}t|ƒi ƒ}t|ƒ}|d joÉ|i ƒo¼|d} | d}|d}tt|d| !ƒƒ} t|| |!ƒ}t|||!ƒ} yti| || ƒ}WqZtij o0}d }|otid||f‚q)qZXn.x|D]ý} t| iƒ}|i|ƒ} | d joq4n| idƒ}| id ƒ}| id ƒ}tt|ƒƒ} t|ƒ}t|ƒ} yti| || ƒ}Wn?tij o0}d }|otid||f‚qnX|d j oPq4q4W|d jo|ot"d |‚n|S(sØ If the input string s is a valid numeric date expression according to one of the formats given, return a DateTime object with default time components. Date formats, separated by a single space character, are packed into a string. If only one date format is given, raise a ValueError if the string cannot be interpreted, and raise a DateTime RangeError if it can be interpreted but is not a valid date. If more than one date format is given, try each of them in order until a valid interpretation is found. If the string does not represent a valid date, return None. You can use one format twice (e.g. ['ymd', 'ymd']) to test only one format but suppress exceptions. iiiiiis'%s' invalid: %sRtmonthtdaysunrecognized date format: '%s'N(ii(#tstNonetdttformatstsplitt formatlisttlent exceptions_oktstrtstript_stlen_stisdigittk0tk1tk2RtinttyytmmtddtDateTimet RangeErrortwhytformatt _formatdicttlowert format_retsearchtmatchtgroupRR R t ValueError(R RRRRRR RRRR'R"RRR R R!R%RR((Rt numericDateKsT   #     c CsÜ|djodSnd}ti|ƒ}|dj o¡|idƒ}|idƒ}|idƒ}t |ƒ}t |ƒ}|ot |ƒ}nd}ytid|||ƒ}WqØtij o d}qØXn|S(s¶ If the input string s is a valid time expression of the form hh:mm:ss.sss or hh:mm:ss or hh:mm, return a corresponding DateTimeDelta object. Otherwise, return None. thourtminutetsecondf0.0iN(R R R t_timeRER&R'R(R+R,R-RthhRtfloattssRt DateTimeDeltaR ( R RR1R+R-R,R R/R'((Rt numericTimeˆs$  cCs¥|djodSnt|ƒiƒiddƒ}|iƒ}t|d|ƒ}|dj oBt |ƒdjo/t |dƒ}|dj o||}q¡n|S(NtTt ii(R R RRtreplaceRRt date_timeR*RtdRR3tt(R RR7R8RR9((RtnumericDateTime s    cCsd}|oyyCt|dƒ}||djod|dt|ƒf}nWqþtj o#}d|dt |ƒf}qþXnyyFt |d|ƒ}||djod|dt|ƒf}nWn/tj o#}d|dt |ƒf}nX|S(Niis>>> '%s' --> %ss>>> '%s' -- %s( R RttimeonlyR3ttestcasetdtd0treprt ExceptionteRR:Rtdt0(R<RR;R=R@RRA((Rt_test_it²s"#"c Cs€dkl}dtiddddƒfdtiddddƒfd tiddddƒfd tfd tid d dƒfdtid d dƒfdtid d ddddƒfdtid d ddddƒfdtid d dƒfdtid d dƒfdtid d dƒfdtid d ddddƒfdtid d ddddƒfdtid d dƒfdtid d dƒfdtid d ddddƒfdtid d ddddƒfdtid d dƒfdtid d dƒfdtid d ddddƒfdtid d dƒfd tid d dƒfd!tid d ddddƒfg}d"d#i|iƒƒGH|ƒ}d}x¹t d$ƒD]«}xQ|dd!D]B}t||d%d&ƒ}|d&}|o |djo |GHnqÅWxN|dD]B}t||d%dƒ}|d&}|o |djo |GHnqWq±W|ƒ}d'|||fGHdS((N(sclocks 12:13:14.56ii i f14.56s12:13:14is12:13sCeci n'est pas une datet010803iÑiit20010803s20010803 12:13:14.56s20010803T12:13:14.56s01-08-03s 2001-08-03s2001-8-3s2001-08-03 12:13:14.56s2001-08-03T12:13:14.56s 08/03/2001s8/3/2001s08/03/2001 12:13:14.56s08/03/2001T12:13:14.56s 08/23/2001is 8/23/2001s08/23/2001 12:13:14.56s 23.08.2001s 23.8.2001s23.08.2001 12:13:14.56s% Testing numdate.py with format(s) %ss, idR;is$Done - %d cases tested in %1.5f sec.(ttimetclockRR2R t testcasestjoinRRtt0tcasestrangetiR<RBRtt1( RRFRLRIR<RGRRJRM((RttestÄs. ÿÿr       t__main__( t__doc__tmxRtret_yeart_montht_dayt_ymdt_dmyt_mdytcompiletIt_ymdREt_dmyREt_mdyRER#t_hourt_minutet_secondt_timeR.tdivmodtnowRRRR*R3R:RBRNt__name__(R3RR^RXRVR_RRR[RNRBR:R#RTRRRSR`RUR.R*RWRaR]R\((Rt?!s4  !  =    2