mirror of https://github.com/Mikaela/Limnoria.git
Fix testing for positiveInt and nonNegativeInt.
This commit is contained in:
parent
23f4dc2d0f
commit
edc698e48b
|
@ -174,7 +174,7 @@ def getInt(irc, msg, args, state, type='integer', p=None):
|
||||||
if p is not None:
|
if p is not None:
|
||||||
if not p(i):
|
if not p(i):
|
||||||
raise ValueError
|
raise ValueError
|
||||||
state.args.append(_int(args[0]))
|
state.args.append(i)
|
||||||
del args[0]
|
del args[0]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
irc.errorInvalid(type, args[0])
|
irc.errorInvalid(type, args[0])
|
||||||
|
@ -195,11 +195,11 @@ def getFloat(irc, msg, args, state):
|
||||||
|
|
||||||
def getPositiveInt(irc, msg, args, state, *L):
|
def getPositiveInt(irc, msg, args, state, *L):
|
||||||
getInt(irc, msg, args, state,
|
getInt(irc, msg, args, state,
|
||||||
p=lambda i: i<=0, type='positive integer', *L)
|
p=lambda i: i>0, type='positive integer', *L)
|
||||||
|
|
||||||
def getNonNegativeInt(irc, msg, args, state, *L):
|
def getNonNegativeInt(irc, msg, args, state, *L):
|
||||||
getInt(irc, msg, args, state,
|
getInt(irc, msg, args, state,
|
||||||
p=lambda i: i<0, type='non-negative integer', *L)
|
p=lambda i: i>=0, type='non-negative integer', *L)
|
||||||
|
|
||||||
def getId(irc, msg, args, state, kind=None):
|
def getId(irc, msg, args, state, kind=None):
|
||||||
type = 'id'
|
type = 'id'
|
||||||
|
|
Loading…
Reference in New Issue