commands.reversed => commands.reverse

This commit is contained in:
James Vega 2004-10-24 03:53:56 +00:00
parent 66196683a5
commit c0a8f5e45d
3 changed files with 7 additions and 7 deletions

View File

@ -333,7 +333,7 @@ class Factoids(callbacks.Privmsg):
"""
factoids = self.db.get(channel, key)
self._replyFactoids(irc, channel, key, factoids, number)
whatis = wrap(whatis, ['channeldb', reversed(optional('positiveInt', 0)), 'text'],
whatis = wrap(whatis, ['channeldb', reverse(optional('positiveInt', 0)), 'text'],
allowExtra=True)
def lock(self, irc, msg, args, channel, key):
@ -382,7 +382,7 @@ class Factoids(callbacks.Privmsg):
'Please specify which one to remove, '
'or use * to designate all of them.' % str(e))
forget = wrap(forget, ['channeldb',
reversed(first('positiveInt', ('literal', '*'))),
reverse(first('positiveInt', ('literal', '*'))),
'text'], allowExtra=True)
def random(self, irc, msg, args, channel):

View File

@ -660,10 +660,10 @@ class first(context):
else:
raise e
class reversed(context):
class reverse(context):
def __call__(self, irc, msg, args, state):
args[:] = args[::-1]
super(reversed, self).__call__(irc, msg, args, state)
super(reverse, self).__call__(irc, msg, args, state)
args[:] = args[::-1]
class getopts(context):
@ -780,7 +780,7 @@ def wrap(f, specList=[], **kw):
__all__ = ['wrap', 'context', 'additional', 'optional', 'any', 'compose',
'Spec', 'first', 'urlSnarfer', 'thread', 'reversed',
'Spec', 'first', 'urlSnarfer', 'thread', 'reverse',
'many', 'getopts', 'getConverter', 'addConverter', 'callConverter']
if world.testing:

View File

@ -69,8 +69,8 @@ class CommandsTestCase(SupyTestCase):
self.assertRaises(callbacks.Error,
self.assertState, spec, ['foo'], ['asdf'])
def testReversed(self):
spec = [reversed('positiveInt'), 'float', 'text']
def testReverse(self):
spec = [reverse('positiveInt'), 'float', 'text']
self.assertState(spec, ['-1.0', 'foo', '1'], [1, -1.0, 'foo'])
def testGetopts(self):