[pitivi] Fix some pylint invalid-name
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix some pylint invalid-name
- Date: Mon, 11 Nov 2019 22:06:14 +0000 (UTC)
commit 292024510e258fbc4ebf4ab4552c20ed30a72343
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue Oct 29 11:29:25 2019 +0100
Fix some pylint invalid-name
pitivi/application.py | 4 ++--
pitivi/dialogs/clipmediaprops.py | 4 ++--
pitivi/transitions.py | 24 ++++++++++++------------
pre-commit.hook | 11 -----------
tests/test_timeline_layer.py | 3 ++-
tests/test_undo_project.py | 2 +-
tests/test_utils.py | 18 +++++++++---------
tests/test_widgets.py | 9 ++++++---
8 files changed, 34 insertions(+), 41 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 4d523e13..b8087bab 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -328,10 +328,10 @@ class Pitivi(Gtk.Application, Loggable):
current_version = version
self.info("Latest software version is %s", current_version)
- VERSION_split = [int(i) for i in VERSION.split(".")]
+ version_split = [int(i) for i in VERSION.split(".")]
current_version_split = [int(i)
for i in current_version.split(".")]
- if VERSION_split > current_version_split:
+ if version_split > current_version_split:
status = "CURRENT"
self.info(
"Running version %s, which is newer than the latest known version. Considering it as the
latest current version.", VERSION)
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
index 65d9e175..afa55068 100644
--- a/pitivi/dialogs/clipmediaprops.py
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -54,7 +54,7 @@ class ClipMediaPropsDialog:
self.size_checkbutton = builder.get_object("size_checkbutton")
self.framerate_checkbutton = builder.get_object(
"framerate_checkbutton")
- self.PAR_checkbutton = builder.get_object("PAR_checkbutton")
+ self.par_checkbutton = builder.get_object("PAR_checkbutton")
self.channels_checkbutton = builder.get_object("channels_checkbutton")
self.samplerate_checkbutton = builder.get_object("samplerate_checkbtn")
# These labels are in a separate table col on the right of checkboxes:
@@ -123,7 +123,7 @@ class ClipMediaPropsDialog:
if self.is_image:
self.frame_rate.hide()
self.aspect_ratio.hide()
- self.PAR_checkbutton.hide()
+ self.par_checkbutton.hide()
self.framerate_checkbutton.hide()
self.video_header_label.set_markup("<b>" + _("Image:") + "</b>")
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index e5127c7a..ac1297c6 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -70,11 +70,11 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.searchbar.set_orientation(Gtk.Orientation.HORIZONTAL)
# Prevents being flush against the notebook
self.searchbar.set_border_width(3)
- self.searchEntry = Gtk.Entry()
- self.searchEntry.set_icon_from_icon_name(
+ self.search_entry = Gtk.Entry()
+ self.search_entry.set_icon_from_icon_name(
Gtk.EntryIconPosition.SECONDARY, "edit-clear-symbolic")
- self.searchEntry.set_placeholder_text(_("Search..."))
- self.searchbar.pack_end(self.searchEntry, True, True, 0)
+ self.search_entry.set_placeholder_text(_("Search..."))
+ self.searchbar.pack_end(self.search_entry, True, True, 0)
self.props_widgets = Gtk.Grid()
self.props_widgets.props.margin = PADDING
@@ -124,8 +124,8 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.iconview_scrollwin.add(self.iconview)
self.iconview.set_property("has_tooltip", True)
- self.searchEntry.connect("changed", self._search_entry_changed_cb)
- self.searchEntry.connect("icon-press", self._search_entry_icon_press_cb)
+ self.search_entry.connect("changed", self._search_entry_changed_cb)
+ self.search_entry.connect("icon-press", self._search_entry_icon_press_cb)
self.iconview.connect("query-tooltip", self._iconview_query_tooltip_cb)
# Speed-up startup by only checking available transitions on idle
@@ -137,8 +137,8 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.pack_start(self.props_widgets, False, False, 0)
# Create the filterModel for searching
- self.modelFilter = self.storemodel.filter_new()
- self.iconview.set_model(self.modelFilter)
+ self.model_filter = self.storemodel.filter_new()
+ self.iconview.set_model(self.model_filter)
self.infobar.show_all()
self.iconview_scrollwin.show_all()
@@ -244,7 +244,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
25000, Gtk.PositionType.BOTTOM, _("Smooth"))
def _search_entry_changed_cb(self, entry):
- self.modelFilter.refilter()
+ self.model_filter.refilter()
def _search_entry_icon_press_cb(self, entry, icon_pos, event):
entry.set_text("")
@@ -262,7 +262,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
trans_asset.icon])
# Now that the UI is fully ready, enable searching
- self.modelFilter.set_visible_func(self._setRowVisible, data=None)
+ self.model_filter.set_visible_func(self._setRowVisible, data=None)
# Alphabetical/name sorting instead of based on the ID number
self.storemodel.set_sort_column_id(
COL_NAME_TEXT, Gtk.SortType.ASCENDING)
@@ -351,10 +351,10 @@ class TransitionsListWidget(Gtk.Box, Loggable):
path = self.iconview.get_selected_items()
if path == []:
return None
- return self.modelFilter[path[0]][COL_TRANSITION_ASSET]
+ return self.model_filter[path[0]][COL_TRANSITION_ASSET]
def _setRowVisible(self, model, iter, unused_data):
"""Filters the icon view to show only the search results."""
- text = self.searchEntry.get_text().lower()
+ text = self.search_entry.get_text().lower()
return text in model.get_value(iter, COL_DESC_TEXT).lower() or\
text in model.get_value(iter, COL_NAME_TEXT).lower()
diff --git a/pre-commit.hook b/pre-commit.hook
index 4ed16d41..2433f536 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -13,9 +13,7 @@ export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH
PYLINT_IGNORED_FILES="
bin/pitivi.in
-pitivi/application.py
pitivi/autoaligner.py
-pitivi/dialogs/clipmediaprops.py
pitivi/dialogs/prefs.py
pitivi/editorperspective.py
pitivi/effects.py
@@ -26,38 +24,29 @@ pitivi/project.py
pitivi/render.py
pitivi/settings.py
pitivi/timeline/elements.py
-pitivi/timeline/layer.py
-pitivi/timeline/ruler.py
pitivi/timeline/timeline.py
pitivi/titleeditor.py
pitivi/transitions.py
pitivi/undo/timeline.py
-pitivi/undo/undo.py
pitivi/utils/extract.py
pitivi/utils/loggable.py
pitivi/utils/misc.py
pitivi/utils/pipeline.py
pitivi/utils/proxy.py
-pitivi/utils/timeline.py
pitivi/utils/ui.py
pitivi/utils/validate.py
pitivi/utils/widgets.py
pitivi/viewer/move_scale_overlay.py
pitivi/viewer/overlay_stack.py
-pitivi/viewer/title_overlay.py
pitivi/viewer/viewer.py
tests/common.py
tests/test_log.py
tests/test_medialibrary.py
tests/test_preset.py
tests/test_project.py
-tests/test_timeline_layer.py
tests/test_timeline_timeline.py
tests/test_undo.py
-tests/test_undo_project.py
tests/test_undo_timeline.py
-tests/test_utils.py
-tests/test_widgets.py
"
PYLINT_IGNORE_ARGS=""
diff --git a/tests/test_timeline_layer.py b/tests/test_timeline_layer.py
index 0e969fc5..8dab08b1 100644
--- a/tests/test_timeline_layer.py
+++ b/tests/test_timeline_layer.py
@@ -51,7 +51,8 @@ class TestLayerControl(common.TestCase):
class TestLayer(common.TestCase):
- def test_check_media_types_when_no_control_ui(self):
+ def test_check_media_types(self):
+ """Checks media types when there is no control UI."""
ges_layer = GES.Layer()
png = common.get_sample_uri("flat_colour1_640x480.png")
video_clip = GES.UriClipAsset.request_sync(png).extract()
diff --git a/tests/test_undo_project.py b/tests/test_undo_project.py
index 600a871f..ad5b3bb6 100644
--- a/tests/test_undo_project.py
+++ b/tests/test_undo_project.py
@@ -31,7 +31,7 @@ class TestProjectUndo(common.TestCase):
self.project = self.app.project_manager.new_blank_project()
self.action_log = self.app.action_log
- def test_new_project_has_nothing_to_undo(self):
+ def test_new_project_nothing_to_undo(self):
mainloop = common.create_main_loop()
def loaded_cb(project, timeline):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 4e5a15af..e97b3775 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -36,21 +36,16 @@ from pitivi.utils.ui import format_audiorate
from pitivi.utils.ui import format_framerate_value
from tests import common
-second = Gst.SECOND
-minute = second * 60
-hour = minute * 60
-
class TestBeautifyTime(common.TestCase):
"""Tests time beautifying utility methods."""
- def __check_beautify_last_updated_timestamp(self, seconds, expected):
- time.time = Mock()
- time.time.return_value = seconds
- self.assertEqual(beautify_last_updated_timestamp(0), expected)
-
def test_beautify_length(self):
"""Tests beautification of time duration."""
+ second = Gst.SECOND
+ minute = second * 60
+ hour = minute * 60
+
self.assertEqual(beautify_length(second), "1 second")
self.assertEqual(beautify_length(second * 2), "2 seconds")
@@ -90,6 +85,11 @@ class TestBeautifyTime(common.TestCase):
self.__check_beautify_last_updated_timestamp(60 * 60 * 24 * 365 * 1.5, "About 2 years ago")
self.__check_beautify_last_updated_timestamp(60 * 60 * 24 * 365 * 3, "About 3 years ago")
+ def __check_beautify_last_updated_timestamp(self, seconds, expected):
+ time.time = Mock()
+ time.time.return_value = seconds
+ self.assertEqual(beautify_last_updated_timestamp(0), expected)
+
class TestFormatFramerateValue(common.TestCase):
diff --git a/tests/test_widgets.py b/tests/test_widgets.py
index 37be3ea0..6279debe 100644
--- a/tests/test_widgets.py
+++ b/tests/test_widgets.py
@@ -83,6 +83,9 @@ class TestGstElementSettingsDialog(common.TestCase):
def test_reusing_properties(self):
"""Checks passing values to be used on element to be configured works."""
- dialog = GstElementSettingsDialog(Gst.ElementFactory.find("identity"), {"datarate": 12})
- v, = [v for (k, v) in dialog.elementsettings.properties.items() if k.name == "datarate"]
- self.assertEqual(v.getWidgetValue(), 12)
+ values = {"datarate": 12}
+ dialog = GstElementSettingsDialog(Gst.ElementFactory.find("identity"),
+ values)
+ widgets = {prop.name: widget
+ for prop, widget in dialog.elementsettings.properties.items()}
+ self.assertEqual(widgets["datarate"].getWidgetValue(), 12)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]