[pitivi] Fix pylint redefined-outer-name
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Fix pylint redefined-outer-name
- Date: Mon, 11 Nov 2019 22:08:01 +0000 (UTC)
commit f580e0f1276fe385afd32a299699550d63c61ecb
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Fri Nov 1 09:14:01 2019 +0100
Fix pylint redefined-outer-name
pitivi/medialibrary.py | 2 +-
pitivi/timeline/elements.py | 4 +-
pitivi/utils/custom_effect_widgets.py | 6 +--
pitivi/utils/ui.py | 78 +++++++++++++++++++----------------
pitivi/utils/validate.py | 1 -
pre-commit.hook | 4 --
tests/common.py | 2 -
7 files changed, 48 insertions(+), 49 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index aa1e46ca..4fb9d962 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -1656,7 +1656,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
self._project.addUris(uris)
def _drag_data_received_cb(self, widget, context, x, y,
- selection, targettype, time):
+ selection, targettype, time_):
"""Handles data being dragged onto self."""
self.debug("targettype: %d, selection.data: %r",
targettype, selection.get_data())
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 90c97e3d..21b735a6 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -37,10 +37,10 @@ from pitivi.timeline.previewers import AudioPreviewer
from pitivi.timeline.previewers import ImagePreviewer
from pitivi.timeline.previewers import VideoPreviewer
from pitivi.undo.timeline import CommitTimelineFinalizingAction
-from pitivi.utils import pipeline
from pitivi.utils.loggable import Loggable
from pitivi.utils.misc import disconnect_all_by_func
from pitivi.utils.misc import filename_from_uri
+from pitivi.utils.pipeline import PipelineError
from pitivi.utils.timeline import SELECT
from pitivi.utils.timeline import SELECT_ADD
from pitivi.utils.timeline import Selected
@@ -567,7 +567,7 @@ class MultipleKeyframeCurve(KeyframeCurve):
def __update_selected_keyframe(self):
try:
position = self._project.pipeline.getPosition()
- except pipeline.PipelineError:
+ except PipelineError:
self.warning("Could not get pipeline position")
return
diff --git a/pitivi/utils/custom_effect_widgets.py b/pitivi/utils/custom_effect_widgets.py
index 56924434..4e731544 100644
--- a/pitivi/utils/custom_effect_widgets.py
+++ b/pitivi/utils/custom_effect_widgets.py
@@ -26,7 +26,7 @@ from gi.repository import Gtk
from pitivi import configure
from pitivi.utils.loggable import Loggable
-from pitivi.utils.ui import model
+from pitivi.utils.ui import create_model
from pitivi.utils.widgets import ColorPickerButton
@@ -356,7 +356,7 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
# Shape picker
shape_picker = builder.get_object("frei0r-filter-alphaspot::shape")
- shape_list = model((str, float), [
+ shape_list = create_model((str, float), [
# ouch...
("rectangle", 0.0),
("ellipse", 0.26),
@@ -396,7 +396,7 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
# Operation picker
op_picker = builder.get_object("frei0r-filter-alphaspot::operation")
- op_list = model((str, float), [
+ op_list = create_model((str, float), [
# ouch...
("write on clear", 0.0),
("max", 0.21),
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index d772b6a7..1176a70d 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -69,7 +69,9 @@ FILE_TARGET_ENTRY = Gtk.TargetEntry.new("text/plain", 0, 0)
URI_TARGET_ENTRY = Gtk.TargetEntry.new("text/uri-list", 0, 0)
EFFECT_TARGET_ENTRY = Gtk.TargetEntry.new("pitivi/effect", 0, 0)
-TOUCH_INPUT_SOURCES = (Gdk.InputSource.TOUCHPAD, Gdk.InputSource.TRACKPOINT, Gdk.InputSource.TABLET_PAD)
+TOUCH_INPUT_SOURCES = (Gdk.InputSource.TOUCHPAD,
+ Gdk.InputSource.TRACKPOINT,
+ Gdk.InputSource.TABLET_PAD)
def get_month_format_string():
@@ -466,7 +468,8 @@ def beautify_asset(asset):
res.append(_("<b>Duration:</b> %s") % duration)
if asset.creation_progress < 100:
- res.append(_("<b>Proxy creation progress:</b> %d%%") % asset.creation_progress)
+ res.append(_("<b>Proxy creation progress:</b> %d%%") %
+ asset.creation_progress)
return "\n".join(res)
@@ -487,7 +490,8 @@ def beautify_missing_asset(asset):
size = asset.get_meta("file-size")
if size:
- file_size = GLib.format_size_full(size, GLib.FormatSizeFlags.LONG_FORMAT)
+ file_size = GLib.format_size_full(
+ size, GLib.FormatSizeFlags.LONG_FORMAT)
res.append(_("<b>Size</b>: %s") % file_size)
return "\n".join(res)
@@ -501,7 +505,8 @@ def info_name(info):
"""
if isinstance(info, GES.Asset):
from pitivi.utils.proxy import get_proxy_target
- filename = urllib.parse.unquote(os.path.basename(get_proxy_target(info).get_id()))
+ filename = urllib.parse.unquote(
+ os.path.basename(get_proxy_target(info).get_id()))
elif isinstance(info, DiscovererInfo):
filename = urllib.parse.unquote(os.path.basename(info.get_uri()))
else:
@@ -696,7 +701,7 @@ def clear_styles(widget):
style.remove_class(css_class)
-def model(columns, data):
+def create_model(columns, data):
ret = Gtk.ListStore(*columns)
for datum in data:
ret.append(datum)
@@ -774,34 +779,35 @@ def fix_infobar(infobar):
infobar.forall(make_sure_revealer_does_nothing)
-AUDIO_CHANNELS = model((str, int),
- [(format_audiochannels(ch), ch) for ch in (8, 6, 4, 2, 1)])
-
-FRAME_RATES = model((str, object),
- [(format_framerate(Gst.Fraction(*fps)), Gst.Fraction(*fps)) for fps in (
- (12, 1),
- (15, 1),
- (20, 1),
- (24000, 1001),
- (24, 1),
- (25, 1),
- (30000, 1001),
- (30, 1),
- (50, 1),
- (60000, 1001),
- (60, 1),
- (120, 1)
- )])
-
-AUDIO_RATES = model((str, int),
- [(format_audiorate(rate), rate) for rate in (
- 8000,
- 11025,
- 12000,
- 16000,
- 22050,
- 24000,
- 44100,
- 48000,
- 96000
- )])
+AUDIO_CHANNELS = create_model((str, int),
+ [(format_audiochannels(ch), ch)
+ for ch in (8, 6, 4, 2, 1)])
+
+FRAME_RATES = create_model((str, object),
+ [(format_framerate(Gst.Fraction(*fps)), Gst.Fraction(*fps)) for fps in (
+ (12, 1),
+ (15, 1),
+ (20, 1),
+ (24000, 1001),
+ (24, 1),
+ (25, 1),
+ (30000, 1001),
+ (30, 1),
+ (50, 1),
+ (60000, 1001),
+ (60, 1),
+ (120, 1)
+ )])
+
+AUDIO_RATES = create_model((str, int),
+ [(format_audiorate(rate), rate) for rate in (
+ 8000,
+ 11025,
+ 12000,
+ 16000,
+ 22050,
+ 24000,
+ 44100,
+ 48000,
+ 96000
+ )])
diff --git a/pitivi/utils/validate.py b/pitivi/utils/validate.py
index 056d4dbc..d9ddade2 100644
--- a/pitivi/utils/validate.py
+++ b/pitivi/utils/validate.py
@@ -496,7 +496,6 @@ def create_action_parameter(name, desc, mandatory=False, possible_variables=None
def init():
global has_validate
try:
- from gi.repository import GstValidate
GstValidate.init()
has_validate = GES.validate_register_action_types()
GstValidate.register_action_type("stop", "pitivi",
diff --git a/pre-commit.hook b/pre-commit.hook
index 9ca8972e..5d6a0111 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -15,14 +15,10 @@ PYLINT_IGNORED_FILES="
bin/pitivi.in
pitivi/autoaligner.py
pitivi/medialibrary.py
-pitivi/timeline/elements.py
pitivi/timeline/timeline.py
pitivi/utils/extract.py
pitivi/utils/loggable.py
-pitivi/utils/ui.py
-pitivi/utils/validate.py
pitivi/utils/widgets.py
-tests/common.py
tests/test_project.py
"
diff --git a/tests/common.py b/tests/common.py
index 9b383ef4..e17ba02e 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -94,7 +94,6 @@ def create_pitivi_mock(**settings):
app.proxy_manager = ProxyManager(app)
# TODO: Get rid of Zoomable.app.
- from pitivi.utils.timeline import Zoomable
Zoomable.app = app
return app
@@ -225,7 +224,6 @@ class TestCase(unittest.TestCase, Loggable):
def setUp(self):
# TODO: Get rid of Zoomable._instances.
- from pitivi.utils.timeline import Zoomable
del Zoomable._instances[:]
self._result = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]