Fix pylint errors

- deprecated-method
- anomalous-backslash-in-string
- cell-var-from-loop
- undefined-loop-variable
This commit is contained in:
Philipp Hörist 2018-09-18 17:58:39 +02:00 committed by Philipp Hörist
parent 16f7620204
commit 4c38a309fc
6 changed files with 12 additions and 12 deletions

View File

@ -215,7 +215,7 @@ class Command:
Extract handler's arguments specification, as it was defined
preserving their order.
"""
names, var_args, var_kwargs, defaults = getargspec(self.handler)
names, var_args, var_kwargs, defaults = getargspec(self.handler) # pylint: disable=W1505
# Behavior of this code need to be checked. Might yield
# incorrect results on some rare occasions.

View File

@ -48,7 +48,7 @@ class Option(IntEnum):
opt_int = ['integer', 0]
opt_str = ['string', 0]
opt_bool = ['boolean', 0]
opt_color = ['color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$']
opt_color = ['color', r'(#[0-9a-fA-F]{6})|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)']
opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
opt_show_roster_on_startup = ['always', 'never', 'last_state']
opt_treat_incoming_messages = ['', 'chat', 'normal']

View File

@ -59,7 +59,7 @@ class OptionsParser:
for line in fd:
match = regex.match(line)
if match is None:
log.warn('Invalid configuration line, ignoring it: %s', line)
log.warning('Invalid configuration line, ignoring it: %s', line)
continue
optname, key, subname, value = match.groups()
if key is None:

View File

@ -121,7 +121,7 @@ class Zeroconf:
}
# Split on '.' but do not split on '\.'
result = re.split('(?<!\\\\)\.', fullname)
result = re.split(r'(?<!\\\\)\.', fullname)
name = result[0]
protocol, domain = result[2:4]

View File

@ -428,12 +428,12 @@ class SingleForm(Gtk.Table):
widget.set_sensitive(readwrite)
else:
# more than 5 options: show combobox
def on_list_multi_treeview_changed(selection, f):
def for_selected(treemodel, path, iter_):
def on_list_multi_treeview_changed(selection, field_):
def for_selected(treemodel, _path, iter_):
vals.append(treemodel[iter_][1])
vals = []
selection.selected_foreach(for_selected)
field.values = vals[:]
field_.values = vals[:]
widget = Gtk.ScrolledWindow()
widget.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
tv = gtkgui_helpers.create_list_multi(field.options,

View File

@ -104,6 +104,7 @@ class EditGroupsDialog:
account, [group])
# FIXME: Ugly workaround.
# pylint: disable=undefined-loop-variable
app.interface.roster.draw_group(_('General'), account)
def add_group(self, group):
@ -116,6 +117,7 @@ class EditGroupsDialog:
# FIXME: Ugly workaround.
# Maybe we haven't been in any group (defaults to General)
# pylint: disable=undefined-loop-variable
app.interface.roster.draw_group(_('General'), account)
def on_add_button_clicked(self, widget):
@ -1692,17 +1694,15 @@ class VoIPCallReceivedDialog:
out_xid = ctrl.xml.get_object('outgoing_drawingarea').\
get_property('window').get_xid()
b = content.src_bin
found = False
for e in b.children:
if e.get_name().startswith('autovideosink'):
found = True
break
if found:
if not e.get_name().startswith('autovideosink'):
continue
for f in e.children:
if f.get_name().startswith('autovideosink'):
f.set_window_handle(out_xid)
content.out_xid = out_xid
break
break
content.in_xid = in_xid
ctrl.set_video_state('connecting', self.sid)
# Now, accept the content/sessions.