From 4c38a309fcdbc408078f1ffc04a71102af66e67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <forenjunkie@chello.at> Date: Tue, 18 Sep 2018 17:58:39 +0200 Subject: [PATCH] Fix pylint errors - deprecated-method - anomalous-backslash-in-string - cell-var-from-loop - undefined-loop-variable --- gajim/command_system/framework.py | 2 +- gajim/common/config.py | 2 +- gajim/common/optparser.py | 2 +- gajim/common/zeroconf/zeroconf_bonjour.py | 2 +- gajim/dataforms_widget.py | 6 +++--- gajim/dialogs.py | 10 +++++----- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gajim/command_system/framework.py b/gajim/command_system/framework.py index a7ade6344e..0dfdbaa9f8 100644 --- a/gajim/command_system/framework.py +++ b/gajim/command_system/framework.py @@ -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. diff --git a/gajim/common/config.py b/gajim/common/config.py index 9814917b26..efe1237d51 100644 --- a/gajim/common/config.py +++ b/gajim/common/config.py @@ -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'] diff --git a/gajim/common/optparser.py b/gajim/common/optparser.py index 452c13d168..93bb88797c 100644 --- a/gajim/common/optparser.py +++ b/gajim/common/optparser.py @@ -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: diff --git a/gajim/common/zeroconf/zeroconf_bonjour.py b/gajim/common/zeroconf/zeroconf_bonjour.py index 03e5171c0c..29a2405fcf 100644 --- a/gajim/common/zeroconf/zeroconf_bonjour.py +++ b/gajim/common/zeroconf/zeroconf_bonjour.py @@ -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] diff --git a/gajim/dataforms_widget.py b/gajim/dataforms_widget.py index c9fc8719e8..c8e313f5cb 100644 --- a/gajim/dataforms_widget.py +++ b/gajim/dataforms_widget.py @@ -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, diff --git a/gajim/dialogs.py b/gajim/dialogs.py index ee9418de55..1dc8977e59 100644 --- a/gajim/dialogs.py +++ b/gajim/dialogs.py @@ -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. -- GitLab