Fix pylint errors
- consider-using-enumerate - unneeded-not - unidiomatic-typecheck
This commit is contained in:
parent
251dbae5d6
commit
1680c3bb38
|
@ -371,7 +371,7 @@ class ConnectionHandlersBase:
|
|||
|
||||
# determine if this session is a pm session
|
||||
# if not, discard the resource so that all sessions are stored bare
|
||||
if not type_ == 'pm':
|
||||
if type_ != 'pm':
|
||||
jid = app.get_jid_without_resource(jid)
|
||||
|
||||
if not jid in self.sessions:
|
||||
|
|
|
@ -95,7 +95,7 @@ class Zeroconf:
|
|||
# try to reduce instead of delete first
|
||||
resolved_info = val[Constant.RESOLVED_INFO]
|
||||
if len(resolved_info) > 1:
|
||||
for i in range(len(resolved_info)):
|
||||
for i, _info in enumerate(resolved_info):
|
||||
if resolved_info[i][ConstantRI.INTERFACE] == interface and resolved_info[i][ConstantRI.PROTOCOL] == protocol:
|
||||
del self.contacts[key][Constant.RESOLVED_INFO][i]
|
||||
# if still something left, don't remove
|
||||
|
@ -180,7 +180,7 @@ class Zeroconf:
|
|||
old_name, old_domain, old_resolved_info, old_bare_name, _old_txt = self.contacts[name]
|
||||
if name == old_name and domain == old_domain and bare_name == old_bare_name:
|
||||
# Seems similar enough, try to merge resolved info:
|
||||
for i in range(len(old_resolved_info)):
|
||||
for i, _info in enumerate(old_resolved_info):
|
||||
# for now, keep a single record for each (interface, protocol) pair
|
||||
#
|
||||
# Note that, theoretically, we could both get IPv4 and
|
||||
|
|
|
@ -276,8 +276,8 @@ class DataFormWidget(Gtk.Alignment):
|
|||
selection = self.records_treeview.get_selection()
|
||||
model, rowrefs = selection.get_selected_rows()
|
||||
# rowref is a list of paths
|
||||
for i in range(len(rowrefs)):
|
||||
rowrefs[i] = Gtk.TreeRowReference.new(model, rowrefs[i])
|
||||
for index, _path in enumerate(rowrefs):
|
||||
rowrefs[index] = Gtk.TreeRowReference.new(model, rowrefs[index])
|
||||
# rowref is a list of row references; need to convert because we will
|
||||
# modify the model, paths would change
|
||||
for rowref in rowrefs:
|
||||
|
|
|
@ -339,8 +339,8 @@ class AccountCreationWizard:
|
|||
proxies_combobox.set_model(model)
|
||||
proxies = app.config.get_per('proxies')
|
||||
proxies.insert(0, _('None'))
|
||||
for i in range(len(proxies)):
|
||||
model.append([proxies[i]])
|
||||
for proxy in proxies:
|
||||
model.append([proxy])
|
||||
proxies_combobox.set_active(0)
|
||||
|
||||
def on_manage_proxies_button_clicked(self, widget):
|
||||
|
|
|
@ -179,28 +179,28 @@ class Preferences(Gtk.ApplicationWindow):
|
|||
self.iconset_combobox.add_attribute(renderer_text, 'text', 1)
|
||||
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
|
||||
self.iconset_combobox.set_model(model)
|
||||
l = []
|
||||
dirlist = []
|
||||
for dir_ in iconsets_list:
|
||||
if not os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', dir_)) \
|
||||
and not os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), dir_)):
|
||||
continue
|
||||
if dir_ not in ('.svn', 'transports'):
|
||||
l.append(dir_)
|
||||
if l.count == 0:
|
||||
l.append(' ')
|
||||
for i in range(len(l)):
|
||||
dirlist.append(dir_)
|
||||
if not dirlist:
|
||||
dirlist.append(' ')
|
||||
for index, dir_ in enumerate(dirlist):
|
||||
preview = Gtk.Image()
|
||||
files = []
|
||||
files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
|
||||
files.append(os.path.join(helpers.get_iconset_path(dir_), '16x16',
|
||||
'online.png'))
|
||||
files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
|
||||
files.append(os.path.join(helpers.get_iconset_path(dir_), '16x16',
|
||||
'online.gif'))
|
||||
for file_ in files:
|
||||
if os.path.exists(file_):
|
||||
preview.set_from_file(file_)
|
||||
model.append([preview, l[i]])
|
||||
if app.config.get('iconset') == l[i]:
|
||||
self.iconset_combobox.set_active(i)
|
||||
model.append([preview, dir_])
|
||||
if app.config.get('iconset') == dir_:
|
||||
self.iconset_combobox.set_active(index)
|
||||
|
||||
# Use transports iconsets
|
||||
st = app.config.get('use_transports_iconsets')
|
||||
|
@ -985,12 +985,12 @@ class Preferences(Gtk.ApplicationWindow):
|
|||
proxy_combobox = self.xml.get_object('proxies_combobox')
|
||||
model = proxy_combobox.get_model()
|
||||
model.clear()
|
||||
l = app.config.get_per('proxies')
|
||||
l.insert(0, _('None'))
|
||||
for i in range(len(l)):
|
||||
model.append([l[i]])
|
||||
if our_proxy == l[i]:
|
||||
proxy_combobox.set_active(i)
|
||||
proxies = app.config.get_per('proxies')
|
||||
proxies.insert(0, _('None'))
|
||||
for index, proxy in enumerate(proxies):
|
||||
model.append([proxy])
|
||||
if our_proxy == proxy:
|
||||
proxy_combobox.set_active(index)
|
||||
|
||||
def on_open_advanced_editor_button_clicked(self, widget, data=None):
|
||||
if 'advanced_config' in app.interface.instances:
|
||||
|
|
|
@ -1568,7 +1568,7 @@ class Interface:
|
|||
for event_name, event_handlers in self.handlers.items():
|
||||
for event_handler in event_handlers:
|
||||
prio = ged.GUI1
|
||||
if type(event_handler) == tuple:
|
||||
if isinstance(event_handler, tuple):
|
||||
prio = event_handler[1]
|
||||
event_handler = event_handler[0]
|
||||
app.ged.register_event_handler(event_name, prio,
|
||||
|
|
Loading…
Reference in New Issue