Conditional: Don't import * from commands and remove the hack for any/all.

This commit is contained in:
Valentin Lorentz 2015-11-09 19:10:19 +01:00
parent 8bdab5e23e
commit b3dbde18b8

View File

@ -29,8 +29,8 @@
### ###
import supybot.utils as utils import supybot.utils as utils
from supybot.commands import *
import supybot.plugins as plugins import supybot.plugins as plugins
import supybot.commands as commands
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
@ -46,12 +46,10 @@ except:
_ = lambda x:x _ = lambda x:x
internationalizeDocstring = lambda x:x internationalizeDocstring = lambda x:x
if isinstance(__builtins__, dict): first = commands.first
_any = __builtins__['any'] many = commands.many
_all = __builtins__['all'] wrap = commands.wrap
else: getopts = commands.getopts
_any = __builtins__.any
_all = __builtins__.all
boolean_or_int = first('int', 'boolean') boolean_or_int = first('int', 'boolean')
@ -94,7 +92,7 @@ class Conditional(callbacks.Plugin):
Returns true if all conditions supplied evaluate to true. Returns true if all conditions supplied evaluate to true.
""" """
if _all(conds): if all(conds):
irc.reply("true") irc.reply("true")
else: else:
irc.reply("false") irc.reply("false")
@ -106,7 +104,7 @@ class Conditional(callbacks.Plugin):
Returns true if any one of conditions supplied evaluates to true. Returns true if any one of conditions supplied evaluates to true.
""" """
if _any(conds): if any(conds):
irc.reply("true") irc.reply("true")
else: else:
irc.reply("false") irc.reply("false")