[pitivi] Fix pylint unused-variable
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix pylint unused-variable
- Date: Mon, 11 Nov 2019 22:04:53 +0000 (UTC)
commit bc01d22a3cb2f9c7bf0ee211e66b4ceda242f031
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Fri Oct 25 23:01:15 2019 +0200
Fix pylint unused-variable
pitivi/check.py | 1 +
pitivi/effects.py | 4 ++--
pitivi/medialibrary.py | 4 ++--
pitivi/preset.py | 8 ++++----
pitivi/render.py | 2 +-
pitivi/settings.py | 6 +++---
pitivi/timeline/elements.py | 2 +-
pitivi/undo/timeline.py | 4 ++--
pitivi/utils/misc.py | 2 +-
pitivi/utils/validate.py | 2 +-
pitivi/utils/widgets.py | 10 +++++-----
11 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/pitivi/check.py b/pitivi/check.py
index 8a0de935..566b2f05 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -388,6 +388,7 @@ def initialize_modules():
require_version("GES", GST_API_VERSION)
from gi.repository import GES
res, sys.argv = GES.init_check(sys.argv)
+ assert res
# Monkey patch deprecated methods to use the new variant by default
GES.TrackElement.list_children_properties = GES.TimelineElement.list_children_properties
diff --git a/pitivi/effects.py b/pitivi/effects.py
index dd0ff851..48c784fa 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -464,7 +464,7 @@ class EffectListWidget(Gtk.Box, Loggable):
cell.props.markup = self.formatDescription(model, iter_)
def formatDescription(self, model, iter_):
- name, element_name, desc = model.get(iter_, COL_NAME_TEXT, COL_ELEMENT_NAME, COL_DESC_TEXT)
+ name, desc = model.get(iter_, COL_NAME_TEXT, COL_DESC_TEXT)
escape = GLib.markup_escape_text
return "<b>%s</b>\n%s" % (escape(name), escape(desc))
@@ -555,7 +555,7 @@ class EffectListWidget(Gtk.Box, Loggable):
def getSelectedEffect(self):
if self._draggedItems:
return self._draggedItems
- model, rows = self.view.get_selection().get_selected_rows()
+ unused_model, rows = self.view.get_selection().get_selected_rows()
path = self.model_filter.convert_path_to_child_path(rows[0])
return self.storemodel[path][COL_ELEMENT_NAME]
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 1dde87c1..5640cf60 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -1256,7 +1256,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
path = None
tup = view.get_path_at_pos(int(event.x), int(event.y))
if tup:
- path, column, x, y = tup
+ path, unused_column, unused_x, unused_y = tup
return path
elif isinstance(view, Gtk.IconView):
return view.get_path_at_pos(int(event.x), int(event.y))
@@ -1710,7 +1710,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return self._getSelectedPathsIconView()
def _getSelectedPathsTreeView(self):
- model, rows = self.treeview.get_selection().get_selected_rows()
+ unused_model, rows = self.treeview.get_selection().get_selected_rows()
return rows
def _getSelectedPathsIconView(self):
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 5913faf5..3d950213 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -202,7 +202,7 @@ class PresetManager(GObject.Object, Loggable):
def saveAll(self):
"""Writes changes to disk for all presets."""
- for preset_name, values in self.ordered:
+ for preset_name, unused_values in self.ordered:
self._savePreset(preset_name)
def _savePreset(self, preset_name):
@@ -260,7 +260,7 @@ class PresetManager(GObject.Object, Loggable):
return
# If there is one already with this name, make way for this one.
self._forgetPreset(new_name)
- for i, row in enumerate(self.ordered):
+ for row in self.ordered:
if row[0] == old_name:
row[0] = new_name
break
@@ -313,7 +313,7 @@ class PresetManager(GObject.Object, Loggable):
try:
values = self.presets[preset]
self.cur_preset = preset
- for field, (setter, getter) in self.widget_map.items():
+ for field, (setter, unused_getter) in self.widget_map.items():
setter(values[field])
finally:
self.ignore_update_requests = False
@@ -330,7 +330,7 @@ class PresetManager(GObject.Object, Loggable):
def _updatePresetValues(self, values):
"""Copies the values from the widgets to the specified values dict."""
- for field, (setter, getter) in self.widget_map.items():
+ for field, (unused_setter, getter) in self.widget_map.items():
values[field] = getter()
def _isCurrentPresetChanged(self, name):
diff --git a/pitivi/render.py b/pitivi/render.py
index 65f4bf75..d3c2efb9 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -1159,7 +1159,7 @@ class RenderDialog(Loggable):
elif message.type == Gst.MessageType.STATE_CHANGED and self.progress:
if message.src == self._pipeline:
- prev, state, pending = message.parse_state_changed()
+ unused_prev, state, pending = message.parse_state_changed()
if pending == Gst.State.VOID_PENDING:
# State will not change further.
if state == Gst.State.PLAYING:
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 6f6494c5..5c6e5e28 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -197,7 +197,7 @@ class GlobalSettings(GObject.Object, Loggable):
self.error("Failed to parse %s: %s", self.conf_file_path, e)
return
- for (section, attrname, typ, key, env, value) in self.iterAllOptions():
+ for (section, attrname, typ, key, unused_env, value) in self.iterAllOptions():
if not self._config.has_section(section):
continue
if key and self._config.has_option(section, key):
@@ -232,7 +232,7 @@ class GlobalSettings(GObject.Object, Loggable):
def _readSettingsFromEnvironmentVariables(self):
"""Reads settings from their registered environment variables."""
- for section, attrname, typ, key, env, value in self.iterAllOptions():
+ for unused_section, attrname, typ, unused_key, env, unused_value in self.iterAllOptions():
if not env:
# This option does not have an environment variable name.
continue
@@ -241,7 +241,7 @@ class GlobalSettings(GObject.Object, Loggable):
setattr(self, attrname, var)
def _writeSettingsToConfigurationFile(self):
- for (section, attrname, typ, key, env_var, value) in self.iterAllOptions():
+ for section, unused_attrname, unused_typ, key, unused_env_var, value in self.iterAllOptions():
if not self._config.has_section(section):
self._config.add_section(section)
if key:
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index c96ef470..66e1dbb3 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -903,7 +903,7 @@ class VideoSource(TimelineElement):
for track_element in parent.find_track_elements(
None, GES.TrackType.VIDEO, GES.BaseEffect):
- res, videoflip, unused_pspec = track_element.lookup_child(
+ res, unused_videoflip, unused_pspec = track_element.lookup_child(
"GstVideoFlip::method")
if res:
self.__videoflip = track_element
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index cef3f57a..191d4d42 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -724,7 +724,7 @@ class LayerObserver(MetaContainerObserver, Loggable):
self.track_element_observers[track_element] = observer
return
- for prop, binding in track_element.get_all_control_bindings().items():
+ for unused_prop, binding in track_element.get_all_control_bindings().items():
self._connectToControlSource(track_element, binding)
track_element.connect("control-binding-added",
self._control_binding_added_cb)
@@ -739,7 +739,7 @@ class LayerObserver(MetaContainerObserver, Loggable):
if not isinstance(track_element, GES.VideoTransition):
track_element.disconnect_by_func(self._control_binding_added_cb)
track_element.disconnect_by_func(self._control_binding_removed_cb)
- for prop, binding in track_element.get_all_control_bindings().items():
+ for unused_prop, binding in track_element.get_all_control_bindings().items():
self._disconnectFromControlSource(binding)
observer = self.track_element_observers.pop(track_element, None)
# We only keep track of some track_elements.
diff --git a/pitivi/utils/misc.py b/pitivi/utils/misc.py
index 308571ae..1e3dc826 100644
--- a/pitivi/utils/misc.py
+++ b/pitivi/utils/misc.py
@@ -212,7 +212,7 @@ class PathWalker(Thread):
def _scan_dir(self, folder):
"""Scans the folder recursively and yields the URIs of the files."""
self.log("Scanning folder %s", folder)
- for path, dirs, files in os.walk(folder):
+ for path, unused_dirs, files in os.walk(folder):
if self.stopme.is_set():
return
for afile in files:
diff --git a/pitivi/utils/validate.py b/pitivi/utils/validate.py
index 04c7a0a6..be3dcb11 100644
--- a/pitivi/utils/validate.py
+++ b/pitivi/utils/validate.py
@@ -163,6 +163,7 @@ def positionChangedCb(pipeline, position, scenario, action,
def seek(scenario, action):
res, wanted_position = GstValidate.utils_get_clocktime(action.structure,
"start")
+ assert res
scenario.get_pipeline().simple_seek(wanted_position)
scenario.get_pipeline().connect("position", positionChangedCb, scenario,
action, wanted_position)
@@ -181,7 +182,6 @@ def set_state(scenario, action):
if wanted_state == "paused":
if scenario.__dict__.get("started", None) is None:
-
return 1
return GstValidate.execute_action(GstValidate.get_action_type(action.type).overriden_type,
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index d6cb66fc..6cb61453 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -513,7 +513,7 @@ class ChoiceWidget(Gtk.Box, DynamicWidget):
self.values = [choice[1] for choice in choices]
m = Gtk.ListStore(str)
self.contents.set_model(m)
- for choice, value in choices:
+ for choice, unused_value in choices:
self.contents.append_text(_(choice))
if len(choices) <= 1:
self.contents.set_sensitive(False)
@@ -771,7 +771,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
# The "keyframe toggle" button associated with this property
if not isinstance(widget, (ToggleWidget, ChoiceWidget)):
- res, element, pspec = self.element.lookup_child(prop.name)
+ res, element, unused_pspec = self.element.lookup_child(prop.name)
assert res
binding = GstController.DirectControlBinding.new(
element, prop.name,
@@ -919,7 +919,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
keyframe_button = None
if not isinstance(prop_widget, (ToggleWidget, ChoiceWidget)):
- res, element, pspec = self.element.lookup_child(prop.name)
+ res, element, unused_pspec = self.element.lookup_child(prop.name)
assert res
binding = GstController.DirectControlBinding.new(
element, prop.name,
@@ -1097,7 +1097,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
widget = ToggleWidget(default=prop.default_value)
elif type_name == "GEnum":
choices = []
- for key, val in prop.enum_class.__enum_values__.items():
+ for unused_key, val in prop.enum_class.__enum_values__.items():
choices.append([val.value_name, int(val)])
widget = ChoiceWidget(choices, default=prop.default_value)
elif type_name == "GstFraction":
@@ -1210,7 +1210,7 @@ class GstElementSettingsDialog(Loggable):
self.resetAll()
def resetAll(self):
- for prop, widget in self.elementsettings.properties.items():
+ for unused_prop, widget in self.elementsettings.properties.items():
widget.setWidgetToDefault()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]