diff options
author | Stefan Ritter <xeno@thehappy.de> | 2010-10-27 10:48:59 +0200 |
---|---|---|
committer | Stefan Ritter <xeno@thehappy.de> | 2010-10-27 10:48:59 +0200 |
commit | 2c6a8be20696109da04cc812d49e31f74595fe25 (patch) | |
tree | c563f04375b434d5efc17f25a5f3fbb096d72517 | |
parent | e377f73f70c37ad5cd73afbd083f695f3af28fee (diff) |
Some small fixes
-rwxr-xr-x | wnpp-query.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/wnpp-query.py b/wnpp-query.py index d0157bb..b49e21c 100755 --- a/wnpp-query.py +++ b/wnpp-query.py @@ -10,7 +10,8 @@ # Author: Stefan Ritter <xeno@thehappy.de> # Description: Query Debian WNPP pages -import urllib2, sys, re +import sys, re +from urllib2 import urlopen from optparse import OptionParser parser = OptionParser() @@ -28,11 +29,10 @@ if not options.min_days_old and not options.max_days_old or not options.itp and if not options.min_days_old: options.min_days_old = 0 if not options.max_days_old: options.max_days_old = 9999 -if options.itp: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/being_packaged') -else: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requested') +if options.itp: url = urlopen('http://www.debian.org/devel/wnpp/being_packaged') +else: url = urlopen('http://www.debian.org/devel/wnpp/requested') -reports = [] -item = [] +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\>,)') @@ -70,12 +70,12 @@ for line in url: if line_match_age.match(line): if options.itp: if in_prep_yesterday.match(line): days = '1' - elif in_prep_today.match(line): days = '0' - else: days = line.split(' ')[0] + elif in_prep_today.match(line): days = '0' + else: 0 days = line.split(' ')[0] else: - if req_yesterday.match(line): days = '1' - elif req_today.match(line): days = '0' - else: days = line.split(' ')[1] + if req_yesterday.match(line): days = '1' + elif req_today.match(line): days = '0' + else: days = line.split(' ')[1] item.append(days) if len(item) == 4: @@ -91,3 +91,4 @@ for entry in reports: entry[2] = re.sub(''', '\'', entry[2]) print entry[3], 'days ago:', entry[1], entry[0], entry[2] +# vim: set tw=0 ts=4: |