From c4bd6d6ab23540d49723699f244907562253d9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 17 Sep 2018 22:34:15 +0200 Subject: [PATCH] Fix consider-iterating-dictionary pylint errors --- gajim/advanced_configuration_window.py | 2 +- gajim/common/app.py | 2 +- gajim/common/helpers.py | 4 ++-- gajim/common/socks5.py | 2 +- gajim/common/zeroconf/zeroconf_avahi.py | 2 +- gajim/common/zeroconf/zeroconf_bonjour.py | 2 +- gajim/config.py | 6 +++--- gajim/conversation_textview.py | 2 +- gajim/groupchat_control.py | 2 +- gajim/message_window.py | 2 +- gajim/roster_window.py | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gajim/advanced_configuration_window.py b/gajim/advanced_configuration_window.py index beff22016..acfa34e6d 100644 --- a/gajim/advanced_configuration_window.py +++ b/gajim/advanced_configuration_window.py @@ -188,7 +188,7 @@ class AdvancedConfigurationWindow: modelrow = self.model[modelpath] option = modelrow[0] if modelrow[2] == self.types['boolean']: - for key in self.right_true_dict.keys(): + for key in self.right_true_dict: if self.right_true_dict[key] == modelrow[1]: modelrow[1] = str(key) newval = {'False': True, 'True': False}[modelrow[1]] diff --git a/gajim/common/app.py b/gajim/common/app.py index c39d98a7d..80ccc5d13 100644 --- a/gajim/common/app.py +++ b/gajim/common/app.py @@ -449,7 +449,7 @@ def get_number_of_securely_connected_accounts(): Return the number of the accounts that are SSL/TLS connected """ num_of_secured = 0 - for account in connections.keys(): + for account in connections: if account_is_securely_connected(account): num_of_secured += 1 return num_of_secured diff --git a/gajim/common/helpers.py b/gajim/common/helpers.py index d0b43b947..e83082f10 100644 --- a/gajim/common/helpers.py +++ b/gajim/common/helpers.py @@ -1008,7 +1008,7 @@ def get_notification_icon_tooltip_dict(): total_messages, total_messages, total_messages) account['event_lines'].append(text) else: - for jid in messages.keys(): + for jid in messages: text = ngettext( '%d message pending', '%d messages pending', @@ -1034,7 +1034,7 @@ def get_notification_icon_tooltip_dict(): total_non_messages, total_non_messages,total_non_messages) account['event_lines'].append(text) else: - for jid in non_messages.keys(): + for jid in non_messages: text = ngettext('%d event pending', '%d events pending', non_messages[jid], non_messages[jid], non_messages[jid]) text += ' ' + _('from user %s') % (jid) diff --git a/gajim/common/socks5.py b/gajim/common/socks5.py index 641588672..3b3892803 100644 --- a/gajim/common/socks5.py +++ b/gajim/common/socks5.py @@ -294,7 +294,7 @@ class SocksQueue: def activate_proxy(self, idx): if not self.isHashInSockObjs(self.senders, idx): return - for key in self.senders.keys(): + for key in self.senders: if idx in key: sender = self.senders[key] if sender.file_props.type_ != 's': diff --git a/gajim/common/zeroconf/zeroconf_avahi.py b/gajim/common/zeroconf/zeroconf_avahi.py index 71119f940..ec31a7beb 100644 --- a/gajim/common/zeroconf/zeroconf_avahi.py +++ b/gajim/common/zeroconf/zeroconf_avahi.py @@ -89,7 +89,7 @@ class Zeroconf: if not self.connected: return if name != self.name: - for key in self.contacts.keys(): + for key in self.contacts: val = self.contacts[key] if val[Constant.BARE_NAME] == name: # try to reduce instead of delete first diff --git a/gajim/common/zeroconf/zeroconf_bonjour.py b/gajim/common/zeroconf/zeroconf_bonjour.py index 3ef4bf3ea..82a5d1c43 100644 --- a/gajim/common/zeroconf/zeroconf_bonjour.py +++ b/gajim/common/zeroconf/zeroconf_bonjour.py @@ -98,7 +98,7 @@ class Zeroconf: if not self.connected: return if name != self.name: - for key in self.contacts.keys(): + for key in self.contacts: if self.contacts[key][Constant.NAME] == name: del self.contacts[key] self.remove_serviceCB(key) diff --git a/gajim/config.py b/gajim/config.py index 2e8e269bc..cf47e9969 100644 --- a/gajim/config.py +++ b/gajim/config.py @@ -341,7 +341,7 @@ class FakeDataForm(Gtk.Table): entry.grab_focus() def get_infos(self): - for name in self.entries.keys(): + for name in self.entries: self.infos[name] = self.entries[name].get_text() return self.infos @@ -390,7 +390,7 @@ class GroupchatConfigWindow: # Draw the edit affiliation list things add_on_vbox = self.xml.get_object('add_on_vbox') - for affiliation in self.affiliation_labels.keys(): + for affiliation in self.affiliation_labels: self.start_users_dict[affiliation] = {} hbox = Gtk.HBox(spacing=5) add_on_vbox.pack_start(hbox, False, True, 0) @@ -539,7 +539,7 @@ class GroupchatConfigWindow: form = self.data_form_widget.data_form con = app.connections[self.account] con.get_module('MUC').set_config(self.room_jid, form) - for affiliation in self.affiliation_labels.keys(): + for affiliation in self.affiliation_labels: users_dict = {} actual_jid_list = [] model = self.affiliation_treeview[affiliation].get_model() diff --git a/gajim/conversation_textview.py b/gajim/conversation_textview.py index ad09bf57b..2a719fed0 100644 --- a/gajim/conversation_textview.py +++ b/gajim/conversation_textview.py @@ -352,7 +352,7 @@ class ConversationTextview(GObject.GObject): return False def del_handlers(self): - for i in self.handlers.keys(): + for i in self.handlers: if self.handlers[i].handler_is_connected(i): self.handlers[i].disconnect(i) del self.handlers diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py index a88b2ee69..1fd66be3a 100644 --- a/gajim/groupchat_control.py +++ b/gajim/groupchat_control.py @@ -844,7 +844,7 @@ class GroupchatControl(ChatControlBase): col.add_attribute(rend[1], rend[3], rend[4]) col.set_cell_data_func(rend[1], rend[5], rend[6]) # set renderers properties - for renderer in self.renderers_propertys.keys(): + for renderer in self.renderers_propertys: renderer.set_property(self.renderers_propertys[renderer][0], self.renderers_propertys[renderer][1]) diff --git a/gajim/message_window.py b/gajim/message_window.py index 05cfc6687..6a30a116b 100644 --- a/gajim/message_window.py +++ b/gajim/message_window.py @@ -1107,7 +1107,7 @@ class MessageWindowMgr(GObject.GObject): return False def _on_window_destroy(self, win): - for k in self._windows.keys(): + for k in self._windows: if self._windows[k].window == win: self.emit('window-delete', self._windows[k]) del self._windows[k] diff --git a/gajim/roster_window.py b/gajim/roster_window.py index c36d4abc6..0b9aa9e00 100644 --- a/gajim/roster_window.py +++ b/gajim/roster_window.py @@ -5545,7 +5545,7 @@ class RosterWindow: col.add_attribute(rend[1], rend[3], rend[4]) col.set_cell_data_func(rend[1], rend[5], rend[6]) # set renderers properties - for renderer in self.renderers_propertys.keys(): + for renderer in self.renderers_propertys: renderer.set_property(self.renderers_propertys[renderer][0], self.renderers_propertys[renderer][1])