From 385ef2e456b6e94be3abac941c0e3c0c28db8788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 18 Sep 2018 17:02:14 +0200 Subject: [PATCH] Fix pylint errors - duplicate-key - eval-used - comparison-with-callable --- gajim/common/connection.py | 2 +- gajim/gui_interface.py | 11 ++++++----- gajim/gui_menu_builder.py | 2 +- gajim/htmltextview.py | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 0f0cfd922..6b4fe7e24 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -1031,7 +1031,7 @@ class Connection(CommonConnection, ConnectionHandlers): nbxmpp.dispatcher_nb.DEFAULT_TIMEOUT_SECONDS = \ self.try_connecting_for_foo_secs # FIXME: this is a hack; need a better way - if self.on_connect_success == self._on_new_account: + if self.on_connect_success == self._on_new_account: # pylint: disable=W0143 con.RegisterDisconnectHandler(self._on_new_account) if self.client_cert and app.config.get_per('accounts', self.name, diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py index 2a32c0a20..f0f780041 100644 --- a/gajim/gui_interface.py +++ b/gajim/gui_interface.py @@ -1873,18 +1873,19 @@ class Interface: ################################################################################ def join_gc_room(self, account, room_jid, nick, password, minimize=False, - is_continued=False): + is_continued=False): """ Join the room immediately """ if app.contacts.get_contact(account, room_jid) and \ not app.contacts.get_contact(account, room_jid).is_groupchat(): - ErrorDialog(_('This is not a group chat'), + ErrorDialog( + _('This is not a group chat'), _('%(room_jid)s is already in your roster. Please check ' - 'if %(room_jid)s is a correct group chat name. If it is, ' - 'delete it from your roster and try joining the group chat ' - 'again.') % {'room_jid': room_jid, 'room_jid': room_jid}) + 'if %(room_jid)s is a correct group chat name. If it is, ' + 'delete it from your roster and try joining the group chat ' + 'again.') % {'room_jid': room_jid}) return if not nick: diff --git a/gajim/gui_menu_builder.py b/gajim/gui_menu_builder.py index c8ce28d63..da0836fcd 100644 --- a/gajim/gui_menu_builder.py +++ b/gajim/gui_menu_builder.py @@ -41,7 +41,7 @@ def build_resources_submenu(contacts, account, action, room_jid=None, item = Gtk.MenuItem.new_with_label( '%s (%s)' % (c.resource, str(c.priority))) sub_menu.append(item) - + # pylint: disable=W0143 if action == roster.on_invite_to_room: item.connect('activate', action, [(c, account)], room_jid, room_account, c.resource) diff --git a/gajim/htmltextview.py b/gajim/htmltextview.py index d87afaf98..80bba6572 100644 --- a/gajim/htmltextview.py +++ b/gajim/htmltextview.py @@ -183,7 +183,7 @@ INLINE = INLINE_PHRASAL.union(INLINE_PRES).union(INLINE_STRUCT) LIST_ELEMS = set('dl, ol, ul'.split(', ')) for _name in BLOCK_HEAD: - _num = eval(_name[1]) + _num = int(_name[1]) _header_size = (_num - 1) // 2 _weight = (_num - 1) % 2 _element_styles[_name] = '; font-size: %s; %s' % (('large', 'medium', 'small')[_header_size],