Precompile all remaining regexp

This commit is contained in:
Stefan Ritter 2009-11-03 15:00:34 +01:00
parent 071730a33c
commit 605a5f6c93

View file

@ -34,9 +34,14 @@ else: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requeste
reports = []
item = []
line_match = re.compile('(^(.*)bugs\.debian\.org(.*)$|^requested(.*)$|^in preparation since(.*)$|^(.*)days in preparation\.$)')
line_match_desc = re.compile('(^\<ul\>(.*),|^ \<li\>\<a href(.*)\</a\>,)')
line_match_age = re.compile('(^requested(.*)$|^(.*)days in preparation(.*)$|^in preparation since(.*)$)')
line_match = re.compile('(^(.*)bugs\.debian\.org(.*)$|^requested(.*)$|^in preparation since(.*)$|^(.*)days in preparation\.$)')
line_match_desc = re.compile('(^\<ul\>(.*),|^ \<li\>\<a href(.*)\</a\>,)')
line_match_age = re.compile('(^requested(.*)$|^(.*)days in preparation(.*)$|^in preparation since(.*)$)')
req_today = re.compile('^requested today\.$')
req_yesterday = re.compile('^requested yesterday\.$')
in_prep_today = re.compile('^in preparation since today\.$')
in_prep_yesterday = re.compile('^in preparation since yesterday\.$)
for line in url:
if re.match(line_match, line):
@ -64,12 +69,12 @@ for line in url:
if re.match(line_match_age, line):
if options.itp:
if re.match('^in preparation since yesterday\.$', line): days = '1'
elif re.match('^in preparation since today\.$', line): days = '0'
if re.match(in_prep_yesterday, line): days = '1'
elif re.match(in_prep_today, line): days = '0'
else: days = line.split(' ')[0]
else:
if re.match('^requested yesterday\.$', line): days = '1'
elif re.match('^requested today\.$', line): days = '0'
if re.match(req_yesterday, line): days = '1'
elif re.match(req_today, line): days = '0'
else: days = line.split(' ')[1]
item.append(days)