1616import calendar
1717from re import compile as re_compile
1818from re import sub as re_sub
19- from re import ASCII , IGNORECASE
19+ from re import IGNORECASE
2020from re import escape as re_escape
2121from datetime import (date as datetime_date ,
2222 timedelta as datetime_timedelta ,
@@ -290,7 +290,7 @@ def __init__(self, locale_time=None):
290290 'f' : r"(?P<f>[0-9]{1,6})" ,
291291 'H' : r"(?P<H>2[0-3]|[0-1][0-9]|[0-9])" ,
292292 'I' : r"(?P<I>1[0-2]|0[1-9]|[1-9]| [1-9])" ,
293- 'G' : r"(?P<G>[0-9][0-9][0-9][0-9] )" ,
293+ 'G' : r"(?P<G>[0-9]{4} )" ,
294294 'j' : r"(?P<j>36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|0[1-9][0-9]|00[1-9]|[1-9][0-9]|0[1-9]|[1-9])" ,
295295 'm' : r"(?P<m>1[0-2]|0[1-9]|[1-9])" ,
296296 'M' : r"(?P<M>[0-5][0-9]|[0-9])" ,
@@ -300,8 +300,8 @@ def __init__(self, locale_time=None):
300300 'u' : r"(?P<u>[1-7])" ,
301301 'V' : r"(?P<V>5[0-3]|0[1-9]|[1-4][0-9]|[0-9])" ,
302302 # W is set below by using 'U'
303- 'y' : r"(?P<y>[0-9][0-9] )" ,
304- 'Y' : r"(?P<Y>[0-9][0-9][0-9][0-9] )" ,
303+ 'y' : r"(?P<y>[0-9]{2} )" ,
304+ 'Y' : r"(?P<Y>[0-9]{4} )" ,
305305 'z' : r"(?P<z>[+-][0-9][0-9]:?[0-5][0-9](:?[0-5][0-9](\.[0-9]{1,6})?)?|(?-i:Z))" ,
306306 'A' : self .__seqToRE (self .locale_time .f_weekday , 'A' ),
307307 'a' : self .__seqToRE (self .locale_time .a_weekday , 'a' ),
0 commit comments