Fix pylint errors

- duplicate-key
- eval-used
- comparison-with-callable
This commit is contained in:
Philipp Hörist 2018-09-18 17:02:14 +02:00 committed by Philipp Hörist
parent cb95e22004
commit 60173c06db
4 changed files with 9 additions and 8 deletions

View File

@ -1031,7 +1031,7 @@ class Connection(CommonConnection, ConnectionHandlers):
nbxmpp.dispatcher_nb.DEFAULT_TIMEOUT_SECONDS = \ nbxmpp.dispatcher_nb.DEFAULT_TIMEOUT_SECONDS = \
self.try_connecting_for_foo_secs self.try_connecting_for_foo_secs
# FIXME: this is a hack; need a better way # 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) con.RegisterDisconnectHandler(self._on_new_account)
if self.client_cert and app.config.get_per('accounts', self.name, if self.client_cert and app.config.get_per('accounts', self.name,

View File

@ -1873,18 +1873,19 @@ class Interface:
################################################################################ ################################################################################
def join_gc_room(self, account, room_jid, nick, password, minimize=False, def join_gc_room(self, account, room_jid, nick, password, minimize=False,
is_continued=False): is_continued=False):
""" """
Join the room immediately Join the room immediately
""" """
if app.contacts.get_contact(account, room_jid) and \ if app.contacts.get_contact(account, room_jid) and \
not app.contacts.get_contact(account, room_jid).is_groupchat(): 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 ' _('%(room_jid)s is already in your roster. Please check '
'if %(room_jid)s is a correct group chat name. If it is, ' 'if %(room_jid)s is a correct group chat name. If it is, '
'delete it from your roster and try joining the group chat ' 'delete it from your roster and try joining the group chat '
'again.') % {'room_jid': room_jid, 'room_jid': room_jid}) 'again.') % {'room_jid': room_jid})
return return
if not nick: if not nick:

View File

@ -41,7 +41,7 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
item = Gtk.MenuItem.new_with_label( item = Gtk.MenuItem.new_with_label(
'%s (%s)' % (c.resource, str(c.priority))) '%s (%s)' % (c.resource, str(c.priority)))
sub_menu.append(item) sub_menu.append(item)
# pylint: disable=W0143
if action == roster.on_invite_to_room: if action == roster.on_invite_to_room:
item.connect('activate', action, [(c, account)], room_jid, item.connect('activate', action, [(c, account)], room_jid,
room_account, c.resource) room_account, c.resource)

View File

@ -183,7 +183,7 @@ INLINE = INLINE_PHRASAL.union(INLINE_PRES).union(INLINE_STRUCT)
LIST_ELEMS = set('dl, ol, ul'.split(', ')) LIST_ELEMS = set('dl, ol, ul'.split(', '))
for _name in BLOCK_HEAD: for _name in BLOCK_HEAD:
_num = eval(_name[1]) _num = int(_name[1])
_header_size = (_num - 1) // 2 _header_size = (_num - 1) // 2
_weight = (_num - 1) % 2 _weight = (_num - 1) % 2
_element_styles[_name] = '; font-size: %s; %s' % (('large', 'medium', 'small')[_header_size], _element_styles[_name] = '; font-size: %s; %s' % (('large', 'medium', 'small')[_header_size],