[pitivi] Fix pylint inconsistent-return-statements
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix pylint inconsistent-return-statements
- Date: Mon, 11 Nov 2019 22:06:50 +0000 (UTC)
commit 2b8ada702ab31cb3036c204c4c3b388281d195fd
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Oct 29 19:30:39 2019 +0100
Fix pylint inconsistent-return-statements
pitivi/editorperspective.py | 2 +-
pitivi/effects.py | 2 +-
pitivi/medialibrary.py | 3 +++
pitivi/project.py | 4 +++-
pitivi/render.py | 3 ++-
pitivi/timeline/elements.py | 4 +++-
pitivi/timeline/timeline.py | 2 ++
pitivi/undo/timeline.py | 1 +
pitivi/utils/widgets.py | 5 ++++-
pitivi/viewer/move_scale_overlay.py | 4 +++-
pitivi/viewer/overlay_stack.py | 4 ++--
pitivi/viewer/viewer.py | 2 +-
pre-commit.hook | 1 -
tests/test_undo_timeline.py | 1 +
14 files changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/editorperspective.py b/pitivi/editorperspective.py
index 9ac8fbb6..84261c2c 100644
--- a/pitivi/editorperspective.py
+++ b/pitivi/editorperspective.py
@@ -431,7 +431,7 @@ class EditorPerspective(Perspective, Loggable):
self.app.project_manager.saveProject()
def __revert_to_saved_cb(self, unused_action, unused_param):
- return self.app.project_manager.revertToSavedProject()
+ self.app.project_manager.revertToSavedProject()
def __export_project_cb(self, unused_action, unused_param):
uri = self._showExportDialog(self.app.project_manager.current_project)
diff --git a/pitivi/effects.py b/pitivi/effects.py
index d08ba13d..3df3d18c 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -664,7 +664,7 @@ class EffectsPropertiesManager(GObject.Object, Loggable):
def cleanCache(self, effect):
if effect in self.cache_dict:
- return self.cache_dict.pop(effect)
+ self.cache_dict.pop(effect)
def _postConfiguration(self, effect, effect_set_ui):
effect_name = effect.get_property("bin-description")
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 1ac3b370..75001748 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -738,6 +738,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return asset
self.warning("Did not find any asset for uri: %s", uri)
+ return None
def _setupViewAsDragAndDropSource(self, view):
view.drag_source_set(0, [], Gdk.DragAction.COPY)
@@ -1290,6 +1291,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return pathinfo[0]
elif self.clip_view == SHOW_ICONVIEW:
return self.iconview.get_path_at_pos(int(event.x), int(event.y))
+ raise RuntimeError("Unknown view: %s" % self.clip_view)
def _viewSelectPath(self, path):
if self.clip_view == SHOW_TREEVIEW:
@@ -1708,6 +1710,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
return self._getSelectedPathsTreeView()
elif self.clip_view == SHOW_ICONVIEW:
return self._getSelectedPathsIconView()
+ raise RuntimeError("Unknown view: %s" % self.clip_view)
def _getSelectedPathsTreeView(self):
unused_model, rows = self.treeview.get_selection().get_selected_rows()
diff --git a/pitivi/project.py b/pitivi/project.py
index 8a995dfc..dad55af3 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -549,6 +549,7 @@ class ProjectManager(GObject.Object, Loggable):
self.current_project.setModificationState(False)
self.closeRunningProject()
self.load_project(uri)
+ return True
def _projectChangedCb(self, project):
# _backup_lock is a timer, when a change in the project is done it is
@@ -875,6 +876,7 @@ class Project(Loggable, GES.Project):
if thumb:
# First asset that has a preview thumbnail.
return thumb
+ return None
def create_thumb(self):
"""Creates project thumbnails."""
@@ -1180,7 +1182,7 @@ class Project(Loggable, GES.Project):
if total_import_duration == 0:
self.info("No known duration yet")
- return
+ return 0
asset_loading_progress = 0
all_ready = True
diff --git a/pitivi/render.py b/pitivi/render.py
index 12149843..2f9ba62a 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -1029,7 +1029,8 @@ class RenderDialog(Loggable):
hq_proxy = GES.Asset.request(GES.UriClip,
self.app.proxy_manager.getProxyUri(asset_target))
- return hq_proxy or None
+ return hq_proxy
+ return None
def __replace_proxies(self):
for clip in self.project.ges_timeline.ui.clips():
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index aaefa9fa..7a130229 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -965,6 +965,7 @@ class TitleSource(VideoSource):
for spec in self._ges_elem.list_children_properties():
if spec.name == "alpha":
return spec
+ return None
def _get_default_position(self):
return {"posx": 0,
@@ -994,7 +995,7 @@ class VideoUriSource(VideoSource):
for spec in self._ges_elem.list_children_properties():
if spec.name == "alpha":
return spec
-
+ return None
class AudioBackground(Gtk.Box):
@@ -1024,6 +1025,7 @@ class AudioUriSource(TimelineElement):
for spec in self._ges_elem.list_children_properties():
if spec.name == "volume":
return spec
+ return None
class TrimHandle(Gtk.EventBox, Loggable):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 9c8cbb54..975c5e9b 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1291,6 +1291,8 @@ class Timeline(Gtk.EventBox, Zoomable, Loggable):
self.debug("Returning layer %s, separators: %s", ges_layer, separators)
return ges_layer, separators
+ return None
+
def _setSeparatorsPrelight(self, light):
for sep in self.__on_separators:
if light:
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index ff13ee20..464a164d 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -398,6 +398,7 @@ class TransitionClipAction(UndoableAction):
continue
# Double lucky!
return track_element
+ return None
class TransitionClipAddedAction(TransitionClipAction):
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index f2f9b377..12bff2df 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -651,6 +651,7 @@ def make_widget_wrapper(prop, widget):
return ToggleWidget(prop.default_value, widget)
else:
Loggable().fixme("%s has not been wrapped into a Dynamic Widget", widget)
+ return None
class GstElementSettingsWidget(Gtk.Box, Loggable):
@@ -1115,6 +1116,7 @@ class GstElementSettingsWidget(Gtk.Box, Loggable):
for prop in self.properties:
if prop.name == prop_name:
return self.properties[prop]
+ return None
class GstElementSettingsDialog(Loggable):
@@ -1434,7 +1436,8 @@ class ColorPickerButton(Gtk.Button):
def button_release_event_cb(self, widget, event):
if event.button != Gdk.BUTTON_PRIMARY:
- return False
+ return
+
self.grab_color_at_pointer(event.get_screen(), event.x_root, event.y_root)
self.emit("value-changed")
self.shutdown_eyedropper()
diff --git a/pitivi/viewer/move_scale_overlay.py b/pitivi/viewer/move_scale_overlay.py
index 91a05568..61e39d51 100644
--- a/pitivi/viewer/move_scale_overlay.py
+++ b/pitivi/viewer/move_scale_overlay.py
@@ -244,6 +244,7 @@ class CornerHandle(Handle):
def _needs_size_restriction(self, handle_position_compare, cursor_position_compare):
if (handle_position_compare != cursor_position_compare).any():
return True
+ return False
def _update_neighbours(self):
for neighbour in self.neighbours:
@@ -282,6 +283,7 @@ class EdgeHandle(Handle):
# left right
if handle_position_compare[0] != cursor_position_compare[0]:
return True
+ return False
def _update_neighbours(self):
if self.placement[0] in (Edge.left, Edge.right):
@@ -516,7 +518,7 @@ class MoveScaleOverlay(Overlay):
def on_hover(self, cursor_pos):
if not self.is_visible():
- return
+ return False
# Check if one of the handles is hovered.
self.hovered_handle = None
diff --git a/pitivi/viewer/overlay_stack.py b/pitivi/viewer/overlay_stack.py
index a1da95cf..3af228e6 100644
--- a/pitivi/viewer/overlay_stack.py
+++ b/pitivi/viewer/overlay_stack.py
@@ -95,7 +95,7 @@ class OverlayStack(Gtk.Overlay, Loggable):
elif event.type == Gdk.EventType.LEAVE_NOTIFY and event.mode == Gdk.CrossingMode.NORMAL:
# If we have a click position, the user is dragging, so we don't want to lose focus and return
if isinstance(self.click_position, numpy.ndarray):
- return
+ return False
for overlay in self.__overlays.values():
overlay.unhover()
self.reset_cursor()
@@ -118,7 +118,7 @@ class OverlayStack(Gtk.Overlay, Loggable):
if self.selected_overlay.on_hover(cursor_position):
if self.selected_overlay.hovered_handle:
self.hovered_overlay = self.selected_overlay
- return
+ return False
for overlay in self.__visible_overlays:
if overlay.on_hover(cursor_position):
diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
index 71e11f6f..ec7e4779 100644
--- a/pitivi/viewer/viewer.py
+++ b/pitivi/viewer/viewer.py
@@ -520,7 +520,7 @@ class ViewerContainer(Gtk.Box, Loggable):
"""Shows a live preview of a clip being trimmed."""
if not hasattr(clip, "get_uri") or isinstance(clip, GES.TitleClip) or clip.props.is_image:
self.log("Not previewing trim for image or title clip: %s", clip)
- return False
+ return
if self.project.pipeline.getState() == Gst.State.PLAYING:
self.project.pipeline.setState(Gst.State.PAUSED)
diff --git a/pre-commit.hook b/pre-commit.hook
index da94fee4..5751009f 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -23,7 +23,6 @@ pitivi/settings.py
pitivi/timeline/elements.py
pitivi/timeline/timeline.py
pitivi/titleeditor.py
-pitivi/undo/timeline.py
pitivi/utils/extract.py
pitivi/utils/loggable.py
pitivi/utils/misc.py
diff --git a/tests/test_undo_timeline.py b/tests/test_undo_timeline.py
index 793d8638..5bb704e5 100644
--- a/tests/test_undo_timeline.py
+++ b/tests/test_undo_timeline.py
@@ -92,6 +92,7 @@ class BaseTestUndoTimeline(common.TestCase):
for element in clip.get_children(False):
if isinstance(element, GES.VideoTransition):
return element
+ return None
def check_layers(self, layers):
self.assertEqual(self.timeline.get_layers(), layers)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]