mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Changed asserts to show the repr() if they fail.
This commit is contained in:
parent
580edc37c5
commit
f95a804fe9
@ -272,39 +272,39 @@ def ping(payload, prefix=''):
|
|||||||
|
|
||||||
def op(channel, nick, prefix=''):
|
def op(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to op nick on channel."""
|
"""Returns a MODE to op nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+o', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+o', nick))
|
||||||
|
|
||||||
def ops(channel, nicks, prefix=''):
|
def ops(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to op each of nicks on channel."""
|
"""Returns a MODE to op each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '+' + ('o'*len(nicks)), nicks))
|
args=(channel, '+' + ('o'*len(nicks)), nicks))
|
||||||
|
|
||||||
def deop(channel, nick, prefix=''):
|
def deop(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to deop nick on channel."""
|
"""Returns a MODE to deop nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-o', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-o', nick))
|
||||||
|
|
||||||
def deops(channel, nicks, prefix=''):
|
def deops(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to deop each of nicks on channel."""
|
"""Returns a MODE to deop each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '-' + ('o'*len(nicks)), nicks))
|
args=(channel, '-' + ('o'*len(nicks)), nicks))
|
||||||
|
|
||||||
def halfop(channel, nick, prefix=''):
|
def halfop(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to halfop nick on channel."""
|
"""Returns a MODE to halfop nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+h', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+h', nick))
|
||||||
|
|
||||||
def halfops(channel, nicks, prefix=''):
|
def halfops(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to halfop each of nicks on channel."""
|
"""Returns a MODE to halfop each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
return IrcMsg(prefix=prefix,
|
return IrcMsg(prefix=prefix,
|
||||||
command=MODE,
|
command=MODE,
|
||||||
@ -312,47 +312,47 @@ def halfops(channel, nicks, prefix=''):
|
|||||||
|
|
||||||
def dehalfop(channel, nick, prefix=''):
|
def dehalfop(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to dehalfop nick on channel."""
|
"""Returns a MODE to dehalfop nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-h', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-h', nick))
|
||||||
|
|
||||||
def dehalfops(channel, nicks, prefix=''):
|
def dehalfops(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to dehalfop each of nicks on channel."""
|
"""Returns a MODE to dehalfop each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '-' + ('h'*len(nicks)), nicks))
|
args=(channel, '-' + ('h'*len(nicks)), nicks))
|
||||||
|
|
||||||
def voice(channel, nick, prefix=''):
|
def voice(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to voice nick on channel."""
|
"""Returns a MODE to voice nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+v', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '+v', nick))
|
||||||
|
|
||||||
def voices(channel, nicks, prefix=''):
|
def voices(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to voice each of nicks on channel."""
|
"""Returns a MODE to voice each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks)
|
assert all(isNick, nicks)
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '+' + ('v'*len(nicks)), nicks))
|
args=(channel, '+' + ('v'*len(nicks)), nicks))
|
||||||
|
|
||||||
def devoice(channel, nick, prefix=''):
|
def devoice(channel, nick, prefix=''):
|
||||||
"""Returns a MODE to devoice nick on channel."""
|
"""Returns a MODE to devoice nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-v', nick))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-v', nick))
|
||||||
|
|
||||||
def devoices(channel, nicks, prefix=''):
|
def devoices(channel, nicks, prefix=''):
|
||||||
"""Returns a MODE to devoice each of nicks on channel."""
|
"""Returns a MODE to devoice each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '-' + ('v'*len(nicks)), nicks))
|
args=(channel, '-' + ('v'*len(nicks)), nicks))
|
||||||
|
|
||||||
def ban(channel, hostmask, exception='', prefix=''):
|
def ban(channel, hostmask, exception='', prefix=''):
|
||||||
"""Returns a MODE to ban nick on channel."""
|
"""Returns a MODE to ban nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isUserHostmask(hostmask), hostmask
|
assert isUserHostmask(hostmask), repr(hostmask)
|
||||||
modes = [('+b', hostmask)]
|
modes = [('+b', hostmask)]
|
||||||
if exception:
|
if exception:
|
||||||
modes.append(('+e', exception))
|
modes.append(('+e', exception))
|
||||||
@ -361,7 +361,7 @@ def ban(channel, hostmask, exception='', prefix=''):
|
|||||||
|
|
||||||
def bans(channel, hostmasks, exceptions=(), prefix=''):
|
def bans(channel, hostmasks, exceptions=(), prefix=''):
|
||||||
"""Returns a MODE to ban each of nicks on channel."""
|
"""Returns a MODE to ban each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isUserHostmask, hostmasks), hostmasks
|
assert all(isUserHostmask, hostmasks), hostmasks
|
||||||
modes = [('+b', s) for s in hostmasks] + [('+e', s) for s in exceptions]
|
modes = [('+b', s) for s in hostmasks] + [('+e', s) for s in exceptions]
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
@ -369,21 +369,21 @@ def bans(channel, hostmasks, exceptions=(), prefix=''):
|
|||||||
|
|
||||||
def unban(channel, hostmask, prefix=''):
|
def unban(channel, hostmask, prefix=''):
|
||||||
"""Returns a MODE to unban nick on channel."""
|
"""Returns a MODE to unban nick on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isUserHostmask(hostmask), hostmask
|
assert isUserHostmask(hostmask), repr(hostmask)
|
||||||
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-b', hostmask))
|
return IrcMsg(prefix=prefix, command=MODE, args=(channel, '-b', hostmask))
|
||||||
|
|
||||||
def unbans(channel, hostmasks, prefix=''):
|
def unbans(channel, hostmasks, prefix=''):
|
||||||
"""Returns a MODE to unban each of nicks on channel."""
|
"""Returns a MODE to unban each of nicks on channel."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isUserHostmask, hostmasks), hostmasks
|
assert all(isUserHostmask, hostmasks), hostmasks
|
||||||
return IrcMsg(prefix=prefix, command=MODE,
|
return IrcMsg(prefix=prefix, command=MODE,
|
||||||
args=(channel, '-' + ('b'*len(hostmasks)), hostmasks))
|
args=(channel, '-' + ('b'*len(hostmasks)), hostmasks))
|
||||||
|
|
||||||
def kick(channel, nick, msg='', prefix=''):
|
def kick(channel, nick, msg='', prefix=''):
|
||||||
"""Returns a KICK to kick nick from channel with the message msg."""
|
"""Returns a KICK to kick nick from channel with the message msg."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
if msg:
|
if msg:
|
||||||
return IrcMsg(prefix=prefix, command='KICK', args=(channel, nick, msg))
|
return IrcMsg(prefix=prefix, command='KICK', args=(channel, nick, msg))
|
||||||
else:
|
else:
|
||||||
@ -392,7 +392,7 @@ def kick(channel, nick, msg='', prefix=''):
|
|||||||
def kicks(channel, nicks, msg='', prefix=''):
|
def kicks(channel, nicks, msg='', prefix=''):
|
||||||
"""Returns a KICK to kick each of nicks from channel with the message msg.
|
"""Returns a KICK to kick each of nicks from channel with the message msg.
|
||||||
"""
|
"""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
assert all(isNick, nicks), nicks
|
assert all(isNick, nicks), nicks
|
||||||
if msg:
|
if msg:
|
||||||
return IrcMsg(prefix=prefix, command='KICK',
|
return IrcMsg(prefix=prefix, command='KICK',
|
||||||
@ -403,26 +403,26 @@ def kicks(channel, nicks, msg='', prefix=''):
|
|||||||
|
|
||||||
def privmsg(recipient, msg, prefix=''):
|
def privmsg(recipient, msg, prefix=''):
|
||||||
"""Returns a PRIVMSG to recipient with the message msg."""
|
"""Returns a PRIVMSG to recipient with the message msg."""
|
||||||
assert (isChannel(recipient) or isNick(recipient)), recipient
|
assert (isChannel(recipient) or isNick(recipient)), repr(recipient)
|
||||||
assert msg, 'msg must not be empty.'
|
assert msg, 'msg must not be empty.'
|
||||||
return IrcMsg(prefix=prefix, command='PRIVMSG', args=(recipient, msg))
|
return IrcMsg(prefix=prefix, command='PRIVMSG', args=(recipient, msg))
|
||||||
|
|
||||||
def action(recipient, msg, prefix=''):
|
def action(recipient, msg, prefix=''):
|
||||||
"""Returns a PRIVMSG ACTION to recipient with the message msg."""
|
"""Returns a PRIVMSG ACTION to recipient with the message msg."""
|
||||||
assert (isChannel(recipient) or isNick(recipient)), recipient
|
assert (isChannel(recipient) or isNick(recipient)), repr(recipient)
|
||||||
assert msg, 'msg must not be empty.'
|
assert msg, 'msg must not be empty.'
|
||||||
return IrcMsg(prefix=prefix, command='PRIVMSG',
|
return IrcMsg(prefix=prefix, command='PRIVMSG',
|
||||||
args=(recipient,'\x01ACTION %s\x01'% msg))
|
args=(recipient,'\x01ACTION %s\x01'% msg))
|
||||||
|
|
||||||
def notice(recipient, msg, prefix=''):
|
def notice(recipient, msg, prefix=''):
|
||||||
"""Returns a NOTICE to recipient with the message msg."""
|
"""Returns a NOTICE to recipient with the message msg."""
|
||||||
assert (isChannel(recipient) or isNick(recipient)), recipient
|
assert (isChannel(recipient) or isNick(recipient)), repr(recipient)
|
||||||
assert msg, 'msg must not be empty.'
|
assert msg, 'msg must not be empty.'
|
||||||
return IrcMsg(prefix=prefix, command='NOTICE', args=(recipient, msg))
|
return IrcMsg(prefix=prefix, command='NOTICE', args=(recipient, msg))
|
||||||
|
|
||||||
def join(channel, key=None, prefix=''):
|
def join(channel, key=None, prefix=''):
|
||||||
"""Returns a JOIN to a channel"""
|
"""Returns a JOIN to a channel"""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
if key is None:
|
if key is None:
|
||||||
return IrcMsg(prefix=prefix, command='JOIN', args=(channel,))
|
return IrcMsg(prefix=prefix, command='JOIN', args=(channel,))
|
||||||
else:
|
else:
|
||||||
@ -462,7 +462,7 @@ def joins(channels, keys=None, prefix=''):
|
|||||||
|
|
||||||
def part(channel, msg='', prefix=''):
|
def part(channel, msg='', prefix=''):
|
||||||
"""Returns a PART from channel with the message msg."""
|
"""Returns a PART from channel with the message msg."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
if msg:
|
if msg:
|
||||||
return IrcMsg(prefix=prefix, command='PART', args=(channel, msg))
|
return IrcMsg(prefix=prefix, command='PART', args=(channel, msg))
|
||||||
else:
|
else:
|
||||||
@ -487,7 +487,7 @@ def quit(msg='', prefix=''):
|
|||||||
|
|
||||||
def topic(channel, topic=None, prefix=''):
|
def topic(channel, topic=None, prefix=''):
|
||||||
"""Returns a TOPIC for channel with the topic topic."""
|
"""Returns a TOPIC for channel with the topic topic."""
|
||||||
assert isChannel(channel), channel
|
assert isChannel(channel), repr(channel)
|
||||||
if topic is None:
|
if topic is None:
|
||||||
return IrcMsg(prefix=prefix, command='TOPIC', args=(channel,))
|
return IrcMsg(prefix=prefix, command='TOPIC', args=(channel,))
|
||||||
else:
|
else:
|
||||||
@ -495,7 +495,7 @@ def topic(channel, topic=None, prefix=''):
|
|||||||
|
|
||||||
def nick(nick, prefix=''):
|
def nick(nick, prefix=''):
|
||||||
"""Returns a NICK with nick nick."""
|
"""Returns a NICK with nick nick."""
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command='NICK', args=(nick,))
|
return IrcMsg(prefix=prefix, command='NICK', args=(nick,))
|
||||||
|
|
||||||
def user(ident, user, prefix=''):
|
def user(ident, user, prefix=''):
|
||||||
@ -510,17 +510,17 @@ def user(ident, user, prefix=''):
|
|||||||
def who(hostmaskOrChannel, prefix=''):
|
def who(hostmaskOrChannel, prefix=''):
|
||||||
"""Returns a WHO for the hostmask or channel hostmaskOrChannel."""
|
"""Returns a WHO for the hostmask or channel hostmaskOrChannel."""
|
||||||
assert isChannel(hostmaskOrChannel) or isUserHostmask(hostmaskOrChannel), \
|
assert isChannel(hostmaskOrChannel) or isUserHostmask(hostmaskOrChannel), \
|
||||||
hostmaskOrChannel
|
repr(hostmaskOrChannel)
|
||||||
return IrcMsg(prefix=prefix, command='WHO', args=(hostmaskOrChannel,))
|
return IrcMsg(prefix=prefix, command='WHO', args=(hostmaskOrChannel,))
|
||||||
|
|
||||||
def whois(nick, mask='', prefix=''):
|
def whois(nick, mask='', prefix=''):
|
||||||
"""Returns a WHOIS for nick."""
|
"""Returns a WHOIS for nick."""
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command='WHOIS', args=(nick, mask))
|
return IrcMsg(prefix=prefix, command='WHOIS', args=(nick, mask))
|
||||||
|
|
||||||
def invite(channel, nick, prefix=''):
|
def invite(channel, nick, prefix=''):
|
||||||
"""Returns an INVITE for nick."""
|
"""Returns an INVITE for nick."""
|
||||||
assert isNick(nick), nick
|
assert isNick(nick), repr(nick)
|
||||||
return IrcMsg(prefix=prefix, command='INVITE', args=(channel, nick))
|
return IrcMsg(prefix=prefix, command='INVITE', args=(channel, nick))
|
||||||
|
|
||||||
def password(password, prefix=''):
|
def password(password, prefix=''):
|
||||||
|
Loading…
Reference in New Issue
Block a user