def joins(channels, keys=None, prefix="", msg=None): """Returns a JOIN to each of channels.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if keys is None: keys = [] assert len(keys) <= len(channels), "Got more keys than channels." if not keys: return IrcMsg(prefix=prefix, command="JOIN", args=(",".join(channels),), msg=msg) else: for key in keys: if conf.supybot.protocols.irc.strictRfc(): assert ( key.translate(utils.str.chars, utils.str.chars[128:]) == key and "\x00" not in key and "\r" not in key and "\n" not in key and "\f" not in key and "\t" not in key and "\v" not in key and " " not in key ) return IrcMsg(prefix=prefix, command="JOIN", args=(",".join(channels), ",".join(keys)), msg=msg)
def joins(channels, keys=None, prefix='', msg=None): """Returns a JOIN to each of channels.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if keys is None: keys = [] assert len(keys) <= len(channels), 'Got more keys than channels.' if not keys: return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels),), msg=msg) else: for key in keys: if conf.supybot.protocols.irc.strictRfc(): assert key.translate(utils.str.chars, utils.str.chars[128:])==key and \ '\x00' not in key and \ '\r' not in key and \ '\n' not in key and \ '\f' not in key and \ '\t' not in key and \ '\v' not in key and \ ' ' not in key return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels), ','.join(keys)), msg=msg)
def joins(channels, keys=None, prefix='', msg=None): """Returns a JOIN to each of channels.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if keys is None: keys = [] assert len(keys) <= len(channels), 'Got more keys than channels.' if not keys: return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels), ), msg=msg) else: for key in keys: if conf.supybot.protocols.irc.strictRfc(): assert key.translate(utils.str.chars, utils.str.chars[128:])==key and \ '\x00' not in key and \ '\r' not in key and \ '\n' not in key and \ '\f' not in key and \ '\t' not in key and \ '\v' not in key and \ ' ' not in key return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels), ','.join(keys)), msg=msg)
def bug(self, irc, msg, args, bug): """<num> Returns a description of the bug with bug id <num>. """ url = 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s' % bug try: text = utils.web.getUrl(url).decode() except utils.web.Error as e: irc.error(str(e), Raise=True) if "There is no record of Bug" in text: irc.error('I could not find a bug report matching that number.', Raise=True) searches = list(map(lambda p: p.search(text), self._searches)) sev = self._severity.search(text) tags = self._tags.search(text) # This section should be cleaned up to ease future modifications if all(None, searches): L = map(self.bold, ('Package', 'Subject', 'Reported')) resp = format('%s: %%s; %s: %%s; %s: by %%s on %%s', *L) L = map(utils.web.htmlToText, map(lambda p: p.group(1), searches)) resp = format(resp, *L) if sev: sev = list(filter(None, sev.groups())) if sev: sev = utils.web.htmlToText(sev[0]) resp += format('; %s: %s', self.bold('Severity'), sev) if tags: resp += format('; %s: %s', self.bold('Tags'), tags.group(1)) resp += format('; %u', url) irc.reply(resp) else: irc.error('I was unable to properly parse the BTS page.')
def bug(self, irc, msg, args, bug): """<num> Returns a description of the bug with bug id <num>. """ url = 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s' % bug try: text = utils.web.getUrl(url).decode() except utils.web.Error as e: irc.error(str(e), Raise=True) if "There is no record of Bug" in text: irc.error('I could not find a bug report matching that number.', Raise=True) searches = map(lambda p: p.search(text), self._searches) sev = self._severity.search(text) tags = self._tags.search(text) # This section should be cleaned up to ease future modifications if all(None, searches): L = map(self.bold, ('Package', 'Subject', 'Reported')) resp = format('%s: %%s; %s: %%s; %s: by %%s on %%s', *L) L = map(utils.web.htmlToText, map(lambda p: p.group(1), searches)) resp = format(resp, *L) if sev: sev = filter(None, sev.groups()) if sev: sev = utils.web.htmlToText(sev[0]) resp += format('; %s: %s', self.bold('Severity'), sev) if tags: resp += format('; %s: %s', self.bold('Tags'), tags.group(1)) resp += format('; %u', url) irc.reply(resp) else: irc.error('I was unable to properly parse the BTS page.')
def devoices(channel, nicks, prefix="", msg=None): """Returns a MODE to devoice each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert nicks, "Nicks must not be empty." assert all(isNick, nicks), nicks if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command="MODE", msg=msg, args=(channel, "-" + ("v" * len(nicks))) + tuple(nicks))
def unquiets(channel, hostmasks, prefix="", msg=None): """Returns a MODE to unquiet each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isUserHostmask, hostmasks), hostmasks modes = [("-q", s) for s in hostmasks] if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command="MODE", args=[channel] + ircutils.joinModes(modes), msg=msg)
def unbans(channel, hostmasks, prefix='', msg=None): """Returns a MODE to unban each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isUserHostmask, hostmasks), hostmasks if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', msg=msg, args=(channel, '-' + ('b'*len(hostmasks)), hostmasks))
def devoices(channel, nicks, prefix='', msg=None): """Returns a MODE to devoice each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert nicks, 'Nicks must not be empty.' assert all(isNick, nicks), nicks if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', msg=msg, args=(channel, '-' + ('v'*len(nicks))) + tuple(nicks))
def parts(channels, s="", prefix="", msg=None): """Returns a PART from each of channels with the message msg.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if s: return IrcMsg(prefix=prefix, command="PART", args=(",".join(channels), s), msg=msg) else: return IrcMsg(prefix=prefix, command="PART", args=(",".join(channels),), msg=msg)
def voices(channel, nicks, prefix='', msg=None): """Returns a MODE to voice each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert nicks, 'Nicks must not be empty.' assert all(isNick, nicks) if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', msg=msg, args=(channel, '+' + ('v'*len(nicks))) + tuple(nicks))
def bans(channel, hostmasks, exceptions=(), prefix='', msg=None): """Returns a MODE to ban each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isUserHostmask, hostmasks), hostmasks modes = [('+b', s) for s in hostmasks] + [('+e', s) for s in exceptions] if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', args=[channel] + ircutils.joinModes(modes), msg=msg)
def unbans(channel, hostmasks, prefix='', msg=None): """Returns a MODE to unban each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isUserHostmask, hostmasks), hostmasks modes = [('-b', s) for s in hostmasks] if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', args=[channel] + ircutils.joinModes(modes), msg=msg)
def unbans(channel, hostmasks, prefix='', msg=None): """Returns a MODE to unban each of nicks on channel.""" if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isUserHostmask, hostmasks), hostmasks if msg and not prefix: prefix = msg.prefix return IrcMsg(prefix=prefix, command='MODE', msg=msg, args=(channel, '-' + ('b' * len(hostmasks)), hostmasks))
def __init__(self, s="", command="", args=(), prefix="", msg=None): assert not (msg and s), "IrcMsg.__init__ cannot accept both s and msg" if not s and not command and not msg: raise MalformedIrcMsg, "IRC messages require a command." self._str = None self._repr = None self._hash = None self._len = None self.tags = {} self.identified = False if s: originalString = s try: if not s.endswith("\n"): s += "\n" self._str = s if s[0] == ":": self.prefix, s = s[1:].split(None, 1) else: self.prefix = "" if " :" in s: # Note the space: IPV6 addresses are bad w/o it. s, last = s.split(" :", 1) self.args = s.split() self.args.append(last.rstrip("\r\n")) else: self.args = s.split() self.command = self.args.pop(0) except (IndexError, ValueError): raise MalformedIrcMsg, repr(originalString) else: if msg is not None: if prefix: self.prefix = prefix else: self.prefix = msg.prefix if command: self.command = command else: self.command = msg.command if args: self.args = args else: self.args = msg.args self.tags = msg.tags.copy() else: self.prefix = prefix self.command = command assert all(ircutils.isValidArgument, args) self.args = args self.args = tuple(self.args) if isUserHostmask(self.prefix): (self.nick, self.user, self.host) = ircutils.splitHostmask(self.prefix) else: (self.nick, self.user, self.host) = (self.prefix,) * 3
def __init__(self, s='', command='', args=(), prefix='', msg=None): assert not (msg and s), 'IrcMsg.__init__ cannot accept both s and msg' if not s and not command and not msg: raise MalformedIrcMsg, 'IRC messages require a command.' self._str = None self._repr = None self._hash = None self._len = None self.tags = {} if s: originalString = s try: if not s.endswith('\n'): s += '\n' self._str = s if s[0] == ':': self.prefix, s = s[1:].split(None, 1) else: self.prefix = '' if ' :' in s: # Note the space: IPV6 addresses are bad w/o it. s, last = s.split(' :', 1) self.args = s.split() self.args.append(last.rstrip('\r\n')) else: self.args = s.split() self.command = self.args.pop(0) except (IndexError, ValueError): raise MalformedIrcMsg, repr(originalString) else: if msg is not None: if prefix: self.prefix = prefix else: self.prefix = msg.prefix if command: self.command = command else: self.command = msg.command if args: self.args = args else: self.args = msg.args self.tags = msg.tags.copy() else: self.prefix = prefix self.command = command assert all(ircutils.isValidArgument, args) self.args = args self.args = tuple(self.args) if isUserHostmask(self.prefix): (self.nick, self.user, self.host) = ircutils.splitHostmask(self.prefix) else: (self.nick, self.user, self.host) = (self.prefix, ) * 3
def kicks(channel, nicks, s="", prefix="", msg=None): """Returns a KICK to kick each of nicks from channel with the message msg. """ if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isNick, nicks), nicks if msg and not prefix: prefix = msg.prefix if s: return IrcMsg(prefix=prefix, command="KICK", args=(channel, ",".join(nicks), s), msg=msg) else: return IrcMsg(prefix=prefix, command="KICK", args=(channel, ",".join(nicks)), msg=msg)
def parts(channels, s='', prefix='', msg=None): """Returns a PART from each of channels with the message msg.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels), s), msg=msg) else: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels),), msg=msg)
def _list(self, group): L = [] for (vname, v) in group._children.items(): if hasattr(group, 'channelValue') and group.channelValue and \ ircutils.isChannel(vname) and not v._children: continue if hasattr(v, 'channelValue') and v.channelValue: vname = '#' + vname if v._added and not all(ircutils.isChannel, v._added): vname = '@' + vname L.append(vname) utils.sortBy(str.lower, L) return L
def _list(self, group): L = [] for (vname, v) in group._children.iteritems(): if hasattr(group, 'channelValue') and group.channelValue and \ ircutils.isChannel(vname) and not v._children: continue if hasattr(v, 'channelValue') and v.channelValue: vname = '#' + vname if v._added and not all(ircutils.isChannel, v._added): vname = '@' + vname L.append(vname) utils.sortBy(str.lower, L) return L
def parts(channels, s='', prefix='', msg=None): """Returns a PART from each of channels with the message msg.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if sys.version_info[0] < 3 and isinstance(s, unicode): s = s.encode('utf8') assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels), s), msg=msg) else: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels),), msg=msg)
def parts(channels, s='', prefix='', msg=None): """Returns a PART from each of channels with the message msg.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if s: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels), s), msg=msg) else: return IrcMsg(prefix=prefix, command='PART', args=(','.join(channels), ), msg=msg)
def testStandardSubstitute(self): irc = getTestIrc() irc.state.channels = {'#foo': holder()} f = ircutils.standardSubstitute msg = ircmsgs.privmsg('#foo', 'filler', prefix='biff!quux@xyzzy') irc._tagMsg(msg) s = f(irc, msg, '$rand') try: int(s) except ValueError: self.fail('$rand wasn\'t an int.') s = f(irc, msg, '$randomInt') try: int(s) except ValueError: self.fail('$randomint wasn\'t an int.') self.assertEqual(f(irc, msg, '$botnick'), irc.nick) self.assertEqual(f(irc, msg, '$who'), msg.nick) self.assertEqual(f(irc, msg, '$WHO'), msg.nick, 'stand. sub. not case-insensitive.') self.assertEqual(f(irc, msg, '$nick'), msg.nick) self.assertNotEqual(f(irc, msg, '$randomdate'), '$randomdate') q = f(irc,msg,'$randomdate\t$randomdate') dl = q.split('\t') if dl[0] == dl[1]: self.fail ('Two $randomdates in the same string were the same') q = f(irc, msg, '$randomint\t$randomint') dl = q.split('\t') if dl[0] == dl[1]: self.fail ('Two $randomints in the same string were the same') self.assertNotEqual(f(irc, msg, '$today'), '$today') self.assertNotEqual(f(irc, msg, '$now'), '$now') n = f(irc, msg, '$randnick') self.failUnless(n in irc.state.channels['#foo'].users) n = f(irc, msg, '$randomnick') self.failUnless(n in irc.state.channels['#foo'].users) n = f(irc, msg, '$randomnick '*100) L = n.split() self.failIf(all(L[0].__eq__, L), 'all $randomnicks were the same') c = f(irc, msg, '$channel') self.assertEqual(c, msg.args[0]) net = f(irc, msg, '$network') self.assertEqual(net, irc.network)
def kicks(channel, nicks, s='', prefix='', msg=None): """Returns a KICK to kick each of nicks from channel with the message msg. """ if conf.supybot.protocols.irc.strictRfc(): assert isChannel(channel), repr(channel) assert all(isNick, nicks), nicks if msg and not prefix: prefix = msg.prefix if s: return IrcMsg(prefix=prefix, command='KICK', args=(channel, ','.join(nicks), s), msg=msg) else: return IrcMsg(prefix=prefix, command='KICK', args=(channel, ','.join(nicks)), msg=msg)
def _checkForAnnouncements(self, irc): start = time.time() self.log.info('Checking mailbox for announcements.') pop = self._getPop(irc) i = None for (i, msg) in self._getMsgs(pop): message = rfc822.Message(sio(msg)) frm = message.get('From') if not frm: self.log.warning('Received message without From header.') continue else: frm = frm.rstrip() subject = message.get('Subject', '').rstrip() content = message.fp.read() self.log.info('Received message with subject %q from %q.', subject, frm) if subject == 'all': channels = list(irc.state.channels) else: channels = subject.split() if not channels or not all(irc.isChannel, channels): channels = list(self.registryValue('defaultChannels')) if subject: content = '%s: %s' % (subject, content) if not channels: self.log.info('Received message with improper subject ' 'line from %s.', frm) continue prefix = self.registryValue('prefix') content = utils.str.normalizeWhitespace(content) self.log.info('Making announcement to %L.', channels) chunks = textwrap.wrap(content, 350) for channel in channels: if channel in irc.state.channels: maximum = self.registryValue('limit', channel) for chunk in chunks[:maximum]: s = self._formatChunk( self._formatPrefix(prefix + " ")+chunk) irc.queueMsg(ircmsgs.privmsg(channel, s)) prefix = '' self._quit(pop) self.log.info('Finished checking mailbox, time elapsed: %s', utils.timeElapsed(time.time() - start))
def _list(self, irc, group): L = [] for (vname, v) in group._children.items(): if getattr(group, '_networkValue', False) and \ vname.startswith(':'): # Skip pseudo-children that are network names continue if getattr(group, '_channelValue', False) and \ irc.isChannel(vname): # Skip pseudo-children that are channel names continue if getattr(v, '_networkValue', False): vname = ':' + vname if getattr(v, '_channelValue', False): vname = '#' + vname if v._added and not all(irc.isChannel, v._added): vname = '@' + vname L.append(vname) utils.sortBy(str.lower, L) return L
def testStandardSubstitute(self): f = ircutils.standardSubstitute msg = ircmsgs.privmsg('#foo', 'filler', prefix='biff!quux@xyzzy') s = f(self.irc, msg, '$rand') try: int(s) except ValueError: self.fail('$rand wasn\'t an int.') s = f(self.irc, msg, '$randomInt') try: int(s) except ValueError: self.fail('$randomint wasn\'t an int.') self.assertEqual(f(self.irc, msg, '$botnick'), self.irc.nick) self.assertEqual(f(self.irc, msg, '$who'), msg.nick) self.assertEqual(f(self.irc, msg, '$WHO'), msg.nick, 'stand. sub. not case-insensitive.') self.assertEqual(f(self.irc, msg, '$nick'), msg.nick) self.assertNotEqual(f(self.irc, msg, '$randomdate'), '$randomdate') q = f(self.irc,msg,'$randomdate\t$randomdate') dl = q.split('\t') if dl[0] == dl[1]: self.fail ('Two $randomdates in the same string were the same') q = f(self.irc, msg, '$randomint\t$randomint') dl = q.split('\t') if dl[0] == dl[1]: self.fail ('Two $randomints in the same string were the same') self.assertNotEqual(f(self.irc, msg, '$today'), '$today') self.assertNotEqual(f(self.irc, msg, '$now'), '$now') n = f(self.irc, msg, '$randnick') self.failUnless(n in self.irc.state.channels['#foo'].users) n = f(self.irc, msg, '$randomnick') self.failUnless(n in self.irc.state.channels['#foo'].users) n = f(self.irc, msg, '$randomnick '*100) L = n.split() self.failIf(all(L[0].__eq__, L), 'all $randomnicks were the same') c = f(self.irc, msg, '$channel') self.assertEqual(c, msg.args[0]) net = f(self.irc, msg, '$network') self.assertEqual(net, self.irc.network)
def joins(channels, keys=None, prefix='', msg=None): """Returns a JOIN to each of channels.""" if conf.supybot.protocols.irc.strictRfc(): assert all(isChannel, channels), channels if msg and not prefix: prefix = msg.prefix if keys is None: keys = [] assert len(keys) <= len(channels), 'Got more keys than channels.' if not keys: return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels),), msg=msg) else: if conf.supybot.protocols.irc.strictRfc(): chars = '\x00\r\n\f\t\v ' for key in keys: assert not any([(ord(x) >= 128 or x in chars) for x in key]) return IrcMsg(prefix=prefix, command='JOIN', args=(','.join(channels), ','.join(keys)), msg=msg)
def testStandardSubstitute(self): f = ircutils.standardSubstitute msg = ircmsgs.privmsg("#foo", "filler", prefix="biff!quux@xyzzy") s = f(self.irc, msg, "$rand") try: int(s) except ValueError: self.fail("$rand wasn't an int.") s = f(self.irc, msg, "$randomInt") try: int(s) except ValueError: self.fail("$randomint wasn't an int.") self.assertEqual(f(self.irc, msg, "$botnick"), self.irc.nick) self.assertEqual(f(self.irc, msg, "$who"), msg.nick) self.assertEqual(f(self.irc, msg, "$WHO"), msg.nick, "stand. sub. not case-insensitive.") self.assertEqual(f(self.irc, msg, "$nick"), msg.nick) self.assertNotEqual(f(self.irc, msg, "$randomdate"), "$randomdate") q = f(self.irc, msg, "$randomdate\t$randomdate") dl = q.split("\t") if dl[0] == dl[1]: self.fail("Two $randomdates in the same string were the same") q = f(self.irc, msg, "$randomint\t$randomint") dl = q.split("\t") if dl[0] == dl[1]: self.fail("Two $randomints in the same string were the same") self.assertNotEqual(f(self.irc, msg, "$today"), "$today") self.assertNotEqual(f(self.irc, msg, "$now"), "$now") n = f(self.irc, msg, "$randnick") self.failUnless(n in self.irc.state.channels["#foo"].users) n = f(self.irc, msg, "$randomnick") self.failUnless(n in self.irc.state.channels["#foo"].users) n = f(self.irc, msg, "$randomnick " * 100) L = n.split() self.failIf(all(L[0].__eq__, L), "all $randomnicks were the same") c = f(self.irc, msg, "$channel") self.assertEqual(c, msg.args[0])
def incoming(self, irc, msg, args, optlist, globs): """[--{regexp,arch} <value>] [<glob> ...] Checks debian incoming for a matching package name. The arch parameter defaults to i386; --regexp returns only those package names that match a given regexp, and normal matches use standard *nix globbing. """ predicates = [] archPredicate = lambda s: ('_i386.' in s) for (option, arg) in optlist: if option == 'regexp': predicates.append(r.search) elif option == 'arch': arg = '_%s.' % arg archPredicate = lambda s, arg=arg: (arg in s) predicates.append(archPredicate) for glob in globs: glob = fnmatch.translate(glob) predicates.append(re.compile(glob).search) packages = [] try: fd = utils.web.getUrlFd('http://incoming.debian.org/') except utils.web.Error as e: irc.error(str(e), Raise=True) for line in fd: m = self._incomingRe.search(line.decode()) if m: name = m.group(1) if all(None, map(lambda p: p(name), predicates)): realname = utils.str.rsplit(name, '_', 1)[0] packages.append(realname) if len(packages) == 0: irc.error('No packages matched that search.') else: irc.reply(format('%L', packages))
arg = '_%s.' % arg archPredicate = lambda s, arg=arg: (arg in s) predicates.append(archPredicate) for glob in globs: glob = fnmatch.translate(glob) predicates.append(re.compile(glob).search) packages = [] try: fd = utils.web.getUrlFd('http://incoming.debian.org/') except utils.web.Error, e: irc.error(str(e), Raise=True) for line in fd: m = self._incomingRe.search(line) if m: name = m.group(1) if all(None, imap(lambda p: p(name), predicates)): realname = utils.str.rsplit(name, '_', 1)[0] packages.append(realname) if len(packages) == 0: irc.error('No packages matched that search.') else: irc.reply(format('%L', packages)) incoming = thread( wrap(incoming, [ getopts({ 'regexp': 'regexpMatcher', 'arch': 'something' }), any('glob') ]))
arg = '_%s.' % arg archPredicate = lambda s, arg=arg: (arg in s) predicates.append(archPredicate) for glob in globs: glob = fnmatch.translate(glob) predicates.append(re.compile(glob).search) packages = [] try: fd = utils.web.getUrlFd('http://incoming.debian.org/') except utils.web.Error, e: irc.error(str(e), Raise=True) for line in fd: m = self._incomingRe.search(line) if m: name = m.group(1) if all(None, imap(lambda p: p(name), predicates)): realname = utils.str.rsplit(name, '_', 1)[0] packages.append(realname) if len(packages) == 0: irc.error('No packages matched that search.') else: irc.reply(format('%L', packages)) incoming = thread(wrap(incoming, [getopts({'regexp': 'regexpMatcher', 'arch': 'something'}), any('glob')])) def bold(self, s): if self.registryValue('bold', dynamic.channel): return ircutils.bold(s) return s
arg = "_%s." % arg archPredicate = lambda s, arg=arg: (arg in s) predicates.append(archPredicate) for glob in globs: glob = fnmatch.translate(glob) predicates.append(re.compile(glob).search) packages = [] try: fd = utils.web.getUrlFd("http://incoming.debian.org/") except utils.web.Error, e: irc.error(str(e), Raise=True) for line in fd: m = self._incomingRe.search(line) if m: name = m.group(1) if all(None, imap(lambda p: p(name), predicates)): realname = utils.str.rsplit(name, "_", 1)[0] packages.append(realname) if len(packages) == 0: irc.error("No packages matched that search.") else: irc.reply(format("%L", packages)) incoming = thread(wrap(incoming, [getopts({"regexp": "regexpMatcher", "arch": "something"}), any("glob")])) def bold(self, s): if self.registryValue("bold", dynamic.channel): return ircutils.bold(s) return s _ptsUri = "http://packages.qa.debian.org/cgi-bin/soap-alpha.cgi"