Fix consider-iterating-dictionary pylint errors

This commit is contained in:
Philipp Hörist 2018-09-17 22:34:15 +02:00 committed by Philipp Hörist
parent 407dc04b28
commit c4bd6d6ab2
11 changed files with 14 additions and 14 deletions

View File

@ -188,7 +188,7 @@ class AdvancedConfigurationWindow:
modelrow = self.model[modelpath] modelrow = self.model[modelpath]
option = modelrow[0] option = modelrow[0]
if modelrow[2] == self.types['boolean']: 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]: if self.right_true_dict[key] == modelrow[1]:
modelrow[1] = str(key) modelrow[1] = str(key)
newval = {'False': True, 'True': False}[modelrow[1]] newval = {'False': True, 'True': False}[modelrow[1]]

View File

@ -449,7 +449,7 @@ def get_number_of_securely_connected_accounts():
Return the number of the accounts that are SSL/TLS connected Return the number of the accounts that are SSL/TLS connected
""" """
num_of_secured = 0 num_of_secured = 0
for account in connections.keys(): for account in connections:
if account_is_securely_connected(account): if account_is_securely_connected(account):
num_of_secured += 1 num_of_secured += 1
return num_of_secured return num_of_secured

View File

@ -1008,7 +1008,7 @@ def get_notification_icon_tooltip_dict():
total_messages, total_messages, total_messages) total_messages, total_messages, total_messages)
account['event_lines'].append(text) account['event_lines'].append(text)
else: else:
for jid in messages.keys(): for jid in messages:
text = ngettext( text = ngettext(
'%d message pending', '%d message pending',
'%d messages pending', '%d messages pending',
@ -1034,7 +1034,7 @@ def get_notification_icon_tooltip_dict():
total_non_messages, total_non_messages,total_non_messages) total_non_messages, total_non_messages,total_non_messages)
account['event_lines'].append(text) account['event_lines'].append(text)
else: else:
for jid in non_messages.keys(): for jid in non_messages:
text = ngettext('%d event pending', '%d events pending', text = ngettext('%d event pending', '%d events pending',
non_messages[jid], non_messages[jid], non_messages[jid]) non_messages[jid], non_messages[jid], non_messages[jid])
text += ' ' + _('from user %s') % (jid) text += ' ' + _('from user %s') % (jid)

View File

@ -294,7 +294,7 @@ class SocksQueue:
def activate_proxy(self, idx): def activate_proxy(self, idx):
if not self.isHashInSockObjs(self.senders, idx): if not self.isHashInSockObjs(self.senders, idx):
return return
for key in self.senders.keys(): for key in self.senders:
if idx in key: if idx in key:
sender = self.senders[key] sender = self.senders[key]
if sender.file_props.type_ != 's': if sender.file_props.type_ != 's':

View File

@ -89,7 +89,7 @@ class Zeroconf:
if not self.connected: if not self.connected:
return return
if name != self.name: if name != self.name:
for key in self.contacts.keys(): for key in self.contacts:
val = self.contacts[key] val = self.contacts[key]
if val[Constant.BARE_NAME] == name: if val[Constant.BARE_NAME] == name:
# try to reduce instead of delete first # try to reduce instead of delete first

View File

@ -98,7 +98,7 @@ class Zeroconf:
if not self.connected: if not self.connected:
return return
if name != self.name: if name != self.name:
for key in self.contacts.keys(): for key in self.contacts:
if self.contacts[key][Constant.NAME] == name: if self.contacts[key][Constant.NAME] == name:
del self.contacts[key] del self.contacts[key]
self.remove_serviceCB(key) self.remove_serviceCB(key)

View File

@ -341,7 +341,7 @@ class FakeDataForm(Gtk.Table):
entry.grab_focus() entry.grab_focus()
def get_infos(self): def get_infos(self):
for name in self.entries.keys(): for name in self.entries:
self.infos[name] = self.entries[name].get_text() self.infos[name] = self.entries[name].get_text()
return self.infos return self.infos
@ -390,7 +390,7 @@ class GroupchatConfigWindow:
# Draw the edit affiliation list things # Draw the edit affiliation list things
add_on_vbox = self.xml.get_object('add_on_vbox') 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] = {} self.start_users_dict[affiliation] = {}
hbox = Gtk.HBox(spacing=5) hbox = Gtk.HBox(spacing=5)
add_on_vbox.pack_start(hbox, False, True, 0) add_on_vbox.pack_start(hbox, False, True, 0)
@ -539,7 +539,7 @@ class GroupchatConfigWindow:
form = self.data_form_widget.data_form form = self.data_form_widget.data_form
con = app.connections[self.account] con = app.connections[self.account]
con.get_module('MUC').set_config(self.room_jid, form) 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 = {} users_dict = {}
actual_jid_list = [] actual_jid_list = []
model = self.affiliation_treeview[affiliation].get_model() model = self.affiliation_treeview[affiliation].get_model()

View File

@ -352,7 +352,7 @@ class ConversationTextview(GObject.GObject):
return False return False
def del_handlers(self): def del_handlers(self):
for i in self.handlers.keys(): for i in self.handlers:
if self.handlers[i].handler_is_connected(i): if self.handlers[i].handler_is_connected(i):
self.handlers[i].disconnect(i) self.handlers[i].disconnect(i)
del self.handlers del self.handlers

View File

@ -844,7 +844,7 @@ class GroupchatControl(ChatControlBase):
col.add_attribute(rend[1], rend[3], rend[4]) col.add_attribute(rend[1], rend[3], rend[4])
col.set_cell_data_func(rend[1], rend[5], rend[6]) col.set_cell_data_func(rend[1], rend[5], rend[6])
# set renderers properties # set renderers properties
for renderer in self.renderers_propertys.keys(): for renderer in self.renderers_propertys:
renderer.set_property(self.renderers_propertys[renderer][0], renderer.set_property(self.renderers_propertys[renderer][0],
self.renderers_propertys[renderer][1]) self.renderers_propertys[renderer][1])

View File

@ -1107,7 +1107,7 @@ class MessageWindowMgr(GObject.GObject):
return False return False
def _on_window_destroy(self, win): def _on_window_destroy(self, win):
for k in self._windows.keys(): for k in self._windows:
if self._windows[k].window == win: if self._windows[k].window == win:
self.emit('window-delete', self._windows[k]) self.emit('window-delete', self._windows[k])
del self._windows[k] del self._windows[k]

View File

@ -5545,7 +5545,7 @@ class RosterWindow:
col.add_attribute(rend[1], rend[3], rend[4]) col.add_attribute(rend[1], rend[3], rend[4])
col.set_cell_data_func(rend[1], rend[5], rend[6]) col.set_cell_data_func(rend[1], rend[5], rend[6])
# set renderers properties # set renderers properties
for renderer in self.renderers_propertys.keys(): for renderer in self.renderers_propertys:
renderer.set_property(self.renderers_propertys[renderer][0], renderer.set_property(self.renderers_propertys[renderer][0],
self.renderers_propertys[renderer][1]) self.renderers_propertys[renderer][1])