X-Git-Url: https://jfr.im/git/irc/weechat/qweechat.git/blobdiff_plain/ac53e98cd0a97b4df158beae67784df4d58f48cd..87a9710d1d46918ad4bf4bd241b363b1908fab9f:/qweechat/network.py diff --git a/qweechat/network.py b/qweechat/network.py index 064c45e..9cb3a0e 100644 --- a/qweechat/network.py +++ b/qweechat/network.py @@ -123,13 +123,13 @@ class Network(QtCore.QObject): self._server = server try: self._port = int(port) - except: + except ValueError: self._port = 0 self._ssl = ssl self._password = password try: self._lines = int(lines) - except: + except ValueError: self._lines = config.CONFIG_DEFAULT_RELAY_LINES if self._socket.state() == QtNetwork.QAbstractSocket.ConnectedState: return @@ -165,14 +165,20 @@ class Network(QtCore.QObject): self.send_to_weechat('\n'.join(_PROTO_SYNC_CMDS)) def status_icon(self, status): - icon = {self.status_disconnected: 'dialog-close.png', - self.status_connecting: 'dialog-close.png', - self.status_connected: 'dialog-ok-apply.png'} + """Return the name of icon for a given status.""" + icon = { + self.status_disconnected: 'dialog-close.png', + self.status_connecting: 'dialog-close.png', + self.status_connected: 'dialog-ok-apply.png', + } return icon.get(status, '') def get_options(self): - return {'server': self._server, - 'port': self._port, - 'ssl': 'on' if self._ssl else 'off', - 'password': self._password, - 'lines': str(self._lines)} + """Get connection options.""" + return { + 'server': self._server, + 'port': self._port, + 'ssl': 'on' if self._ssl else 'off', + 'password': self._password, + 'lines': str(self._lines), + }