mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Update to use the new commands.wrap
This commit is contained in:
parent
a3223c7c27
commit
c574403ca8
@ -45,7 +45,7 @@ import string
|
|||||||
from itertools import imap
|
from itertools import imap
|
||||||
|
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
from supybot.commands import wrap
|
from supybot.commands import additional, optional, wrap
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
import convertcore
|
import convertcore
|
||||||
@ -67,8 +67,8 @@ class Math(callbacks.Privmsg):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
irc.error('Invalid <number> for base %s: %s' % (frm, number))
|
irc.error('Invalid <number> for base %s: %s' % (frm, number))
|
||||||
base = wrap(base, [('int', 'base', lambda i: 2 <= i <= 36),
|
base = wrap(base, [('int', 'base', lambda i: 2 <= i <= 36),
|
||||||
('int?', 10, 'base', lambda i: 2 <= i <= 36),
|
optional(('int', 'base', lambda i: 2 <= i <= 36), 10),
|
||||||
'?something'])
|
optional('something')])
|
||||||
|
|
||||||
def _convertDecimalToBase(self, number, base):
|
def _convertDecimalToBase(self, number, base):
|
||||||
"""
|
"""
|
||||||
@ -307,8 +307,8 @@ class Math(callbacks.Privmsg):
|
|||||||
irc.reply(str(newNum))
|
irc.reply(str(newNum))
|
||||||
except convertcore.UnitDataError, ude:
|
except convertcore.UnitDataError, ude:
|
||||||
irc.error(str(ude))
|
irc.error(str(ude))
|
||||||
convert = wrap(convert, [('float?', 1.0), 'something',
|
convert = wrap(convert, [optional('float', 1.0), 'something',
|
||||||
('literal?', '', 'to'), 'something'])
|
additional(('literal', 'to'), ''), 'something'])
|
||||||
|
|
||||||
def units(self, irc, msg, args, type):
|
def units(self, irc, msg, args, type):
|
||||||
""" [<type>]
|
""" [<type>]
|
||||||
@ -319,7 +319,7 @@ class Math(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
irc.reply(convertcore.units(type))
|
irc.reply(convertcore.units(type))
|
||||||
units = wrap(units, [('?something', None)])
|
units = wrap(units, [optional('something')])
|
||||||
|
|
||||||
Class = Math
|
Class = Math
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ import supybot.conf as conf
|
|||||||
import supybot.ircdb as ircdb
|
import supybot.ircdb as ircdb
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
import supybot.ircmsgs as ircmsgs
|
import supybot.ircmsgs as ircmsgs
|
||||||
from supybot.commands import wrap
|
from supybot.commands import additional, wrap
|
||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.privmsgs as privmsgs
|
import supybot.privmsgs as privmsgs
|
||||||
import supybot.schedule as schedule
|
import supybot.schedule as schedule
|
||||||
|
Loading…
Reference in New Issue
Block a user