mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Added some asserts.
This commit is contained in:
parent
f82383e44f
commit
981c21617d
@ -49,21 +49,25 @@ def isServerHostmask(s):
|
|||||||
return (not isUserHostmask(s) and s.find('!') == -1 and s.find('@') == -1)
|
return (not isUserHostmask(s) and s.find('!') == -1 and s.find('@') == -1)
|
||||||
|
|
||||||
def nickFromHostmask(hostmask):
|
def nickFromHostmask(hostmask):
|
||||||
|
assert isUserHostmask(hostmask)
|
||||||
return nick(hostmask.split('!', 1)[0])
|
return nick(hostmask.split('!', 1)[0])
|
||||||
|
|
||||||
def userFromHostmask(hostmask):
|
def userFromHostmask(hostmask):
|
||||||
#debug.printf('FOO!: %r' % hostmask)
|
assert isUserHostmask(hostmask)
|
||||||
return hostmask.split('!', 1)[1].split('@', 1)[0]
|
return hostmask.split('!', 1)[1].split('@', 1)[0]
|
||||||
|
|
||||||
def hostFromHostmask(hostmask):
|
def hostFromHostmask(hostmask):
|
||||||
|
assert isUserHostmask(hostmask)
|
||||||
return hostmask.split('@', 1)[1]
|
return hostmask.split('@', 1)[1]
|
||||||
|
|
||||||
def splitHostmask(hostmask):
|
def splitHostmask(hostmask):
|
||||||
|
assert isUserHostmask(hostmask)
|
||||||
nck, rest = hostmask.split('!', 1)
|
nck, rest = hostmask.split('!', 1)
|
||||||
user, host = rest.split('@', 1)
|
user, host = rest.split('@', 1)
|
||||||
return (nick(nck), user, host)
|
return (nick(nck), user, host)
|
||||||
|
|
||||||
def joinHostmask(nick, ident, host):
|
def joinHostmask(nick, ident, host):
|
||||||
|
assert nick and ident and host
|
||||||
return '%s!%s@%s' % (nick, ident, host)
|
return '%s!%s@%s' % (nick, ident, host)
|
||||||
|
|
||||||
_lowertrans = string.maketrans(string.ascii_uppercase + r'\[]',
|
_lowertrans = string.maketrans(string.ascii_uppercase + r'\[]',
|
||||||
|
Loading…
Reference in New Issue
Block a user