From afd53f212d8bfa9925235d58daf7e950f2426634 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 10 Feb 2005 07:01:08 +0000 Subject: [PATCH] Removed commands that were moved to String. --- plugins/Utilities/plugin.py | 32 -------------------------------- plugins/Utilities/test.py | 28 ---------------------------- 2 files changed, 60 deletions(-) diff --git a/plugins/Utilities/plugin.py b/plugins/Utilities/plugin.py index 783e1c149..c1c31985a 100644 --- a/plugins/Utilities/plugin.py +++ b/plugins/Utilities/plugin.py @@ -71,17 +71,6 @@ class Utilities(callbacks.Plugin): else: raise callbacks.ArgumentError - def strlen(self, irc, msg, args): - """ - - Returns the length of . - """ - total = 0 - for arg in args: - total += len(arg) - total += len(args)-1 # spaces between the arguments. - irc.reply(str(total)) - def echo(self, irc, msg, args, text): """ @@ -103,27 +92,6 @@ class Utilities(callbacks.Plugin): irc.reply(' '.join(things)) shuffle = wrap(shuffle, [many('anything')]) - def re(self, irc, msg, args, ff, text): - """ - - If is of the form m/regexp/flags, returns the portion of - that matches the regexp. If is of the form - s/regexp/replacement/flags, returns the result of applying such a - regexp to - """ - if isinstance(ff, (types.FunctionType, types.MethodType)): - f = ff - else: - f = lambda s: ff.search(s) and ff.search(s).group(0) or '' - if f('') and len(f(' ')) > len(f(''))+1: # Matches the empty string. - s = 'You probably don\'t want to match the empty string.' - irc.error(s) - else: - irc.reply(f(text)) - re = wrap(re, [('checkCapability', 'trusted'), - first('regexpMatcher', 'regexpReplacer'), - 'text']) - def apply(self, irc, msg, args, command, rest): """ diff --git a/plugins/Utilities/test.py b/plugins/Utilities/test.py index bf74f3a92..395cd7a60 100644 --- a/plugins/Utilities/test.py +++ b/plugins/Utilities/test.py @@ -42,10 +42,6 @@ class UtilitiesTestCase(PluginTestCase): def testLast(self): self.assertResponse('utilities last foo bar baz', 'baz') - def testStrlen(self): - self.assertResponse('strlen %s' % ('s'*10), '10') - self.assertResponse('strlen a b', '3') - def testEcho(self): self.assertHelp('echo') self.assertResponse('echo foo', 'foo') @@ -56,30 +52,6 @@ class UtilitiesTestCase(PluginTestCase): def testEchoStandardSubstitute(self): self.assertNotRegexp('echo $nick', r'\$') - def testRe(self): - self.assertResponse('re "m/system time/" foo bar system time baz', - 'system time') - self.assertResponse('re s/user/luser/g user user', 'luser luser') - self.assertResponse('re s/user/luser/ user user', 'luser user') - self.assertNotRegexp('re m/foo/ bar', 'has no attribute') - self.assertResponse('re m/a\S+y/ "the bot angryman is hairy"','angry') - - def testReNotEmptyString(self): - self.assertError('re s//foo/g blah') - - def testReWorksWithJustCaret(self): - self.assertResponse('re s/^/foo/ bar', 'foobar') - - def testReNoEscapingUnpackListOfWrongSize(self): - self.assertNotRegexp('re foo bar baz', 'unpack list of wrong size') - - def testReBug850931(self): - self.assertResponse('re s/\b(\w+)\b/\1./g foo bar baz', - 'foo. bar. baz.') - - def testNotOverlongRe(self): - self.assertError('re [strjoin "" s/./ [eval \'xxx\'*400]] blah blah') - def testApply(self): self.assertResponse('apply "utilities last" a', 'a') self.assertResponse('apply "utilities last" a b', 'b')