From e844004ba131f67884bf36e78a354b0484dab290 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 1 May 2019 17:13:55 +0100 Subject: [PATCH] Fix reconnect() type hint issues --- src/IRCBot.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/IRCBot.py b/src/IRCBot.py index 0c4f2784..8879b328 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -165,7 +165,12 @@ class Bot(object): event["timer"].redo() def reconnect(self, server_id: int, connection_params: typing.Optional[ utils.irc.IRCConnectionParameters]=None) -> bool: - server = self.add_server(server_id, False, connection_params.args) + args = {} # type: typing.Dict[str, str] + if not connection_params == None: + args = typing.cast(utils.irc.IRCConnectionParameters, + connection_params).args + + server = self.add_server(server_id, False, args) if self.connect(server): self.servers[server.fileno()] = server return True