Style updates.

This commit is contained in:
Jeremy Fincher 2003-11-13 19:21:22 +00:00
parent 9b20e1dfb6
commit 563e5ad2bf

View File

@ -126,17 +126,18 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
self._getResponse(irc, msg, url) self._getResponse(irc, msg, url)
def ebaySnarfer(self, irc, msg, match): def ebaySnarfer(self, irc, msg, match):
r"http://cgi\.ebay\.(?:com(?:.au)?|ca|co.uk)/(?:.*?/)?(?:ws/)?"\ r"http://cgi\.ebay\.(?:com(?:.au)?|ca|co.uk)/(?:.*?/)?(?:ws/)?" \
r"eBayISAPI\.dll\?ViewItem(?:&item=\d+|&category=\d+)+" r"eBayISAPI\.dll\?ViewItem(?:&item=\d+|&category=\d+)+"
if not self.configurables.get('snarfer', channel=msg.args[0]): if not self.configurables.get('snarfer', channel=msg.args[0]):
return return
url = match.group(0) url = match.group(0)
#debug.printf(url) debug.printf(url)
self._getResponse(irc, msg, url, snarf = True) self._getResponse(irc, msg, url, snarf=True)
ebaySnarfer = privmsgs.urlSnarfer(ebaySnarfer) ebaySnarfer = privmsgs.urlSnarfer(ebaySnarfer)
_bold = lambda self, m: (ircutils.bold(m[0]),) + m[1:] def _getResponse(self, irc, msg, url, snarf=False):
def _getResponse(self, irc, msg, url, snarf = False): def bold(m):
return (ircutils.bold(m[0]),) + m[1:]
fd = urllib2.urlopen(url) fd = urllib2.urlopen(url)
s = fd.read() s = fd.read()
fd.close() fd.close()
@ -161,12 +162,12 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, plugins.Configurable):
# [:3] is to make sure that we don't pass a tuple with # [:3] is to make sure that we don't pass a tuple with
# more than 3 items. this allows self._bidder to work # more than 3 items. this allows self._bidder to work
# since self._bidder returns a 5 item tuple # since self._bidder returns a 5 item tuple
resp.append('%s: %s (%s)' % self._bold(m.groups()[:3])) resp.append('%s: %s (%s)' % bold(m.groups()[:3]))
else: else:
resp.append('%s: %s' % self._bold(m.groups())) resp.append('%s: %s' % bold(m.groups()))
if resp: if resp:
if snarf: if snarf:
irc.reply(msg, '%s' % '; '.join(resp), prefixName = False) irc.reply(msg, '%s' % '; '.join(resp), prefixName=False)
else: else:
irc.reply(msg, '%s' % '; '.join(resp)) irc.reply(msg, '%s' % '; '.join(resp))
else: else: