A couple of tweaks to clarify some type hints
This commit is contained in:
parent
c4ea6fa562
commit
08bd31f150
3 changed files with 7 additions and 5 deletions
|
@ -3,6 +3,7 @@ from src import EventManager, IRCBot, IRCBuffer, IRCObject, IRCServer, IRCUser
|
||||||
from src import utils
|
from src import utils
|
||||||
|
|
||||||
class Channel(IRCObject.Object):
|
class Channel(IRCObject.Object):
|
||||||
|
name = ""
|
||||||
def __init__(self, name: str, id, server: "IRCServer.Server",
|
def __init__(self, name: str, id, server: "IRCServer.Server",
|
||||||
bot: "IRCBot.Bot"):
|
bot: "IRCBot.Bot"):
|
||||||
self.name = utils.irc.lower(server.case_mapping, name)
|
self.name = utils.irc.lower(server.case_mapping, name)
|
||||||
|
|
|
@ -173,7 +173,10 @@ class Server(IRCObject.Object):
|
||||||
self.nickname = nickname
|
self.nickname = nickname
|
||||||
self.nickname_lower = utils.irc.lower(self.case_mapping, nickname)
|
self.nickname_lower = utils.irc.lower(self.case_mapping, nickname)
|
||||||
def is_own_nickname(self, nickname: str) -> bool:
|
def is_own_nickname(self, nickname: str) -> bool:
|
||||||
return utils.irc.equals(self.case_mapping, nickname, self.nickname)
|
if self.nickname == None:
|
||||||
|
return False
|
||||||
|
return utils.irc.equals(self.case_mapping, nickname,
|
||||||
|
typing.cast(str, self.nickname))
|
||||||
|
|
||||||
def add_own_mode(self, mode: str, arg: str=None):
|
def add_own_mode(self, mode: str, arg: str=None):
|
||||||
self.own_modes[mode] = arg
|
self.own_modes[mode] = arg
|
||||||
|
|
|
@ -80,7 +80,7 @@ def message_tag_unescape(s):
|
||||||
return _multi_replace(s, MESSAGE_TAG_ESCAPED, MESSAGE_TAG_UNESCAPED)
|
return _multi_replace(s, MESSAGE_TAG_ESCAPED, MESSAGE_TAG_UNESCAPED)
|
||||||
|
|
||||||
def parse_line(line: str) -> IRCLine:
|
def parse_line(line: str) -> IRCLine:
|
||||||
tags = {}
|
tags = {} # type: typing.Dict[str, typing.Any]
|
||||||
prefix = None # type: typing.Optional[IRCHostmask]
|
prefix = None # type: typing.Optional[IRCHostmask]
|
||||||
command = None
|
command = None
|
||||||
|
|
||||||
|
@ -108,9 +108,7 @@ def parse_line(line: str) -> IRCLine:
|
||||||
prefix_str, line = line[1:].split(" ", 1)
|
prefix_str, line = line[1:].split(" ", 1)
|
||||||
prefix = seperate_hostmask(prefix_str)
|
prefix = seperate_hostmask(prefix_str)
|
||||||
|
|
||||||
args = []
|
|
||||||
command, sep, line = line.partition(" ")
|
command, sep, line = line.partition(" ")
|
||||||
if sep:
|
|
||||||
args = line.split(" ")
|
args = line.split(" ")
|
||||||
|
|
||||||
if arbitrary:
|
if arbitrary:
|
||||||
|
|
Loading…
Reference in a new issue