[pitivi] Update pre-commit hooks
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Update pre-commit hooks
- Date: Sat, 26 Oct 2019 12:00:12 +0000 (UTC)
commit 9fea55fb4f1fca8fe1720bca5af473dc9ade7786
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Oct 13 21:57:56 2019 +0200
Update pre-commit hooks
.pre-commit-config.yaml:
- flake8 has been removed as it's a wrapper for pyflakes, which parses
the py files itself, meaning it's faster than pylint, but less powerful.
It seems it was not active as we had only two #noqa but no warnings.
- autopep8-wrapper has been removed so the committer is in control.
pre-commit.hook:
- git_pep8_commit_hook has been removed as pylint already checks for
PEP8 conformance.
- pylint is now run after the lightweight pre-commit.com hooks.
.pre-commit-config.yaml | 11 ++---
AUTHORS | 2 +-
bin/pitivi.in | 2 +-
build/flatpak/ninja-configure | 1 -
build/flatpak/pitivi-flatpak | 24 +++++-----
build/flatpak/py-configure | 1 -
docs/attic/PyGST_Tutorial/States,_and_the_Bus.md | 4 +-
docs/debian-packaging | 1 -
pitivi/application.py | 5 +-
pitivi/check.py | 1 -
pitivi/dialogs/about.py | 1 -
pitivi/dialogs/browseprojects.py | 1 -
pitivi/dialogs/missingasset.py | 1 -
pitivi/dialogs/prefs.py | 12 +----
pitivi/editorperspective.py | 12 ++---
pitivi/effects.py | 9 ++--
pitivi/mediafilespreviewer.py | 1 -
pitivi/medialibrary.py | 19 ++++----
pitivi/pluginmanager.py | 7 ++-
pitivi/preset.py | 1 -
pitivi/project.py | 16 ++++---
pitivi/render.py | 8 ++--
pitivi/timeline/elements.py | 2 +-
pitivi/timeline/previewers.py | 4 +-
pitivi/timeline/timeline.py | 20 ++++----
pitivi/transitions.py | 6 +--
pitivi/utils/check_pipeline.py | 13 +++--
pitivi/utils/custom_effect_widgets.py | 3 ++
pitivi/utils/misc.py | 3 +-
pitivi/utils/proxy.py | 22 ++++-----
pitivi/utils/timeline.py | 12 ++---
pitivi/utils/ui.py | 61 ++++++++++++------------
pitivi/utils/validate.py | 12 +++--
plugins/console/widgets.py | 3 +-
pre-commit.hook | 30 +++++++-----
docs/pylint.rc => pylint.rc | 35 +++++---------
tests/__init__.py | 3 +-
tests/common.py | 1 -
tests/ptv_testsuite.py | 7 ++-
tests/test_media_library.py | 16 +++----
tests/test_plugin_manager.py | 2 +-
tests/test_project.py | 4 +-
tests/test_timeline_timeline.py | 20 ++++----
tests/test_utils.py | 36 +++++++-------
tests/test_widgets.py | 8 ++--
tests/validate-tests/runtests | 2 -
46 files changed, 224 insertions(+), 241 deletions(-)
---
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 68266aa8..25fab6e9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,20 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks.git
- sha: v1.1.1
+ rev: v2.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- - id: autopep8-wrapper
- files: ^git-phab$
+ exclude: ".svg$|.po$"
- id: check-docstring-first
- id: debug-statements
- - id: flake8
- files: .*\.py$\|bin/pitivi.in
- repo: https://github.com/pre-commit/pre-commit.git
- sha: v1.4.5
+ rev: v1.18.3
hooks:
- id: validate_manifest
- repo: https://github.com/asottile/reorder_python_imports.git
- sha: v1.0.1
+ rev: v1.7.0
hooks:
- id: reorder-python-imports
diff --git a/AUTHORS b/AUTHORS
index 1a6a040f..fbb5b101 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -52,7 +52,7 @@ Edward HERVEY <hervey_e epitech net>
Stephan BLOCH <bloch_s epitech net>
Guillaume CASANOVA <casano_g epitech net>
Marc DELETTREZ <delett_m epitech net>
-Raphael PRALAT <pralat_r epitech net>
+Raphael PRALAT <pralat_r epitech net>
2003-2004
Julien CARBONNIER <carbon_j epitech net>
diff --git a/bin/pitivi.in b/bin/pitivi.in
index 2be8a83c..af6a133b 100755
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -42,7 +42,7 @@ BUILDDIR = '@BUILDDIR@'
def _prepend_env_path(name, value):
os.environ[name] = os.pathsep.join(value +
- os.environ.get(name, "").split(os.pathsep))
+ os.environ.get(name, "").split(os.pathsep))
def jump_through_hoops():
diff --git a/build/flatpak/ninja-configure b/build/flatpak/ninja-configure
index 30fcd838..8e01a308 100755
--- a/build/flatpak/ninja-configure
+++ b/build/flatpak/ninja-configure
@@ -10,4 +10,3 @@ install:
cp ninja /app/bin/
EOF
-
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index 677f211e..98476f41 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -44,7 +44,7 @@ FLATPAK_VERSION = {}
DEFAULT_GST_BRANCH = 'master'
-class Colors: # pylint: disable=too-few-public-methods
+class Colors:
HEADER = "\033[95m"
OKBLUE = "\033[94m"
OKGREEN = "\033[92m"
@@ -53,7 +53,7 @@ class Colors: # pylint: disable=too-few-public-methods
ENDC = "\033[0m"
-class Console: # pylint: disable=too-few-public-methods
+class Console:
quiet = False
@@ -177,7 +177,7 @@ def check_flatpak(verbose=True):
return True
-class FlatpakObject: # pylint: disable=too-few-public-methods
+class FlatpakObject:
def __init__(self, user):
self.user = user
@@ -201,7 +201,7 @@ class FlatpakObject: # pylint: disable=too-few-public-methods
return subprocess.check_call(command)
-class FlatpakPackages(FlatpakObject): # pylint: disable=too-few-public-methods
+class FlatpakPackages(FlatpakObject):
def __init__(self, repos, user=True):
FlatpakObject.__init__(self, user=user)
@@ -345,7 +345,7 @@ class FlatpakRepos(FlatpakObject):
return self.repos[name]
-class FlatpakRepo(FlatpakObject): # pylint: disable=too-few-public-methods
+class FlatpakRepo(FlatpakObject):
def __init__(self, name, url, desc=None, user=True, repos=None): # pylint: disable=too-many-arguments
FlatpakObject.__init__(self, user=user)
@@ -465,7 +465,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
Console.quiet = self.quiet
if not check_flatpak():
- exit(1)
+ sys.exit(1)
repos = FlatpakRepos()
self.sdk_repo = repos.add("flathub",
@@ -514,7 +514,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if missing_prefix:
Console.message("%sPrefix missing, create it with: %s --init%s",
Colors.FAIL, __file__, Colors.ENDC)
- exit(1)
+ sys.exit(1)
if self.coredumpgdb is not None:
self.run_gdb()
@@ -555,7 +555,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
try:
subprocess.check_call(build_export_args)
except subprocess.CalledProcessError:
- exit(1)
+ sys.exit(1)
update_repo_args = ["flatpak", "build-update-repo"]
@@ -568,7 +568,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
try:
subprocess.check_call(update_repo_args)
except subprocess.CalledProcessError:
- exit(1)
+ sys.exit(1)
def setup_sandbox(self):
"""Creates and updates the sandbox."""
@@ -590,7 +590,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
except FileNotFoundError:
Console.message("\n%sYou need to install flatpak-builder%s\n",
Colors.FAIL, Colors.ENDC)
- exit(1)
+ sys.exit(1)
subprocess.check_call(builder_args, cwd=self.scriptdir)
if not os.path.isdir("mesonbuild/"):
@@ -637,7 +637,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
venv.create(venv_path, with_pip=True)
activate_script = os.path.join(venv_path, "bin", "activate")
- pip_modules = "git_pep8_commit_hook git-pylint-commit-hook pre-commit pylint"
+ pip_modules = "git-pylint-commit-hook pre-commit pylint"
Console.message(
"Installing development tools in the Python virtual env: %s", pip_modules)
subprocess.check_call(
@@ -701,7 +701,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
subprocess.check_call(flatpak_command, cwd=cwd)
except subprocess.CalledProcessError as e:
if exit_on_failure:
- exit(e.returncode)
+ sys.exit(e.returncode)
def install_flatpak_runtimes(self):
for runtime in self.packs:
diff --git a/build/flatpak/py-configure b/build/flatpak/py-configure
index 9a172403..a25cc31b 100755
--- a/build/flatpak/py-configure
+++ b/build/flatpak/py-configure
@@ -24,4 +24,3 @@ install:
EOF
-
diff --git a/docs/attic/PyGST_Tutorial/States,_and_the_Bus.md
b/docs/attic/PyGST_Tutorial/States,_and_the_Bus.md
index c1451ffa..e0bc2da1 100644
--- a/docs/attic/PyGST_Tutorial/States,_and_the_Bus.md
+++ b/docs/attic/PyGST_Tutorial/States,_and_the_Bus.md
@@ -28,11 +28,11 @@ There are four element states: `gst.STATE_NULL`, `gst.STATE_READY`,
`gst.STATE_PAUSED`
-:
+:
`gst.STATE_PLAYING`
-:
+:
## The element life-cycle
diff --git a/docs/debian-packaging b/docs/debian-packaging
index 6090631c..73b71866 100644
--- a/docs/debian-packaging
+++ b/docs/debian-packaging
@@ -77,4 +77,3 @@ Finally run:
You will get notified by launchpad about the build status. It usually takes a
few minutes before launchopad accepts the upload. After that you can also
monitor the build at https://launchpad.net/~gstreamer-developers/+archive/ppa/
-
diff --git a/pitivi/application.py b/pitivi/application.py
index 496eb4f7..c8982462 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -132,8 +132,7 @@ class Pitivi(Gtk.Application, Loggable):
Gtk.Application.do_startup(self)
# Init logging as early as possible so we can log startup code
- enable_color = not os.environ.get(
- 'PITIVI_DEBUG_NO_COLOR', '0') in ('', '1')
+ enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR', '0') not in ('', '1')
# Let's show a human-readable Pitivi debug output by default, and only
# show a crazy unreadable mess when surrounded by gst debug statements.
enable_crack_output = "GST_DEBUG" in os.environ
@@ -334,7 +333,7 @@ class Pitivi(Gtk.Application, Loggable):
status = "CURRENT"
self.info(
"Running version %s, which is newer than the latest known version. Considering it as the
latest current version.", VERSION)
- elif status is "UNSUPPORTED":
+ elif status == "UNSUPPORTED":
self.warning(
"Using an outdated version of Pitivi (%s)", VERSION)
diff --git a/pitivi/check.py b/pitivi/check.py
index 15f2148d..6612e29e 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -370,7 +370,6 @@ def initialize_modules():
require_version("GstController", GST_API_VERSION)
require_version("GstTranscoder", GST_API_VERSION)
from gi.repository import Gst
- from pitivi.configure import get_audiopresets_dir, get_videopresets_dir
Gst.init(None)
require_version("GstPbutils", GST_API_VERSION)
diff --git a/pitivi/dialogs/about.py b/pitivi/dialogs/about.py
index 4d05b83b..7848ca5c 100644
--- a/pitivi/dialogs/about.py
+++ b/pitivi/dialogs/about.py
@@ -30,7 +30,6 @@ from pitivi.configure import in_devel
from pitivi.configure import VERSION
-# pylint: disable=too-few-public-methods
class AboutDialog(Gtk.AboutDialog):
"""Pitivi's about dialog.
diff --git a/pitivi/dialogs/browseprojects.py b/pitivi/dialogs/browseprojects.py
index bd152b47..92565a3f 100644
--- a/pitivi/dialogs/browseprojects.py
+++ b/pitivi/dialogs/browseprojects.py
@@ -23,7 +23,6 @@ from gi.repository import GES
from gi.repository import Gtk
-# pylint: disable=too-few-public-methods
class BrowseProjectsDialog(Gtk.FileChooserDialog):
"""Displays the Gtk.FileChooserDialog for browsing projects.
diff --git a/pitivi/dialogs/missingasset.py b/pitivi/dialogs/missingasset.py
index ead75bf5..ed8b7d17 100644
--- a/pitivi/dialogs/missingasset.py
+++ b/pitivi/dialogs/missingasset.py
@@ -30,7 +30,6 @@ from pitivi.utils.ui import PADDING
from pitivi.utils.ui import SPACING
-# pylint: disable=too-few-public-methods
class MissingAssetDialog(Gtk.Dialog, Loggable):
"""Dialog for locating a missing asset using Gtk.FileChooserWidget.
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 82985143..21364d2c 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -332,8 +332,8 @@ class PreferencesDialog(Loggable):
size_box.pack_start(Gtk.Label("×"), False, False, 0)
size_box.pack_start(self.proxy_height_widget, False, False, 0)
size_box.set_tooltip_text(_("This resolution will be used as the"
- " default target resolution for new projects and projects missing"
- " scaled proxy meta-data."))
+ " default target resolution for new projects and projects missing"
+ " scaled proxy meta-data."))
self.scaled_proxy_size_revert_button = self._create_revert_button()
self.proxy_infobar = Gtk.InfoBar.new()
@@ -550,13 +550,9 @@ class PreferencesDialog(Loggable):
self.factory_settings.set_sensitive(self._canReset())
def _response_cb(self, unused_button, unused_response_id):
- # Disable missing docstring
- # pylint: disable=C0111
self.dialog.destroy()
def _valueChangedCb(self, unused_fake_widget, real_widget, attrname):
- # Disable missing docstring
- # pylint: disable=C0111
value = getattr(self.settings, attrname)
if attrname not in self.original_values:
self.original_values[attrname] = value
@@ -573,14 +569,10 @@ class PreferencesDialog(Loggable):
self.factory_settings.set_sensitive(True)
def _configureCb(self, unused_widget, event):
- # Disable missing docstring
- # pylint: disable=C0111
self.settings.prefsDialogWidth = event.width
self.settings.prefsDialogHeight = event.height
def _canReset(self):
- # Disable missing docstring
- # pylint: disable=C0111
for section in self.prefs.values():
for attrname in section:
if not self.settings.isDefault(attrname):
diff --git a/pitivi/editorperspective.py b/pitivi/editorperspective.py
index ab49e9ca..ff910fce 100644
--- a/pitivi/editorperspective.py
+++ b/pitivi/editorperspective.py
@@ -197,9 +197,9 @@ class EditorPerspective(Perspective, Loggable):
self.medialibrary = MediaLibraryWidget(self.app)
self.effectlist = EffectListWidget(self.app)
self.main_tabs.append_page("Media Library",
- self.medialibrary, Gtk.Label(label=_("Media Library")))
+ self.medialibrary, Gtk.Label(label=_("Media Library")))
self.main_tabs.append_page("Effect Library",
- self.effectlist, Gtk.Label(label=_("Effect Library")))
+ self.effectlist, Gtk.Label(label=_("Effect Library")))
self.medialibrary.connect('play', self._mediaLibraryPlayCb)
self.medialibrary.show()
self.effectlist.show()
@@ -210,11 +210,11 @@ class EditorPerspective(Perspective, Loggable):
self.trans_list = TransitionsListWidget(self.app)
self.title_editor = TitleEditor(self.app)
self.context_tabs.append_page("Clip",
- self.clipconfig, Gtk.Label(label=_("Clip")))
+ self.clipconfig, Gtk.Label(label=_("Clip")))
self.context_tabs.append_page("Transition",
- self.trans_list, Gtk.Label(label=_("Transition")))
+ self.trans_list, Gtk.Label(label=_("Transition")))
self.context_tabs.append_page("Title",
- self.title_editor.widget, Gtk.Label(label=_("Title")))
+ self.title_editor.widget, Gtk.Label(label=_("Title")))
# Show by default the Title tab, as the Clip and Transition tabs
# are useful only when a clip or transition is selected, but
# the Title tab allows adding titles.
@@ -761,7 +761,7 @@ class EditorPerspective(Perspective, Loggable):
List[str]: The full path and the mimetype if successful, None otherwise.
"""
chooser = Gtk.FileChooserDialog(title=_("Save As..."),
- transient_for=self.app.gui, action=Gtk.FileChooserAction.SAVE)
+ transient_for=self.app.gui, action=Gtk.FileChooserAction.SAVE)
chooser.add_buttons(_("Cancel"), Gtk.ResponseType.CANCEL,
_("Save"), Gtk.ResponseType.OK)
chooser.set_default_response(Gtk.ResponseType.OK)
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 45947398..4f83f10a 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -183,8 +183,7 @@ class EffectInfo(object):
icon = GdkPixbuf.Pixbuf.new_from_file_at_size(
os.path.join(pixdir, self.effect_name + ".png"),
ICON_WIDTH, ICON_WIDTH)
- # An empty except clause is bad, but "gi._glib.GError" is not helpful.
- except:
+ except GLib.Error:
icon = GdkPixbuf.Pixbuf.new_from_file(
os.path.join(pixdir, "defaultthumbnail.svg"))
return icon
@@ -294,11 +293,11 @@ class EffectsManager(Loggable):
HIDDEN_EFFECTS.extend(self.gl_effects)
def _check_gleffects(self):
+ check_pipeline_path = os.path.join(os.path.dirname(__file__), "utils", "check_pipeline.py")
try:
res = subprocess.check_output([sys.executable,
- os.path.join(os.path.dirname(__file__), "utils",
- "check_pipeline.py"),
- "videotestsrc ! glupload ! gleffects ! fakesink"])
+ check_pipeline_path,
+ "videotestsrc ! glupload ! gleffects ! fakesink"])
self.debug(res)
except subprocess.CalledProcessError as e:
self.error("Can not use GL effects: %s", e)
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 4218540e..09d43bba 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -446,7 +446,6 @@ class PreviewWidget(Gtk.Grid, Loggable):
items.sort()
text = self.description + "\n\n"
for key, value in items:
- capitalized = key.capitalize()
escaped = html.escape(value)
text = text + "<b>%s</b>: %s\n" % (key, escaped)
self.l_tags.set_markup(text)
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index b7f355fc..1dde87c1 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -103,11 +103,14 @@ STORE_MODEL_STRUCTURE = (
# http://en.wikipedia.org/wiki/List_of_file_formats#Video
# ...and looking at the contents of /usr/share/mime
SUPPORTED_FILE_FORMATS = {
- "video": ("3gpp", "3gpp2", "dv", "mp2t", "mp4", "mpeg", "ogg", "quicktime", "webm", "x-flv",
"x-matroska", "x-mng", "x-ms-asf", "x-msvideo", "x-ms-wmp", "x-ms-wmv", "x-ogm+ogg", "x-theora+ogg", "mp2t"),
# noqa
+ "video": ("3gpp", "3gpp2", "dv", "mp2t", "mp2t", "mp4", "mpeg", "ogg",
+ "quicktime", "webm", "x-flv", "x-matroska", "x-mng", "x-ms-asf",
+ "x-ms-wmp", "x-ms-wmv", "x-msvideo", "x-ogm+ogg", "x-theora+ogg"),
"application": ("mxf",),
- # Don't forget audio formats
- "audio": ("aac", "ac3", "basic", "flac", "mp2", "mp4", "mpeg", "ogg", "opus", "webm", "x-adpcm",
"x-aifc", "x-aiff", "x-aiffc", "x-ape", "x-flac+ogg", "x-m4b", "x-matroska", "x-ms-asx", "x-ms-wma",
"x-speex", "x-speex+ogg", "x-vorbis+ogg", "x-wav"), # noqa
- # ...and image formats
+ "audio": ("aac", "ac3", "basic", "flac", "mp2", "mp4", "mpeg", "ogg",
+ "opus", "webm", "x-adpcm", "x-aifc", "x-aiff", "x-aiffc",
+ "x-ape", "x-flac+ogg", "x-m4b", "x-matroska", "x-ms-asx",
+ "x-ms-wma", "x-speex", "x-speex+ogg", "x-vorbis+ogg", "x-wav"),
"image": ("jp2", "jpeg", "png", "svg+xml")}
SUPPORTED_MIMETYPES = []
@@ -448,7 +451,7 @@ class AssetThumbnail(GObject.Object, Loggable):
height = min(emblem.get_height(), thumb.get_height())
# Crop the emblem to fit the thumbnail.
emblem = emblem.new_subpixbuf(0, emblem.get_height() - height,
- width, height)
+ width, height)
# The dest_* arguments define the area of thumb to change.
# The offset_* arguments define the emblem offset so its
@@ -1312,7 +1315,7 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
def __use_scaled_proxies_cb(self, unused_action, unused_parameter):
self._project.use_proxies_for_assets(self.getSelectedAssets(),
- scaled=True)
+ scaled=True)
def __deleteProxiesCb(self, unused_action, unused_parameter):
prefer_original = self.app.settings.proxyingStrategy == ProxyingStrategy.NOTHING
@@ -1369,9 +1372,9 @@ class MediaLibraryWidget(Gtk.Box, Loggable):
proxies = [asset.get_proxy_target() for asset in assets
if self.app.proxy_manager.is_proxy_asset(asset)]
hq_proxies = [asset.get_proxy_target() for asset in assets
- if self.app.proxy_manager.is_hq_proxy(asset)]
+ if self.app.proxy_manager.is_hq_proxy(asset)]
scaled_proxies = [asset.get_proxy_target() for asset in assets
- if self.app.proxy_manager.is_scaled_proxy(asset)]
+ if self.app.proxy_manager.is_scaled_proxy(asset)]
in_progress = [asset.creation_progress for asset in assets
if asset.creation_progress < 100]
diff --git a/pitivi/pluginmanager.py b/pitivi/pluginmanager.py
index 66642f30..af5802bc 100644
--- a/pitivi/pluginmanager.py
+++ b/pitivi/pluginmanager.py
@@ -1,4 +1,3 @@
-# pylint: disable=missing-docstring
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Fabian Orccon <cfoch fabian gmail com>
#
@@ -16,6 +15,7 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+"""PluginManager for loading Pitivi plugins."""
import os
from enum import IntEnum
from gettext import gettext as _
@@ -44,6 +44,9 @@ class API(GObject.GObject):
class PluginType(IntEnum):
+ """Types of plugins we support, depending on their directory location."""
+ # pylint: disable=comparison-with-callable,inconsistent-return-statements,no-else-return
+
SYSTEM = 1
USER = 2
@@ -54,6 +57,7 @@ class PluginType(IntEnum):
return _("System plugins")
def get_dir(self):
+ """Returns the directory where this type of plugins can be found."""
if self.value == PluginType.USER:
return get_user_plugins_dir()
elif self.value == PluginType.SYSTEM:
@@ -94,6 +98,7 @@ class PluginManager(Loggable):
@classmethod
def get_plugin_type(cls, plugin_info):
+ """Gets the PluginType for the specified Peas.PluginInfo."""
paths = [plugin_info.get_data_dir(), get_plugins_dir()]
if os.path.commonprefix(paths) == get_plugins_dir():
return PluginType.SYSTEM
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 1dfd009d..5913faf5 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -28,7 +28,6 @@ from gi.repository import Gtk
from pitivi.configure import get_audiopresets_dir
from pitivi.configure import get_videopresets_dir
-from pitivi.settings import xdg_config_home
from pitivi.settings import xdg_data_home
from pitivi.utils.loggable import Loggable
from pitivi.utils.ui import alter_style_class
diff --git a/pitivi/project.py b/pitivi/project.py
index 611eae35..9a27f9f3 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -839,7 +839,7 @@ class Project(Loggable, GES.Project):
"""Returns path of thumbnail of specified resolution in the cache."""
thumb_hash = md5(quote_uri(uri).encode()).hexdigest()
thumbs_cache_dir = get_dir(os.path.join(xdg_cache_home(),
- "project_thumbs", resolution))
+ "project_thumbs", resolution))
return os.path.join(thumbs_cache_dir, thumb_hash) + ".png"
@classmethod
@@ -1373,7 +1373,7 @@ class Project(Loggable, GES.Project):
self.app.proxy_manager.add_job(asset)
else:
self.debug("Project still loading, not using proxies: %s",
- asset.props.id)
+ asset.props.id)
asset.creation_progress = 100
self.__updateAssetLoadingProgress()
@@ -1789,19 +1789,21 @@ class Project(Loggable, GES.Project):
def setAudioProperties(self, nbchanns=-1, rate=-1):
"""Sets the number of audio channels and the rate."""
+ # pylint: disable=consider-using-in
self.info("%d x %dHz %dbits", nbchanns, rate)
- if not nbchanns == -1 and not nbchanns == self.audiochannels:
+ if nbchanns != -1 and nbchanns != self.audiochannels:
self.audiochannels = nbchanns
- if not rate == -1 and not rate == self.audiorate:
+ if rate != -1 and rate != self.audiorate:
self.audiorate = rate
def setEncoders(self, muxer="", vencoder="", aencoder=""):
"""Sets the video and audio encoders and the muxer."""
- if not muxer == "" and not muxer == self.muxer:
+ # pylint: disable=consider-using-in
+ if muxer != "" and muxer != self.muxer:
self.muxer = muxer
- if not vencoder == "" and not vencoder == self.vencoder:
+ if vencoder != "" and vencoder != self.vencoder:
self.vencoder = vencoder
- if not aencoder == "" and not aencoder == self.aencoder:
+ if aencoder != "" and aencoder != self.aencoder:
self.aencoder = aencoder
@property
diff --git a/pitivi/render.py b/pitivi/render.py
index fdb7184d..65f4bf75 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -774,8 +774,8 @@ class RenderDialog(Loggable):
self.fileentry.set_text(name)
def _update_valid_restriction_values(self, caps, combo, caps_template,
- model, combo_value,
- caps_template_expander=None):
+ model, combo_value,
+ caps_template_expander=None):
def caps_template_expander_func(caps_template, value):
return caps_template % value
@@ -890,7 +890,7 @@ class RenderDialog(Loggable):
if self.project.vencoder == 'x264enc':
if self.project.videowidth % 2 or self.project.videoheight % 2:
return "\n\n%s\n\n" % _("<b>Make sure your rendering size is even, "
- "x264enc might not be able to render otherwise.</b>\n\n")
+ "x264enc might not be able to render otherwise.</b>\n\n")
return ""
@@ -1022,7 +1022,7 @@ class RenderDialog(Loggable):
return None
hq_proxy = GES.Asset.request(GES.UriClip,
- self.app.proxy_manager.getProxyUri(asset_target))
+ self.app.proxy_manager.getProxyUri(asset_target))
return hq_proxy or None
def __replace_proxies(self):
diff --git a/pitivi/timeline/elements.py b/pitivi/timeline/elements.py
index 31c49fde..c96ef470 100644
--- a/pitivi/timeline/elements.py
+++ b/pitivi/timeline/elements.py
@@ -1157,7 +1157,7 @@ class Clip(Gtk.EventBox, Zoomable, Loggable):
factory_name = effect_info.effect_name
if factory_name in ALLOWED_ONLY_ONCE_EFFECTS:
for effect in self.ges_clip.find_track_elements(None, GES.TrackType.VIDEO,
- GES.BaseEffect):
+ GES.BaseEffect):
for elem in effect.get_nleobject().iterate_recurse():
if elem.get_factory().get_name() == factory_name:
self.error("Not adding %s as it would be duplicate"
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index 4094bed8..a7c75db0 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -86,9 +86,9 @@ class PreviewerBin(Gst.Bin, Loggable):
self.internal_bin = Gst.parse_bin_from_description(bin_desc, True)
self.add(self.internal_bin)
- sinkpad, = [pad for pad in self.internal_bin.iterate_sink_pads()]
+ sinkpad, = list(self.internal_bin.iterate_sink_pads())
self.add_pad(Gst.GhostPad.new(None, sinkpad))
- srcpad, = [pad for pad in self.internal_bin.iterate_src_pads()]
+ srcpad, = list(self.internal_bin.iterate_src_pads())
self.add_pad(Gst.GhostPad.new(None, srcpad))
def finalize(self):
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 1c5d321d..f59b62be 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -186,7 +186,7 @@ class Marquee(Gtk.Box, Loggable):
end_pos = max(0, self._timeline.pixelToNs(self.end_x))
return self._timeline.get_clips_in_between(start_layer,
- end_layer, start_pos, end_pos)
+ end_layer, start_pos, end_pos)
class LayersLayout(Gtk.Layout, Zoomable, Loggable):
@@ -1807,8 +1807,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
if self.ges_timeline:
with Previewer.manager.paused():
with self.app.action_log.started("delete clip",
-
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
- toplevel=True):
+
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
+ toplevel=True):
for clip in self.timeline.selection:
if isinstance(clip, GES.TransitionClip):
continue
@@ -1907,8 +1907,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
position = self._project.pipeline.getPosition()
with self.app.action_log.started("paste",
- finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
- toplevel=True):
+
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
+ toplevel=True):
copied_group_shallow_copy = self.__copied_group.paste(position)
if not copied_group_shallow_copy:
self.info("The paste is not possible at position: %s", position)
@@ -1922,8 +1922,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
def __add_layer_cb(self, unused_action, unused_parameter):
with self.app.action_log.started("add layer",
- finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
- toplevel=True):
+
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline),
+ toplevel=True):
priority = len(self.ges_timeline.get_layers())
self.timeline.create_layer(priority)
@@ -2001,7 +2001,7 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
Otherwise, split all clips at the playhead position.
"""
with self.app.action_log.started("split clip", toplevel=True,
- finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline)):
+
finalizing_action=CommitTimelineFinalizingAction(self._project.pipeline)):
self._splitElements(self.timeline.selection.selected)
def _splitElements(self, clips=None):
@@ -2023,8 +2023,8 @@ class TimelineContainer(Gtk.Grid, Zoomable, Loggable):
layer.splitting_object = True
try:
self.app.write_action("split-clip",
- clip_name=clip.get_name(),
- position=float(position / Gst.SECOND))
+ clip_name=clip.get_name(),
+ position=float(position / Gst.SECOND))
clip.split(position)
splitted = True
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index 5b6cdb26..b1172ccb 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -201,8 +201,8 @@ class TransitionsListWidget(Gtk.Box, Loggable):
self.element.get_parent().set_asset(transition_asset)
self.app.write_action("element-set-asset",
- asset_id=transition_asset.get_id(),
- element_name=self.element.get_name())
+ asset_id=transition_asset.get_id(),
+ element_name=self.element.get_name())
self.app.project_manager.current_project.pipeline.flushSeek()
return True
@@ -322,7 +322,7 @@ class TransitionsListWidget(Gtk.Box, Loggable):
try:
icon = GdkPixbuf.Pixbuf.new_from_file(
os.path.join(self._pixdir, name))
- except:
+ except GLib.Error:
icon = self._question_icon
return icon
diff --git a/pitivi/utils/check_pipeline.py b/pitivi/utils/check_pipeline.py
index 1ada1d62..0a425e89 100644
--- a/pitivi/utils/check_pipeline.py
+++ b/pitivi/utils/check_pipeline.py
@@ -16,9 +16,7 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
-"""
-Simple app to check if a GStreamer pipeline can run.
-"""
+"""Simple tool used by Pitivi to check if a GStreamer pipeline can run."""
import os
import sys
@@ -26,8 +24,9 @@ import gi
gi.require_version("Gst", "1.0")
-from gi.repository import Gst # pylint: disable-msg=wrong-import-position
-from gi.repository import GLib # pylint: disable-msg=wrong-import-position
+# pylint: disable-msg=wrong-import-position
+from gi.repository import Gst
+from gi.repository import GLib
def pipeline_message_cb(_, msg, pipeline):
@@ -39,14 +38,14 @@ def pipeline_message_cb(_, msg, pipeline):
elif msg.type == Gst.MessageType.ERROR:
# The pipeline cannot be set to PAUSED.
error, detail = msg.parse_error()
- print("Pipeline failed: %s, %s" % (error, detail), file=sys.stderr)
+ print("check_pipeline: Pipeline failed: %s, %s" % (error, detail), file=sys.stderr)
pipeline.set_state(Gst.State.NULL)
sys.exit(1)
def timeout_cb(*args, **kwargs):
"""Exit on timeout."""
- print("Pipeline timed out", file=sys.stderr)
+ print("check_pipeline: Pipeline timed out", file=sys.stderr)
sys.exit(1)
diff --git a/pitivi/utils/custom_effect_widgets.py b/pitivi/utils/custom_effect_widgets.py
index b599b024..d7bdcb21 100644
--- a/pitivi/utils/custom_effect_widgets.py
+++ b/pitivi/utils/custom_effect_widgets.py
@@ -17,6 +17,7 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
"""Utility methods for custom effect UI."""
+# pylint: disable=too-many-statements
import os
from colorsys import rgb_to_hsv
from types import MethodType
@@ -381,6 +382,7 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
def shape_picker_value_changed_cb(unused):
"""Handles the selection of shape via combobox."""
+ # pylint: disable=unsubscriptable-object
v = shape_list[shape_picker.get_active()][1]
from pitivi.undo.timeline import CommitTimelineFinalizingAction
@@ -422,6 +424,7 @@ def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element
def op_picker_value_changed_cb(unused):
"""Handles the selection of op via combobox."""
+ # pylint: disable=unsubscriptable-object
v = op_list[op_picker.get_active()][1]
from pitivi.undo.timeline import CommitTimelineFinalizingAction
diff --git a/pitivi/utils/misc.py b/pitivi/utils/misc.py
index d4940e2f..308571ae 100644
--- a/pitivi/utils/misc.py
+++ b/pitivi/utils/misc.py
@@ -17,7 +17,6 @@
# License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
-import bisect
import hashlib
import os
import subprocess
@@ -232,7 +231,7 @@ def hash_file(uri):
"""Hashes the first 256KB of the specified file."""
sha256 = hashlib.sha256()
with open(uri, "rb") as file:
- for _ in range(1024):
+ for unused in range(1024):
chunk = file.read(256)
if not chunk:
break
diff --git a/pitivi/utils/proxy.py b/pitivi/utils/proxy.py
index 48535bc3..22a97772 100644
--- a/pitivi/utils/proxy.py
+++ b/pitivi/utils/proxy.py
@@ -232,7 +232,7 @@ class ProxyManager(GObject.Object, Loggable):
return True
def __getEncodingProfile(self, encoding_target_file, asset=None, width=None,
- height=None):
+ height=None):
encoding_target = GstPbutils.EncodingTarget.load_from_file(
os.path.join(get_gstpresets_dir(), encoding_target_file))
encoding_profile = encoding_target.get_profile("default")
@@ -352,10 +352,10 @@ class ProxyManager(GObject.Object, Loggable):
t_width, t_height = self._scale_asset_resolution(asset, max_w, max_h)
proxy_res = "%sx%s" % (t_width, t_height)
return "%s.%s.%s.%s" % (asset.get_id(), file_size, proxy_res,
- self.scaled_proxy_extension)
+ self.scaled_proxy_extension)
else:
return "%s.%s.%s" % (asset.get_id(), file_size,
- self.hq_proxy_extension)
+ self.hq_proxy_extension)
def isAssetFormatWellSupported(self, asset):
for encoding_format in self.WHITELIST_FORMATS:
@@ -371,8 +371,8 @@ class ProxyManager(GObject.Object, Loggable):
asset_res = (stream.get_width(), stream.get_height())
target_res = self._scale_asset_resolution(asset,
- self.app.project_manager.current_project.scaled_proxy_width,
- self.app.project_manager.current_project.scaled_proxy_height)
+
self.app.project_manager.current_project.scaled_proxy_width,
+
self.app.project_manager.current_project.scaled_proxy_height)
return asset_res == target_res
@@ -512,7 +512,7 @@ class ProxyManager(GObject.Object, Loggable):
proxy_uri = waiting_transcoder.props.dest_uri.rstrip(ProxyManager.part_suffix)
GES.Asset.needs_reload(GES.UriClip, proxy_uri)
GES.Asset.request_async(GES.UriClip, proxy_uri, None,
- self.__assetLoadedCb, waiting_asset, waiting_transcoder)
+ self.__assetLoadedCb, waiting_asset, waiting_transcoder)
self.__waiting_transcoders.remove(pair)
break
@@ -618,7 +618,7 @@ class ProxyManager(GObject.Object, Loggable):
dispatcher = GstTranscoder.TranscoderGMainContextSignalDispatcher.new()
enc_profile = self.__getEncodingProfile(self.__encoding_target_file,
- asset, width, height)
+ asset, width, height)
transcoder = GstTranscoder.Transcoder.new_full(
asset_uri, proxy_uri + ProxyManager.part_suffix, enc_profile,
@@ -713,7 +713,7 @@ class ProxyManager(GObject.Object, Loggable):
if not force_proxying:
if not self.__assetNeedsTranscoding(asset, scaled):
self.debug("Not proxying asset (proxying disabled: %s)",
- self.proxyingUnsupported)
+ self.proxyingUnsupported)
# Make sure to notify we do not need a proxy for that asset.
self.emit("proxy-ready", asset, None)
return
@@ -722,9 +722,9 @@ class ProxyManager(GObject.Object, Loggable):
if Gio.File.new_for_uri(proxy_uri).query_exists(None):
self.debug("Using proxy already generated: %s", proxy_uri)
GES.Asset.request_async(GES.UriClip,
- proxy_uri, None,
- self.__assetLoadedCb, asset,
- None)
+ proxy_uri, None,
+ self.__assetLoadedCb, asset,
+ None)
return
self.debug("Creating a proxy for %s (strategy: %s, force: %s, scaled: %s)",
diff --git a/pitivi/utils/timeline.py b/pitivi/utils/timeline.py
index 5e1048dd..e7751a19 100644
--- a/pitivi/utils/timeline.py
+++ b/pitivi/utils/timeline.py
@@ -325,11 +325,11 @@ class EditingContext(GObject.Object, Loggable):
res = self.focus.edit([], priority, self.mode, self.edge, int(position))
self.app.write_action("edit-container",
- container_name=self.focus.get_name(),
- position=float(position / Gst.SECOND),
- edit_mode=self.mode.value_nick,
- edge=self.edge.value_nick,
- new_layer_priority=int(priority))
+ container_name=self.focus.get_name(),
+ position=float(position / Gst.SECOND),
+ edit_mode=self.mode.value_nick,
+ edge=self.edge.value_nick,
+ new_layer_priority=int(priority))
if res and self.mode == GES.EditMode.EDIT_TRIM and self.with_video:
if self.edge == GES.Edge.EDGE_START:
@@ -461,7 +461,7 @@ class Zoomable(object):
# DIE YOU CUNTMUNCH CLOCK_TIME_NONE UBER STUPIDITY OF CRACK BINDINGS !!
if duration == Gst.CLOCK_TIME_NONE:
return 0
- return ((float(duration) / Gst.SECOND) * cls.zoomratio)
+ return (float(duration) / Gst.SECOND) * cls.zoomratio
def zoomChanged(self):
pass
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index 1d8c9e27..3138219c 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -18,7 +18,6 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
"""UI constants and various functions and classes that help with UI drawing."""
-import decimal
import os
import time
import urllib.error
@@ -82,6 +81,7 @@ def get_month_format_string():
month_format_string = "%B"
return month_format_string
+
# TODO: Drop this when we depend on glibc 2.27+
MONTH_FORMAT_STRING = get_month_format_string()
@@ -105,6 +105,7 @@ def _get_font(font_spec, default):
face = raw_font.rsplit(" ", 1)[0]
return cairo.ToyFontFace(face)
+
NORMAL_FONT = _get_font("font-name", "Cantarell")
DOCUMENT_FONT = _get_font("document-font-name", "Sans")
MONOSPACE_FONT = _get_font("monospace-font-name", "Monospace")
@@ -371,12 +372,12 @@ def pack_color_32(red, green, blue, alpha=0xFFFF):
green = green >> 8
blue = blue >> 8
alpha = alpha >> 8
- return (red << 24 | green << 16 | blue << 8 | alpha)
+ return red << 24 | green << 16 | blue << 8 | alpha
def pack_color_64(red, green, blue, alpha=0xFFFF):
"""Packs the specified 16bit color values in a 64bit RGBA value."""
- return (red << 48 | green << 32 | blue << 16 | alpha)
+ return red << 48 | green << 32 | blue << 16 | alpha
def unpack_color(value):
@@ -385,7 +386,7 @@ def unpack_color(value):
Args:
value (int): A 32bit or 64bit RGBA value.
"""
- if not (value >> 32):
+ if not value >> 32:
return unpack_color_32(value)
else:
return unpack_color_64(value)
@@ -774,33 +775,33 @@ def fix_infobar(infobar):
audio_channels = model((str, int),
- [(format_audiochannels(ch), ch) for ch in (8, 6, 4, 2, 1)])
+ [(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)
- )])
+ [(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
- )])
+ [(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 2935c4c9..04c7a0a6 100644
--- a/pitivi/utils/validate.py
+++ b/pitivi/utils/validate.py
@@ -62,6 +62,7 @@ def Event(event_type, **kwargs):
return event
+
if GstValidate:
class PitiviMonitor(GstValidate.Monitor):
def __init__(self, runner, object):
@@ -161,10 +162,10 @@ def positionChangedCb(pipeline, position, scenario, action,
def seek(scenario, action):
res, wanted_position = GstValidate.utils_get_clocktime(action.structure,
- "start")
+ "start")
scenario.get_pipeline().simple_seek(wanted_position)
scenario.get_pipeline().connect("position", positionChangedCb, scenario,
- action, wanted_position)
+ action, wanted_position)
return GstValidate.ActionReturn.ASYNC
@@ -548,9 +549,10 @@ def init():
"Remove clip",
GstValidate.ActionTypeFlags.NONE)
GstValidate.register_action_type("select-clips", "pitivi",
- select_clips, [Parameter("clip-name",
- "The name of the clip to select",
- True, None, "str")],
+ select_clips,
+ [Parameter("clip-name",
+ "The name of the clip to select",
+ True, None, "str")],
"Select clips",
GstValidate.ActionTypeFlags.NONE)
diff --git a/plugins/console/widgets.py b/plugins/console/widgets.py
index b01ab795..7e3c4a28 100644
--- a/plugins/console/widgets.py
+++ b/plugins/console/widgets.py
@@ -17,14 +17,13 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
"""The developer console widget."""
+from consolebuffer import ConsoleBuffer
from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Pango
-from consolebuffer import ConsoleBuffer
-
class ConsoleView(Gtk.TextView):
"""A TextView which removes tags from pasted text."""
diff --git a/pre-commit.hook b/pre-commit.hook
index e7765d4a..aed16a35 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -1,14 +1,17 @@
#!/usr/bin/env bash
+# This is symlinked from .git/hooks/pre-commit when entering
+# the dev env with `source bin/pitivi-env`.
+
if [ -z "${PITIVI_REPO_DIR}" ]; then
echo "ERROR: You're not in the Pitivi development environment. Run `source bin/pitivi-env` to enter it.
See http://developer.pitivi.org/HACKING.html for details."
exit 1
fi
TOPLEVEL=$(git rev-parse --show-toplevel)
-RCFILE=$TOPLEVEL/docs/pylint.rc
+export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH
-IGNORED_FILES="
+PYLINT_IGNORED_FILES="
bin/pitivi.in
pitivi/application.py
pitivi/autoaligner.py
@@ -70,17 +73,20 @@ tests/validate-tests/manager.py
tests/validate-tests/suite.py
"
-IGNORE_ARGS=""
-for f in $IGNORED_FILES; do
- IGNORE_ARGS="$IGNORE_ARGS --ignore=$f"
+PYLINT_IGNORE_ARGS=""
+for f in $PYLINT_IGNORED_FILES; do
+ PYLINT_IGNORE_ARGS="$PYLINT_IGNORE_ARGS --ignore=$f"
done
-echo "Pylint ignoring files:$IGNORED_FILES" | tr "\n" " "
-echo
-
-export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH
-
-git-pylint-commit-hook --pylint="$TOPLEVEL/build/flatpak/pitivi-flatpak" --pylint-params="pylint"
--pylintrc=$RCFILE $IGNORE_ARGS --limit=10.0 --suppress-report || exit 1
-git_pep8_commit_hook --pep8-params="--repeat --ignore=E501,E128,E402" || exit 1
+# Print the commands being executed so we have a clue what's going on.
+set -x
+# Lightweight pre-commit.com checks.
pre-commit run --config .pre-commit-config.yaml || exit 1
+
+# We keep pylint separate from the pre-commit.com hooks
+# because we have to run it in the sandbox. This is done
+# through git-pylint-commit-hook and pitivi-flatpak.
+git-pylint-commit-hook --pylint="$TOPLEVEL/build/flatpak/pitivi-flatpak" \
+ --pylint-params="pylint" --pylintrc="$TOPLEVEL/pylint.rc" \
+ --limit=10.0 $PYLINT_IGNORE_ARGS --suppress-report || exit 1
diff --git a/docs/pylint.rc b/pylint.rc
similarity index 86%
rename from docs/pylint.rc
rename to pylint.rc
index 47168f07..0152253c 100644
--- a/docs/pylint.rc
+++ b/pylint.rc
@@ -11,10 +11,16 @@
# Python code to execute, usually for sys.path manipulation such as
init-hook='import gi; gi.require_version("Gtk", "3.0"); gi.require_version("Gst", "1.0"); from gi.repository
import Gst; Gst.init(None); gi.require_version("GES", "1.0"); from gi.repository import GES; GES.init()'
+
[MESSAGES CONTROL]
-# Disable the message(s) with the given id(s).
-disable=E1101,W0142,locally-disabled,fixme,superfluous-parens,too-many-lines
+# Disable useless messages:
+# no-member - Instance ... has no member ...
+# similarities - Expensive detection of copy/pasted code
+# too-few-public-methods
+# too-many-lines - Modules have more than max-line-length lines
+disable=no-member,similarities,too-few-public-methods,too-many-lines
+
[VARIABLES]
@@ -97,7 +103,7 @@ max-parents=7
max-attributes=7
# Minimum number of public methods for a class (see R0903).
-min-public-methods=2
+min-public-methods=0
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
@@ -138,22 +144,7 @@ int-import-graph=
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setUp,_reset,_createUi,_addSource
-
-# checks for similarities and duplicated code. This computation may be
-# memory / CPU intensive, so you should disable it if you experiments some
-# problems.
-#
-[SIMILARITIES]
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
+defining-attr-methods=__init__,__new__,setUp
# checks for:
@@ -162,8 +153,8 @@ ignore-docstrings=yes
#
[MISCELLANEOUS]
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,XXX,TODO
+# List of note/comment tags to disallow, separated by a comma.
+notes=XXX
# checks for :
@@ -175,7 +166,7 @@ notes=FIXME,XXX,TODO
[FORMAT]
# Maximum number of characters on a single line.
-max-line-length=120
+max-line-length=1000
# Maximum number of lines in a module
max-module-lines=1000
diff --git a/tests/__init__.py b/tests/__init__.py
index a2dc639d..61e741aa 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,10 +2,8 @@
"""
Pitivi unit tests
"""
-import glob
import os
import sys
-import unittest
from tempfile import mkdtemp
import gi.overrides
@@ -76,5 +74,6 @@ def setup():
return res
+
if not setup():
raise ImportError("Could not setup testsuite")
diff --git a/tests/common.py b/tests/common.py
index a4229cc2..d90a05ba 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -37,7 +37,6 @@ from gi.repository import GLib
from gi.repository import Gst
from gi.repository import Gtk
-from pitivi import check
from pitivi.application import Pitivi
from pitivi.project import ProjectManager
from pitivi.settings import GlobalSettings
diff --git a/tests/ptv_testsuite.py b/tests/ptv_testsuite.py
index 3577f34c..76a6019e 100644
--- a/tests/ptv_testsuite.py
+++ b/tests/ptv_testsuite.py
@@ -16,7 +16,7 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
# pylint: disable=missing-docstring,invalid-name
-"""GstValidateLauncher testsuite to run out unit tests."""
+"""GstValidateLauncher testsuite to run our unit tests."""
import os
import sys
import unittest
@@ -28,12 +28,11 @@ sys.path.insert(0, os.path.join(CDIR, '..'))
# pylint: disable=wrong-import-position
# pylint: disable=unused-import
# Import tests so that the module is initialized
-import tests # noqa
+import tests
# pylint: disable=import-error
-from launcher.baseclasses import Test # noqa
+from launcher.baseclasses import Test
-# pylint: disable=too-few-public-methods
class PitiviTest(Test):
"""A launcher.Test subclass for our unit tests."""
def build_arguments(self):
diff --git a/tests/test_media_library.py b/tests/test_media_library.py
index 89291b1f..c0523fe0 100644
--- a/tests/test_media_library.py
+++ b/tests/test_media_library.py
@@ -105,12 +105,12 @@ class BaseTestMediaLibrary(common.TestCase):
self.assertFalse(self.medialibrary._progressbar.props.visible)
def check_add_proxy(self, asset, scaled=False, w=160, h=120,
- check_progress=True):
+ check_progress=True):
self.assertFalse(self.app.proxy_manager.is_proxy_asset(asset))
# Check the inital state of the asset, nothing should be going on.
self.assertNotIn("Proxy creation progress:",
- self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
+ self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
self.assertIn(
self.medialibrary.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
[medialibrary.AssetThumbnail.NO_PROXY,
@@ -135,7 +135,7 @@ class BaseTestMediaLibrary(common.TestCase):
project.use_proxies_for_assets([asset], scaled)
self.assertIn("Proxy creation progress:",
- self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
+ self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
self.mainloop.run(timeout_seconds=10)
finally:
@@ -146,7 +146,7 @@ class BaseTestMediaLibrary(common.TestCase):
# Finally, check the final staus of the asset after proxying.
self.assertNotIn("Proxy creation progress:",
- self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
+ self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
if scaled:
self.assertEqual(
self.medialibrary.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
@@ -303,7 +303,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Check that the info column notifies the user about progress
self.assertTrue("Proxy creation progress:" in
- self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
+ self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
# Run the mainloop and let _progressBarCb stop it when the proxy is
# ready
@@ -346,7 +346,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
# Enable and delete scaled proxy
proxy = self.check_add_proxy(asset, scaled=True,
- check_progress=False)
+ check_progress=False)
self.check_disable_proxy(proxy, asset, delete=True)
# Check that only HQ Proxy exists
@@ -374,7 +374,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
self.app.project_manager.current_project.regenerate_scaled_proxies()
self.assertTrue("Proxy creation progress:" in
- self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
+ self.medialibrary.storemodel[0][medialibrary.COL_INFOTEXT])
self.mainloop.run()
proxy = self.medialibrary.storemodel[0][medialibrary.COL_ASSET]
@@ -440,7 +440,7 @@ class TestMediaLibrary(BaseTestMediaLibrary):
sample = "mp3_sample.mp3"
with common.cloned_sample(sample):
self.check_import([sample], check_no_transcoding=True,
- proxying_strategy=ProxyingStrategy.AUTOMATIC)
+ proxying_strategy=ProxyingStrategy.AUTOMATIC)
def test_missing_uri_displayed(self):
asset_uri = common.get_sample_uri("image-which-does-not-exist.png")
diff --git a/tests/test_plugin_manager.py b/tests/test_plugin_manager.py
index efede720..a20d53ed 100644
--- a/tests/test_plugin_manager.py
+++ b/tests/test_plugin_manager.py
@@ -29,7 +29,7 @@ from tests import common
class TestPluginManager(common.TestCase):
- """Tests for the Plugin Manager."""
+ """Tests for the PluginManager class."""
def test_load_plugins_from_settings(self):
"""Checks if the plugin manager loads plugins from GlobalSettings."""
diff --git a/tests/test_project.py b/tests/test_project.py
index 5de9ed7e..0183b80c 100644
--- a/tests/test_project.py
+++ b/tests/test_project.py
@@ -523,11 +523,11 @@ class TestProjectLoading(common.TestCase):
project_manager.load_project(proj_uri)
mainloop.run()
self.assertEqual(len(missing_uris), 1,
- "missing_uri_cb should be called only once, got %s." % missing_uris)
+ "missing_uri_cb should be called only once, got %s." % missing_uris)
self.assertEqual(medialib._progressbar.get_fraction(), 1.0)
mainloop.run()
self.assertEqual(len(medialib.storemodel), 2,
- "We should have one asset displayed in the MediaLibrary.")
+ "We should have one asset displayed in the MediaLibrary.")
self.assertEqual(medialib.storemodel[0][medialibrary.COL_THUMB_DECORATOR].state,
medialibrary.AssetThumbnail.PROXIED)
self.assertEqual(medialib.storemodel[1][medialibrary.COL_THUMB_DECORATOR].state,
medialibrary.AssetThumbnail.PROXIED)
diff --git a/tests/test_timeline_timeline.py b/tests/test_timeline_timeline.py
index 167d2c0b..3eec06b1 100644
--- a/tests/test_timeline_timeline.py
+++ b/tests/test_timeline_timeline.py
@@ -23,7 +23,6 @@ from gi.repository import GES
from gi.repository import Gst
from gi.repository import Gtk
-from pitivi.timeline.timeline import TimelineContainer
from pitivi.utils.timeline import UNSELECT
from pitivi.utils.ui import LAYER_HEIGHT
from pitivi.utils.ui import SEPARATOR_HEIGHT
@@ -639,9 +638,9 @@ class TestShiftSelection(BaseTestTimeline):
asset = GES.UriClipAsset.request_sync(
common.get_sample_uri("1sec_simpsons_trailer.mp4"))
ges_clip1 = ges_layer.add_asset(asset, 0 * Gst.SECOND, 0,
- 1 * Gst.SECOND, GES.TrackType.UNKNOWN)
+ 1 * Gst.SECOND, GES.TrackType.UNKNOWN)
ges_clip2 = ges_layer.add_asset(asset, 1 * Gst.SECOND, 0,
- 1 * Gst.SECOND, GES.TrackType.UNKNOWN)
+ 1 * Gst.SECOND, GES.TrackType.UNKNOWN)
event = mock.Mock()
event.get_button.return_value = (True, 1)
@@ -754,16 +753,16 @@ class TestShiftSelection(BaseTestTimeline):
timeline._button_release_event_cb(None, event)
timeline.get_clicked_layer_and_pos.return_value = (ges_layer1, 9 * Gst.SECOND)
timeline._button_release_event_cb(None, event)
- self.__check_selected([ges_clip11, ges_clip22], [ges_clip12, ges_clip13,
- ges_clip21, ges_clip23, ges_clip31, ges_clip32, ges_clip33])
+ self.__check_selected([ges_clip11, ges_clip22],
+ [ges_clip12, ges_clip13, ges_clip21, ges_clip23, ges_clip31, ges_clip32,
ges_clip33])
timeline.get_clicked_layer_and_pos.return_value = (ges_layer3, 12 * Gst.SECOND)
timeline._button_release_event_cb(None, event)
- self.__check_selected([ges_clip22, ges_clip31, ges_clip32], [ges_clip11,
- ges_clip12, ges_clip13, ges_clip21, ges_clip23, ges_clip33])
+ self.__check_selected([ges_clip22, ges_clip31, ges_clip32],
+ [ges_clip11, ges_clip12, ges_clip13, ges_clip21, ges_clip23, ges_clip33])
timeline.get_clicked_layer_and_pos.return_value = (ges_layer1, 22 * Gst.SECOND)
timeline._button_release_event_cb(None, event)
self.__check_selected([ges_clip11, ges_clip12, ges_clip22, ges_clip23],
- [ges_clip13, ges_clip21, ges_clip31, ges_clip32, ges_clip33])
+ [ges_clip13, ges_clip21, ges_clip31, ges_clip32, ges_clip33])
self.__reset_clips_selection(timeline)
timeline.get_clicked_layer_and_pos.return_value = (ges_layer1, 3 * Gst.SECOND)
@@ -771,11 +770,12 @@ class TestShiftSelection(BaseTestTimeline):
timeline.get_clicked_layer_and_pos.return_value = (ges_layer2, 26 * Gst.SECOND)
timeline._button_release_event_cb(None, event)
self.__check_selected([ges_clip11, ges_clip12, ges_clip13, ges_clip22, ges_clip23],
- [ges_clip21, ges_clip31, ges_clip32, ges_clip33])
+ [ges_clip21, ges_clip31, ges_clip32, ges_clip33])
timeline.get_clicked_layer_and_pos.return_value = (ges_layer3, 30 * Gst.SECOND)
timeline._button_release_event_cb(None, event)
self.__check_selected([ges_clip11, ges_clip12, ges_clip13, ges_clip22, ges_clip23,
- ges_clip31, ges_clip32, ges_clip33], [ges_clip21])
+ ges_clip31, ges_clip32, ges_clip33],
+ [ges_clip21])
def test_shift_selection_multiple_layers(self):
self.__check_shift_selection_multiple_layers(left_click_also_seeks=False)
diff --git a/tests/test_utils.py b/tests/test_utils.py
index fedd43c7..4e5a15af 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -198,7 +198,7 @@ class TestMiscUtils(common.TestCase):
"audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 8000, 11025, 12000,
16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, channels=(int)1;"
"audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int){ 8000, 11025, 12000,
16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, channels=(int)2,
channel-mask=(bitmask)0x0000000000000003")
yt_audiorest = Gst.Caps("audio/x-raw,channels=6,channel-mask=0x3f,rate={48000,96000};"
- "audio/x-raw,channels=2,rate={48000,96000}")
+ "audio/x-raw,channels=2,rate={48000,96000}")
vorbis_caps = Gst.Caps("audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)[
1, 200000 ], channels=(int)1;"
"audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)[
1, 200000 ], channels=(int)2, channel-mask=(bitmask)0x0000000000000003;"
@@ -211,23 +211,23 @@ class TestMiscUtils(common.TestCase):
"audio/x-raw, format=(string)F32LE, layout=(string)interleaved, rate=(int)[
1, 200000 ], channels=(int)[ 9, 255 ], channel-mask=(bitmask)0x0000000000000000")
avenc_ac3_caps = Gst.Caps("audio/x-raw, channel-mask=(bitmask)0x0000000000000000, channels=(int)1,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000003, channels=(int)2, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000103, channels=(int)3, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000007, channels=(int)3, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000c03, channels=(int)4, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000033, channels=(int)4, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000107, channels=(int)4, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000c07, channels=(int)5, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000037, channels=(int)5, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000000c, channels=(int)2, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000000b, channels=(int)3, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000010b, channels=(int)4, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000000f, channels=(int)4, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000c0b, channels=(int)5, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000003b, channels=(int)5, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000010f, channels=(int)5, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x0000000000000c0f, channels=(int)6, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
- " audio/x-raw, channel-mask=(bitmask)0x000000000000003f, channels=(int)6, rate=(int){ 48000,
44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;")
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000003, channels=(int)2,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000103, channels=(int)3,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000007, channels=(int)3,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000c03, channels=(int)4,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000033, channels=(int)4,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000107, channels=(int)4,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000c07, channels=(int)5,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000037, channels=(int)5,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000000c, channels=(int)2,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000000b, channels=(int)3,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000010b, channels=(int)4,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000000f, channels=(int)4,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000c0b, channels=(int)5,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000003b, channels=(int)5,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000010f, channels=(int)5,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x0000000000000c0f, channels=(int)6,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;"
+ " audio/x-raw, channel-mask=(bitmask)0x000000000000003f, channels=(int)6,
rate=(int){ 48000, 44100, 32000 }, layout=(string)interleaved, format=(string)F32LE;")
audio_defaults = {"channels": Gst.IntRange(range(1, 2147483647)),
"rate": Gst.IntRange(range(8000, GLib.MAXINT))}
diff --git a/tests/test_widgets.py b/tests/test_widgets.py
index c8de3370..54a37e71 100644
--- a/tests/test_widgets.py
+++ b/tests/test_widgets.py
@@ -23,11 +23,11 @@ from pitivi.utils.widgets import ChoiceWidget
from pitivi.utils.widgets import ColorWidget
from pitivi.utils.widgets import FontWidget
from pitivi.utils.widgets import FractionWidget
+from pitivi.utils.widgets import GstElementSettingsDialog
from pitivi.utils.widgets import NumericWidget
from pitivi.utils.widgets import PathWidget
from pitivi.utils.widgets import TextWidget
from pitivi.utils.widgets import ToggleWidget
-from pitivi.utils.widgets import GstElementSettingsDialog
from tests import common
@@ -55,11 +55,11 @@ class TestWidgets(common.TestCase):
self.assertEqual(default, widget.getWidgetValue())
def testValidation(self):
- widget = TextWidget("^([a-zA-Z]+\s*)+$")
+ widget = TextWidget("^([a-zA-Z]+\\s*)+$")
bad_value = "1"
self.assertNotEqual(bad_value, widget.getWidgetValue())
- widget = TextWidget("^\d+$", ("12", "14"))
+ widget = TextWidget("^\\d+$", ("12", "14"))
bad_value = "non-digits"
self.assertNotEqual(bad_value, widget.getWidgetValue())
@@ -86,4 +86,4 @@ class TestGstElementSettingsDialog(common.TestCase):
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)
\ No newline at end of file
+ self.assertEqual(v.getWidgetValue(), 12)
diff --git a/tests/validate-tests/runtests b/tests/validate-tests/runtests
index 82048569..c876ac71 100755
--- a/tests/validate-tests/runtests
+++ b/tests/validate-tests/runtests
@@ -1,7 +1,5 @@
#!/usr/bin/env python3
-
"""Wrapper script for running the Pitivi integration tests."""
-
import os
import subprocess
import sys
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]