A bit of cleanup work, mostly on the python zegrep portion of debfile

This commit is contained in:
Daniel DiPaolo 2003-09-15 02:45:39 +00:00
parent 6c898a8757
commit 467688de74

View File

@ -121,13 +121,16 @@ class Debian(callbacks.Privmsg, PeriodicFileDownloader):
# that).
regexp = privmsgs.getArgs(args).lstrip('^/')
try:
r = re.compile(regexp, re.I)
except re.error, e:
irc.error(msg, )
re_obj = re.compile(regexp, re.I)
except:
irc.error(msg, "Error in filename: %s" % regexp)
return
if self.usePythonZegrep:
r = gzip.open(self.contents)
r = ifilter(imap(lambda line: r.search(line), fd))
fd = gzip.open(self.contents)
r = imap(lambda tup: tup[0], \
ifilter(lambda tup: tup[0], \
imap(lambda line: (re_obj.search(line), line),
fd)))
(r, w) = popen2.popen4(['zegrep', regexp, self.contents])
packages = sets.Set() # Make packages unique
try: