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