[pitivi: 9/65] Make core pep8 compliant



commit c40aec5f6903b7bbd0632d8ba878a1d06619197b
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Mon Jun 6 03:59:43 2011 -0400

    Make core pep8 compliant

 pitivi/action.py                   |   24 ++++++-----
 pitivi/actioner.py                 |    7 ++-
 pitivi/application.py              |    3 +-
 pitivi/check.py                    |    7 +++
 pitivi/discoverer.py               |   15 ++++---
 pitivi/effects.py                  |    1 +
 pitivi/elements/arraysink.py       |    1 +
 pitivi/elements/mixer.py           |   13 +++---
 pitivi/elements/singledecodebin.py |    9 +++-
 pitivi/elements/thumbnailsink.py   |    7 ++-
 pitivi/elements/videofade.py       |    3 +-
 pitivi/encode.py                   |   32 +++++++++++----
 pitivi/factories/base.py           |   12 +++++-
 pitivi/factories/file.py           |    3 +
 pitivi/factories/operation.py      |    9 ++++-
 pitivi/factories/test.py           |    2 +
 pitivi/factories/timeline.py       |    2 +
 pitivi/formatters/base.py          |    9 ++++-
 pitivi/formatters/etree.py         |   12 ++++--
 pitivi/formatters/format.py        |    4 ++
 pitivi/formatters/playlist.py      |    3 +-
 pitivi/log/log.py                  |   19 ++++-----
 pitivi/log/loggable.py             |    1 +
 pitivi/log/termcolor.py            |   46 +++++++++++-----------
 pitivi/pipeline.py                 |   39 ++++++++++--------
 pitivi/pitivigstutils.py           |    6 +++
 pitivi/plugincore.py               |    9 ++++
 pitivi/plumber.py                  |    5 ++-
 pitivi/project.py                  |    6 ++-
 pitivi/projectmanager.py           |    5 ++-
 pitivi/receiver.py                 |    5 ++-
 pitivi/reflect.py                  |   10 +++--
 pitivi/settings.py                 |   25 ++++++++++-
 pitivi/signalgroup.py              |    2 +-
 pitivi/signalinterface.py          |    8 ++--
 pitivi/sourcelist.py               |   13 +++---
 pitivi/sourcelist_undo.py          |    3 +
 pitivi/stream.py                   |   30 ++++++++++++--
 pitivi/threads.py                  |    6 ++-
 pitivi/thumbnailcache.py           |    1 +
 pitivi/timeline/gap.py             |    3 +
 pitivi/timeline/timeline.py        |   26 +++++++-----
 pitivi/timeline/timeline_undo.py   |   23 ++++++++---
 pitivi/timeline/track.py           |   42 ++++++++++++-------
 pitivi/undo.py                     |    6 +++
 pitivi/utils.py                    |   77 +++++++++++++++++++++++++----------
 46 files changed, 407 insertions(+), 187 deletions(-)
---
diff --git a/pitivi/action.py b/pitivi/action.py
index a45dad2..abd87a4 100644
--- a/pitivi/action.py
+++ b/pitivi/action.py
@@ -35,10 +35,12 @@ from pitivi.log.loggable import Loggable
 
 # TODO : Create a convenience class for Links
 
+
 # FIXME : define/document a proper hierarchy
 class ActionError(Exception):
     pass
 
+
 class Action(Signallable, Loggable):
     """
     Pipeline action.
@@ -68,13 +70,13 @@ class Action(Signallable, Loggable):
     @cvar queue_size: Default queueing size (in seconds) to use for links.
     """
 
-    compatible_producers = [ SourceFactory ]
-    compatible_consumers = [ SinkFactory ]
+    compatible_producers = [SourceFactory]
+    compatible_consumers = [SinkFactory]
 
     queue_size = 1
 
     __signals__ = {
-        "state-changed" : ["state"]
+        "state-changed": ["state"]
         }
 
     def __init__(self):
@@ -83,11 +85,11 @@ class Action(Signallable, Loggable):
         self.producers = []
         self.consumers = []
         self.pipeline = None
-        self._links = [] # list of (producer, consumer, prodstream, consstream)
-        self._pending_links = [] # list of links that still need to be connected
+        self._links = []  # list of (producer, consumer, prodstream, consstream)
+        self._pending_links = []  # list of links that still need to be connected
         self._pending_links_elements = []
-        self._dyn_links = [] # list of links added at RunTime, will be removed when deactivated
-        self._dynconsumers = [] # consumers that we added at RunTime
+        self._dyn_links = []  # list of links added at RunTime, will be removed when deactivated
+        self._dynconsumers = []  # consumers that we added at RunTime
 
     #{ Activation methods
 
@@ -403,7 +405,6 @@ class Action(Signallable, Loggable):
         self.debug("Returning %d links", len(links))
         return links
 
-
     def autoLink(self):
         """
         Based on the available consumers and producers, returns a list of
@@ -458,7 +459,7 @@ class Action(Signallable, Loggable):
         @return: C{True} if the Stream is/was handled by the Action, else C{False}
         @rtype: C{bool}
         """
-        self.debug("producer:%r, stream:%s" , producer, stream.caps)
+        self.debug("producer:%r, stream:%s", producer, stream.caps)
 
         waspending = False
 
@@ -480,7 +481,6 @@ class Action(Signallable, Loggable):
                     self._pd = getattr(self, '_pd', [])
                     self._pd.append((producer, stream))
 
-
         if not waspending:
             self.debug("Checking to see if we haven't already handled it")
             # 2. If it's not one of the pending links, It could also be one of the
@@ -592,7 +592,7 @@ class Action(Signallable, Loggable):
 
         # activate the given Link, returns True if it was (already) activated
         # if init is True, then remember the pending link
-        self.debug("producer:%r, consumer:%r, prodstream:%r, consstream:%r" , \
+        self.debug("producer:%r, consumer:%r, prodstream:%r, consstream:%r", \
                 producer, consumer, prodstream, consstream)
 
         self.info("Ensuring a bin exists for our producer")
@@ -688,6 +688,7 @@ class Action(Signallable, Loggable):
                 # FIXME: use a strictier exception hierarchy
                 pass
 
+
 class ViewAction(Action):
     """
     An action used to view sources.
@@ -737,6 +738,7 @@ class ViewAction(Action):
         if self.audiosink:
             self.audiosink.setSync(sync)
 
+
 class RenderAction(Action):
     """
     An Action to render sources.
diff --git a/pitivi/actioner.py b/pitivi/actioner.py
index 5dd89b8..c726de3 100644
--- a/pitivi/actioner.py
+++ b/pitivi/actioner.py
@@ -38,12 +38,13 @@ from pitivi.signalinterface import Signallable
 from pitivi.stream import AudioStream, VideoStream
 from pitivi.utils import beautify_ETA
 
+
 class Actioner(Loggable, Signallable):
     """ Previewer/Renderer helper methods """
 
     __signals__ = {
-        "eos" : None,
-        "error" : None
+        "eos": None,
+        "error": None
         }
 
     def __init__(self, project, pipeline=None, settings=None):
@@ -164,6 +165,7 @@ class Actioner(Loggable, Signallable):
         """
         raise NotImplementedError()
 
+
 class Renderer(Actioner):
     """ Rendering helper methods """
 
@@ -249,6 +251,7 @@ class Renderer(Actioner):
             if isinstance(action, ViewAction) and action.isActive():
                 action.setSync(False)
 
+
 class Previewer(Actioner):
     """ Previewing helper methods """
 
diff --git a/pitivi/application.py b/pitivi/application.py
index dd2c2b6..256e621 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -64,6 +64,7 @@ from pitivi.ui.startupwizard import StartUpWizard
 # AND THEN load up the required parts.
 # This will result in a much better end-user experience
 
+
 class Pitivi(Loggable, Signallable):
     """
     Pitivi's main application class.
@@ -275,7 +276,7 @@ class GuiPitivi(InteractivePitivi):
         dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
                                    buttons=gtk.BUTTONS_OK)
         dialog.set_icon_name("pitivi")
-        dialog.set_markup("<b>"+message+"</b>")
+        dialog.set_markup("<b>" + message + "</b>")
         dialog.format_secondary_text(detail)
         dialog.run()
 
diff --git a/pitivi/check.py b/pitivi/check.py
index 619367a..1738140 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -31,6 +31,7 @@ from gettext import gettext as _
 from pitivi.instance import PiTiVi
 from pitivi.configure import APPNAME, PYGTK_REQ, PYGST_REQ, GST_REQ, GNONLIN_REQ, PYCAIRO_REQ
 
+
 def initiate_videosinks():
     """
     Test if the autovideosink element can initiate, return TRUE if it is the
@@ -42,6 +43,7 @@ def initiate_videosinks():
     sink.set_state(gst.STATE_NULL)
     return True
 
+
 def initiate_audiosinks():
     """
     Test if the autoaudiosink element can initiate, return TRUE if it is the
@@ -53,6 +55,7 @@ def initiate_audiosinks():
     sink.set_state(gst.STATE_NULL)
     return True
 
+
 def __try_import__(modulename):
     """
     Attempt to load given module.
@@ -64,12 +67,15 @@ def __try_import__(modulename):
     except:
         return False
 
+
 def _version_to_string(version):
     return ".".join([str(x) for x in version])
 
+
 def _string_to_list(version):
     return [int(x) for x in version.split(".")]
 
+
 def check_required_version(modulename):
     """
     Checks if the installed module is the required version or more recent.
@@ -96,6 +102,7 @@ def check_required_version(modulename):
             return [GNONLIN_REQ, gnlver]
     return [None, None]
 
+
 def initial_checks():
     reg = gst.registry_get_default()
     if PiTiVi:
diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index 2588bc4..70f7ca9 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -45,6 +45,7 @@ from pitivi.settings import xdg_cache_home
 # what encoded format it is
 # We will need that in order to create proper Stream objects.
 
+
 class EOSSir(gst.Element):
     __gstdetails__ = (
         "EOSSir",
@@ -79,6 +80,7 @@ class EOSSir(gst.Element):
         return ret
 gobject.type_register(EOSSir)
 
+
 class Discoverer(Signallable, Loggable):
     """
     Queues requests to discover information about given files.
@@ -97,10 +99,10 @@ class Discoverer(Signallable, Loggable):
     """
 
     __signals__ = {
-        "discovery-error" : ["a", "b", "c" ],
-        "discovery-done" : ["uri", "factory"],
-        "ready" : None,
-        "starting" : None,
+        "discovery-error": ["a", "b", "c"],
+        "discovery-done": ["uri", "factory"],
+        "ready": None,
+        "starting": None,
         "missing-plugins": ["uri", "detail", "description"]
         }
 
@@ -262,7 +264,7 @@ class Discoverer(Signallable, Loggable):
             # assume it's got infinite duration)
             is_image = have_image and len(self.current_streams) == 1
             if self.current_duration == gst.CLOCK_TIME_NONE and not is_image:
-                self.error =_("Could not establish the duration of the file.")
+                self.error = _("Could not establish the duration of the file.")
                 self.error_detail = _("This clip seems to be in a format "
                         "which cannot be accessed in a random fashion.")
                 self._emitError()
@@ -287,7 +289,6 @@ class Discoverer(Signallable, Loggable):
 
             return True
 
-
         # plugins are being installed, processing will continue when
         # self._installMissingPluginsCallback is called by the application
         return False
@@ -713,7 +714,7 @@ class Discoverer(Signallable, Loggable):
     def _addStreamFromPad(self, pad):
         self._maybeQueryDuration(pad)
         self.debug("adding stream from pad %s caps %s", pad, pad.props.caps)
-        stream  = get_stream_for_pad(pad)
+        stream = get_stream_for_pad(pad)
         self.current_streams.append(stream)
 
         return stream
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 0add825..266c26c 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -57,6 +57,7 @@ BLACKLISTED_EFFECTS = ["colorconvert", "coglogoinsert", "festival",
 #We should unblacklist it when #650985 is solved
 BLACKLISTED_PLUGINS = ["ldaspa"]
 
+
 class EffectsHandler(object):
     """
     Handles all the effects
diff --git a/pitivi/elements/arraysink.py b/pitivi/elements/arraysink.py
index eed349c..b9c7b24 100644
--- a/pitivi/elements/arraysink.py
+++ b/pitivi/elements/arraysink.py
@@ -29,6 +29,7 @@ import gtk
 import array
 from pitivi.utils import native_endianness
 
+
 class ArraySink(gst.BaseSink):
 
     """
diff --git a/pitivi/elements/mixer.py b/pitivi/elements/mixer.py
index 8c4dede..fa05947 100644
--- a/pitivi/elements/mixer.py
+++ b/pitivi/elements/mixer.py
@@ -59,7 +59,7 @@ class SmartAdderBin(gst.Bin):
         srcpad.set_active(True)
         self.add_pad(srcpad)
         self.pad_count = 0
-        self.inputs = {} # key:pad_name, value:(sinkpad, aconv, aresample, adderpad)
+        self.inputs = {}  # key:pad_name, value:(sinkpad, aconv, aresample, adderpad)
 
     def do_request_new_pad(self, template, name=None):
         self.debug("template:%r, name:%r" % (template, name))
@@ -108,6 +108,7 @@ class SmartAdderBin(gst.Bin):
 gobject.type_register(SmartAdderBin)
 gst.element_register(SmartAdderBin, 'smart-adder-bin')
 
+
 class SmartVideomixerBin(gst.Bin):
 
     __gstdetails__ = (
@@ -138,12 +139,12 @@ class SmartVideomixerBin(gst.Bin):
         srcpad.set_active(True)
         self.add_pad(srcpad)
         self.pad_count = 0
-        self.inputs = {} # key : pad_name,
-                         # value : (sinkpad, ffmpegcolorspace, capsfilter, videomixerpad)
+        self.inputs = {}  # key : pad_name,
+                          # value : (sinkpad, ffmpegcolorspace, capsfilter, videomixerpad)
 
         self.alpha_helper = SmartVideomixerBinPropertyHelper(self, track, self.inputs)
 
-    def _pad_blockedCb (self, pad, blocked, unused=None):
+    def _pad_blockedCb(self, pad, blocked, unused=None):
         pass
 
     def change_mixer(self, has_alpha):
@@ -195,7 +196,7 @@ class SmartVideomixerBin(gst.Bin):
         self.debug("pad:%r, priority:%d" % (pad, priority))
         if priority > 10000:
             priority = 10000
-        a,b,c,sinkpad = self.inputs.get(pad.get_name(), (None, None, None, None))
+        a, b, c, sinkpad = self.inputs.get(pad.get_name(), (None, None, None, None))
         if sinkpad:
             sinkpad.props.zorder = 10000 - priority
         self.debug("done")
@@ -246,6 +247,7 @@ class SmartVideomixerBin(gst.Bin):
             self.remove(capsfilter)
         self.debug("done")
 
+
 class SmartVideomixerBinPropertyHelper(Signallable):
     """A set of callbacks used for considering the alpha state of all track
        objects in the composition."""
@@ -264,7 +266,6 @@ class SmartVideomixerBinPropertyHelper(Signallable):
         # configure initial alpha state
         self.alphaStateChanged(False)
 
-
     def _trackAddedCb(self, track, track_object):
         # this import is here because of a circular dependence
         from pitivi.timeline.track import TrackError
diff --git a/pitivi/elements/singledecodebin.py b/pitivi/elements/singledecodebin.py
index 69a163c..5296c40 100644
--- a/pitivi/elements/singledecodebin.py
+++ b/pitivi/elements/singledecodebin.py
@@ -28,6 +28,7 @@ import gst
 from pitivi.stream import get_pad_id, pad_compatible_stream
 from pitivi.utils import CachedFactoryList
 
+
 def is_raw(caps):
     """ returns True if the caps are RAW """
     rep = caps.to_string()
@@ -37,8 +38,9 @@ def is_raw(caps):
             return True
     return False
 
+
 def factoryFilter(factory):
-    if factory.get_rank() < 64 :
+    if factory.get_rank() < 64:
         return False
 
     klass = factory.get_klass()
@@ -50,6 +52,7 @@ def factoryFilter(factory):
 
 _factoryCache = CachedFactoryList(factoryFilter)
 
+
 class SingleDecodeBin(gst.Bin):
     """
     A variant of decodebin.
@@ -102,7 +105,7 @@ class SingleDecodeBin(gst.Bin):
 
         self._dynamics = []
 
-        self._validelements = [] #added elements
+        self._validelements = []  # added elements
 
         self.debug("stream:%r" % self.stream)
 
@@ -258,7 +261,7 @@ class SingleDecodeBin(gst.Bin):
             if not self._srcpad:
                 self._wrapUp(element, pad)
         elif is_raw(caps) and pad_compatible_stream(pad, self.stream):
-            self.log ("not the target stream, but compatible")
+            self.log("not the target stream, but compatible")
             if not self._srcpad:
                 self._wrapUp(element, pad)
         elif is_raw(caps):
diff --git a/pitivi/elements/thumbnailsink.py b/pitivi/elements/thumbnailsink.py
index 98a460e..2509273 100644
--- a/pitivi/elements/thumbnailsink.py
+++ b/pitivi/elements/thumbnailsink.py
@@ -28,6 +28,7 @@ import cairo
 import array
 from pitivi.utils import big_to_cairo_alpha_mask, big_to_cairo_red_mask, big_to_cairo_green_mask, big_to_cairo_blue_mask
 
+
 class CairoSurfaceThumbnailSink(gst.BaseSink):
     """
     GStreamer thumbnailing sink element.
@@ -36,9 +37,9 @@ class CairoSurfaceThumbnailSink(gst.BaseSink):
     """
 
     __gsignals__ = {
-        "thumbnail" : (gobject.SIGNAL_RUN_LAST,
-                       gobject.TYPE_NONE,
-                       (gobject.TYPE_PYOBJECT, gobject.TYPE_UINT64))
+        "thumbnail": (gobject.SIGNAL_RUN_LAST,
+                      gobject.TYPE_NONE,
+                      (gobject.TYPE_PYOBJECT, gobject.TYPE_UINT64))
         }
 
     __gsttemplates__ = (
diff --git a/pitivi/elements/videofade.py b/pitivi/elements/videofade.py
index 413e476..e31aa64 100644
--- a/pitivi/elements/videofade.py
+++ b/pitivi/elements/videofade.py
@@ -26,12 +26,13 @@ Simple video fade element
 import gobject
 import gst
 
+
 class VideoFade(gst.Bin):
     """
     Simple video fade element
     """
 
-    def __init__(self, position=0, duration=2*gst.SECOND, fadefromblack=True):
+    def __init__(self, position=0, duration=2 * gst.SECOND, fadefromblack=True):
         gst.Bin.__init__(self)
         self.incsp = gst.element_factory_make("ffmpegcolorspace", "incsp")
         self.outcsp = gst.element_factory_make("ffmpegcolorspace", "outcsp")
diff --git a/pitivi/encode.py b/pitivi/encode.py
index 021af99..9629185 100644
--- a/pitivi/encode.py
+++ b/pitivi/encode.py
@@ -29,6 +29,7 @@ import pitivi.log.log as log
 from pitivi.factories.base import OperationFactory, SinkFactory
 from pitivi.factories.operation import TransformFactory, get_modifier_for_stream
 
+
 class EncoderFactory(TransformFactory):
     """
     Creates one-to-one encoding bins based on provided L{StreamEncodeSettings}.
@@ -86,6 +87,7 @@ class EncoderFactory(TransformFactory):
             if isinstance(b, gst.Bin):
                 b.factory.releaseBin(b)
 
+
 class RenderFactory(OperationFactory):
     """
     Handles factories that consume streams and output one (and only one
@@ -162,6 +164,7 @@ class RenderFactory(OperationFactory):
     def _requestNewInputStream(self, bin, input_stream):
         raise NotImplementedError
 
+
 class RenderSinkFactory(SinkFactory):
     """
     Convenience class combining a L{RenderFactory} and a L{SinkFactory}.
@@ -240,38 +243,39 @@ def get_compatible_sink_pad(factoryname, caps):
     """
     factory = gst.registry_get_default().lookup_feature(factoryname)
     if factory == None:
-        log.warning("encode","%s is not a valid factoryname", factoryname)
+        log.warning("encode", "%s is not a valid factoryname", factoryname)
         return None
 
     res = []
     sinkpads = [x for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SINK]
     for p in sinkpads:
         c = p.get_caps()
-        log.log("encode","sinkcaps %s", c.to_string())
+        log.log("encode", "sinkcaps %s", c.to_string())
         inter = caps.intersect(c)
-        log.log("encode","intersection %s", inter.to_string())
+        log.log("encode", "intersection %s", inter.to_string())
         if inter:
             res.append(p.name_template)
     if len(res) > 0:
         return res[0]
     return None
 
+
 def get_compatible_sink_caps(factoryname, caps):
     """
     Returns the compatible caps between 'caps' and the sink pad caps of 'factoryname'
     """
-    log.log("encode","factoryname : %s , caps : %s", factoryname, caps.to_string())
+    log.log("encode", "factoryname : %s , caps : %s", factoryname, caps.to_string())
     factory = gst.registry_get_default().lookup_feature(factoryname)
     if factory == None:
-        log.warning("encode","%s is not a valid factoryname", factoryname)
+        log.warning("encode", "%s is not a valid factoryname", factoryname)
         return None
 
     res = []
     sinkcaps = [x.get_caps() for x in factory.get_static_pad_templates() if x.direction == gst.PAD_SINK]
     for c in sinkcaps:
-        log.log("encode","sinkcaps %s", c.to_string())
+        log.log("encode", "sinkcaps %s", c.to_string())
         inter = caps.intersect(c)
-        log.log("encode","intersection %s", inter.to_string())
+        log.log("encode", "intersection %s", inter.to_string())
         if inter:
             res.append(inter)
 
@@ -279,12 +283,14 @@ def get_compatible_sink_caps(factoryname, caps):
         return res[0]
     return None
 
+
 def list_compat(a1, b1):
     for x1 in a1:
         if not x1 in b1:
             return False
     return True
 
+
 def my_can_sink_caps(muxer, ocaps, muxsinkcaps=[]):
     """ returns True if the given caps intersect with some of the muxer's
     sink pad templates' caps.
@@ -308,6 +314,7 @@ def my_can_sink_caps(muxer, ocaps, muxsinkcaps=[]):
     #         return True
     # return False
 
+
 class CachedEncoderList(object):
     def __init__(self):
         self._factories = None
@@ -351,27 +358,33 @@ class CachedEncoderList(object):
         self._factories = None
 
 _cached_encoder_list = None
+
+
 def encoderlist():
     global _cached_encoder_list
     if _cached_encoder_list is None:
         _cached_encoder_list = CachedEncoderList()
     return _cached_encoder_list
 
+
 def available_muxers():
     """ return all available muxers """
     enclist = encoderlist()
     return enclist.available_muxers()
 
+
 def available_video_encoders():
     """ returns all available video encoders """
     enclist = encoderlist()
     return enclist.available_video_encoders()
 
+
 def available_audio_encoders():
     """ returns all available audio encoders """
     enclist = encoderlist()
     return enclist.available_audio_encoders()
 
+
 def encoders_muxer_compatible(encoders, muxer, muxsinkcaps=[]):
     """ returns the list of encoders compatible with the given muxer """
     res = []
@@ -385,19 +398,22 @@ def encoders_muxer_compatible(encoders, muxer, muxsinkcaps=[]):
                     break
     return res
 
+
 raw_audio_caps = gst.Caps("audio/x-raw-float;audio/x-raw-int")
 raw_video_caps = gst.Caps("video/x-raw-yuv;video/x-raw-rgb")
+
+
 def muxer_can_sink_raw_audio(muxer):
     """ Returns True if given muxer can accept raw audio """
     return my_can_sink_caps(muxer, raw_audio_caps)
 
+
 def muxer_can_sink_raw_video(muxer):
     """ Returns True if given muxer can accept raw video """
     return my_can_sink_caps(muxer, raw_video_caps)
 
 
 def available_combinations():
-
     """Return a 3-tuple of (muxers, audio, video), where:
         - muxers is a list of muxer factories
         - audio is a dictionary from muxer names to compatible audio encoders
diff --git a/pitivi/factories/base.py b/pitivi/factories/base.py
index b1c4037..80348c7 100644
--- a/pitivi/factories/base.py
+++ b/pitivi/factories/base.py
@@ -32,12 +32,16 @@ from pitivi.stream import match_stream_groups, AudioStream, VideoStream, \
 from pitivi.utils import formatPercent
 
 # FIXME: define a proper hierarchy
+
+
 class ObjectFactoryError(Exception):
     pass
 
+
 class ObjectFactoryStreamError(ObjectFactoryError):
     pass
 
+
 class ObjectFactory(Signallable, Loggable):
     """
     Base class for all factory implementations.
@@ -194,6 +198,7 @@ class ObjectFactory(Signallable, Loggable):
     def getInterpolatedProperties(self, stream):
         return {}
 
+
 class SourceFactory(ObjectFactory):
     """
     Base class for factories that produce output and have no input.
@@ -226,9 +231,9 @@ class SourceFactory(ObjectFactory):
         self.debug("stream:%r", stream)
         props = ObjectFactory.getInterpolatedProperties(self, stream)
         if isinstance(stream, AudioStream):
-            props.update({"volume" : (0.0, 2.0, formatPercent)})
+            props.update({"volume": (0.0, 2.0, formatPercent)})
         elif isinstance(stream, VideoStream):
-            props.update({"alpha" : (0.0, 1.0, formatPercent)})
+            props.update({"alpha": (0.0, 1.0, formatPercent)})
         self.debug("returning %r", props)
         return props
 
@@ -541,6 +546,7 @@ class SourceFactory(ObjectFactory):
         audio_bin.arate.sync_state_with_parent()
         audio_bin.volume.sync_state_with_parent()
 
+
 class SinkFactory(ObjectFactory):
     """
     Base class for factories that consume input and have no output.
@@ -643,6 +649,7 @@ class SinkFactory(ObjectFactory):
     def addOutputStream(self, stream):
         raise AssertionError("sink factories can't have output streams")
 
+
 class OperationFactory(ObjectFactory):
     """
     Base class for factories that process data (inputs data AND outputs data).
@@ -748,6 +755,7 @@ class LiveSourceFactory(SourceFactory):
 
         self.default_duration = default_duration
 
+
 class RandomAccessSourceFactory(SourceFactory):
     """
     Base class for source factories that support random access.
diff --git a/pitivi/factories/file.py b/pitivi/factories/file.py
index 6da34cc..fa48021 100644
--- a/pitivi/factories/file.py
+++ b/pitivi/factories/file.py
@@ -27,6 +27,7 @@ from pitivi.factories.base import RandomAccessSourceFactory, \
         SinkFactory
 from pitivi.stream import MultimediaStream, AudioStream, VideoStream
 
+
 class FileSourceFactory(RandomAccessSourceFactory):
     """
     Factory for local files.
@@ -40,6 +41,7 @@ class FileSourceFactory(RandomAccessSourceFactory):
         # FIXME: backward compatibility
         self.filename = uri
 
+
 class PictureFileSourceFactory(FileSourceFactory):
     """
     Factory for image sources.
@@ -65,6 +67,7 @@ class PictureFileSourceFactory(FileSourceFactory):
 
         return ret
 
+
 class URISinkFactory(SinkFactory):
     """ A simple sink factory """
 
diff --git a/pitivi/factories/operation.py b/pitivi/factories/operation.py
index b4e5bf1..5b3ff19 100644
--- a/pitivi/factories/operation.py
+++ b/pitivi/factories/operation.py
@@ -25,13 +25,16 @@ from pitivi.stream import AudioStream, VideoStream
 
 from gettext import gettext as _
 
+
 # FIXME: define a proper hierarchy
 class OperationFactoryError(Exception):
     pass
 
+
 class ModifierFactoryError(OperationFactoryError):
     pass
 
+
 class TransformFactory(OperationFactory):
     """
     Factories that take exactly one input stream and output exactly one output
@@ -55,6 +58,7 @@ class TransformFactory(OperationFactory):
     def _requestNewInputStream(self, *args):
         raise OperationFactoryError("TransformFactory doesn't allow request pads")
 
+
 class EffectFactory(TransformFactory):
     """
     Factories that applies an effect on a stream
@@ -99,19 +103,20 @@ class EffectFactory(TransformFactory):
         for element in elements.next():
             del element
 
-
     def addInputStream(self, stream):
         return OperationFactory.addInputStream(self, stream)
 
     def addOutputStream(self, stream):
         return OperationFactory.addOutputStream(self, stream)
 
+
 class StreamModifierFactory(TransformFactory):
     """
     Factories that modify the nature/type of a stream.
     """
     pass
 
+
 class AudioModifierFactory(StreamModifierFactory):
 
     def _makeBin(self, *args):
@@ -144,6 +149,7 @@ class AudioModifierFactory(StreamModifierFactory):
         b.add_pad(gsrc)
         return b
 
+
 class VideoModifierFactory(StreamModifierFactory):
 
     def _makeBin(self, *args):
@@ -187,6 +193,7 @@ class VideoModifierFactory(StreamModifierFactory):
         b.add_pad(gsrc)
         return b
 
+
 def get_modifier_for_stream(input_stream=None, output_stream=None):
     """
     Returns a L{StreamModifierFactory} for the given streams.
diff --git a/pitivi/factories/test.py b/pitivi/factories/test.py
index 2b5ef2e..667457f 100644
--- a/pitivi/factories/test.py
+++ b/pitivi/factories/test.py
@@ -25,6 +25,7 @@ from pitivi.factories.base import SourceFactory
 from pitivi.factories.operation import EffectFactory
 from pitivi.stream import VideoStream, AudioStream
 
+
 class VideoTestSourceFactory(SourceFactory):
     def __init__(self, pattern=0):
         SourceFactory.__init__(self, "videotestsrc://")
@@ -69,6 +70,7 @@ class VideoTestSourceFactory(SourceFactory):
     def _releaseBin(self, bin):
         pass
 
+
 class AudioTestSourceFactory(SourceFactory):
     def __init__(self, wave=0):
         SourceFactory.__init__(self, "audiotestsrc://")
diff --git a/pitivi/factories/timeline.py b/pitivi/factories/timeline.py
index 5f6ffa6..a4548df 100644
--- a/pitivi/factories/timeline.py
+++ b/pitivi/factories/timeline.py
@@ -23,6 +23,7 @@ import gobject
 import gst
 from pitivi.factories.base import SourceFactory, ObjectFactoryError
 
+
 class FixSeekStart(gst.BaseTransform):
     __gstdetails__ = (
         "Description",
@@ -64,6 +65,7 @@ class FixSeekStart(gst.BaseTransform):
 
 gobject.type_register(FixSeekStart)
 
+
 class TimelineSourceFactory(SourceFactory):
     def __init__(self, timeline):
         SourceFactory.__init__(self, "timeline://", "timeline")
diff --git a/pitivi/formatters/base.py b/pitivi/formatters/base.py
index 27422fa..fc414a6 100644
--- a/pitivi/formatters/base.py
+++ b/pitivi/formatters/base.py
@@ -32,24 +32,31 @@ from pitivi.signalinterface import Signallable
 from pitivi.log.loggable import Loggable
 from pitivi.factories.base import SourceFactory
 
+
 class FormatterError(Exception):
     pass
 
+
 class FormatterURIError(FormatterError):
     """An error occured with a URI"""
 
+
 class FormatterLoadError(FormatterError):
     """An error occured while loading the Project"""
 
+
 class FormatterParseError(FormatterLoadError):
     """An error occured while parsing the project file"""
 
+
 class FormatterSaveError(FormatterError):
     """An error occured while saving the Project"""
 
+
 class FormatterOverwriteError(FormatterSaveError):
     """A project can't be saved because it will be overwritten"""
 
+
 class Formatter(Signallable, Loggable):
     """
     Provides convenience methods for storing and loading
@@ -70,7 +77,7 @@ class Formatter(Signallable, Loggable):
         "new-project-failed": ["uri", "exception"],
         "save-project-failed": ["project", "uri", "exception"],
         "project-saved": ["project", "uri"],
-        "missing-uri" : ["uri", "factory"]
+        "missing-uri": ["uri", "factory"]
         }
 
     description = "Description of the format"
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index bfcbc22..883c12c 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -39,21 +39,23 @@ from pitivi.stream import match_stream_groups_map
 
 version = "0.1"
 
+
 def indent(elem, level=0):
-    i = "\n" + level*"  "
+    i = "\n" + level * "  "
     if len(elem):
         if not elem.text or not elem.text.strip():
             elem.text = i + "  "
         if not elem.tail or not elem.tail.strip():
             elem.tail = i
         for elem in elem:
-            indent(elem, level+1)
+            indent(elem, level + 1)
         if not elem.tail or not elem.tail.strip():
             elem.tail = i
     else:
         if level and (not elem.tail or not elem.tail.strip()):
             elem.tail = i
 
+
 class ElementTreeFormatterContext(object):
     def __init__(self):
         self.streams = {}
@@ -61,12 +63,15 @@ class ElementTreeFormatterContext(object):
         self.track_objects = {}
         self.rootelement = None
 
+
 class ElementTreeFormatterSaveContext(ElementTreeFormatterContext):
     pass
 
+
 class ElementTreeFormatterLoadContext(ElementTreeFormatterContext):
     pass
 
+
 class ElementTreeFormatter(Formatter):
     _element_id = 0
     _our_properties = ["id", "type"]
@@ -381,7 +386,6 @@ class ElementTreeFormatter(Formatter):
                 effect_properties.attrib[prop.name] = '(' + type_name + ')' + value
         effect_element.append(effect_properties)
 
-
     def _saveSourceTrackObject(self, track_object, element):
         factory_ref = self._saveFactoryRef(track_object.factory)
         stream_ref = self._saveStreamRef(track_object.stream)
@@ -562,7 +566,7 @@ class ElementTreeFormatter(Formatter):
 
         track = Track(stream)
 
-        track_objects_element  = element.find("track-objects")
+        track_objects_element = element.find("track-objects")
         for track_object_element in track_objects_element:
             self._loadTrackObject(track, track_object_element)
 
diff --git a/pitivi/formatters/format.py b/pitivi/formatters/format.py
index 3cbb865..9d90f5f 100644
--- a/pitivi/formatters/format.py
+++ b/pitivi/formatters/format.py
@@ -29,6 +29,7 @@ from gettext import gettext as _
 
 _formatters = []
 
+
 def can_handle_location(uri):
     """
     Detects whether the project at the given location can be loaded.
@@ -44,6 +45,7 @@ def can_handle_location(uri):
         if klass.canHandle(uri):
             return True
 
+
 def list_formats():
     """
     Returns a sequence of available project file formats
@@ -54,6 +56,7 @@ def list_formats():
     """
     return _formatters
 
+
 def get_formatter_for_uri(uri, avalaible_effects):
     """
     Returns an Formatter object that can parse the given project file
@@ -66,6 +69,7 @@ def get_formatter_for_uri(uri, avalaible_effects):
         if klass.canHandle(uri):
             return klass(avalaible_effects)
 
+
 def register_formatter(klass, name, extensions):
     _formatters.append((klass, name, extensions))
 
diff --git a/pitivi/formatters/playlist.py b/pitivi/formatters/playlist.py
index 8570bf4..3174492 100644
--- a/pitivi/formatters/playlist.py
+++ b/pitivi/formatters/playlist.py
@@ -26,6 +26,7 @@ from pitivi.stream import AudioStream, VideoStream
 from pitivi.formatters.base import LoadOnlyFormatter
 from pitivi.timeline.track import Track
 
+
 class PlaylistFormatter(LoadOnlyFormatter):
     """A simple playlist formatter"""
 
@@ -70,7 +71,7 @@ class PlaylistFormatter(LoadOnlyFormatter):
         config.read((filename, ))
         res = []
         for i in range(config.getint('playlist', 'NumberOfEntries')):
-            ln = config.get('playlist', 'File%d' % (i+1))
+            ln = config.get('playlist', 'File%d' % (i + 1))
             val = self.validateSourceURI(self._parseLine(ln))
             # FIXME : if the loading failed, we should insert a blank source
             res.append(val)
diff --git a/pitivi/log/log.py b/pitivi/log/log.py
index 74a3fc1..6cb6cfa 100644
--- a/pitivi/log/log.py
+++ b/pitivi/log/log.py
@@ -95,7 +95,7 @@ def getLevelInt(levelName):
     """
     assert isinstance(levelName, str) and levelName in getLevelNames(), \
         "Bad debug level name"
-    return  getLevelNames().index(levelName)+1
+    return  getLevelNames().index(levelName) + 1
 
 
 def getFormattedLevelName(level):
@@ -134,7 +134,7 @@ def registerCategory(category):
                 continue
             try:
                 level = int(value)
-            except ValueError: # e.g. *; we default to most
+            except ValueError:  # e.g. *; we default to most
                 level = 5
     # store it
     _categories[category] = level
@@ -429,9 +429,7 @@ def stderrHandler(level, object, category, file, line, message):
     # 5 + 1 + 7 + 1 + 32 + 1 + 17 + 1 + 15 == 80
     safeprintf(sys.stderr, '%s [%5d] [0x%12x] %-32s %-17s %-15s %-4s %s %s\n',
                getFormattedLevelName(level), os.getpid(), thread.get_ident(),
-               o[:32], category,
-               time.strftime("%b %d %H:%M:%S")
-               , "", message, where)
+               o[:32], category, time.strftime("%b %d %H:%M:%S"), "", message, where)
     sys.stderr.flush()
 
 
@@ -452,9 +450,9 @@ def _preformatLevels(noColorEnvVarName):
 
         t = termcolor.TerminalController()
         formatter = lambda level: ''.join((t.BOLD, getattr(t, COLORS[level]),
-                            format % (_LEVEL_NAMES[level-1], ), t.NORMAL))
+                            format % (_LEVEL_NAMES[level - 1], ), t.NORMAL))
     else:
-        formatter = lambda level: format % (_LEVEL_NAMES[level-1], )
+        formatter = lambda level: format % (_LEVEL_NAMES[level - 1], )
 
     for level in ERROR, WARN, INFO, DEBUG, LOG:
         _FORMATTED_LEVELS.append(formatter(level))
@@ -722,7 +720,6 @@ class Loggable(object):
        messages under.
     """
 
-
     def writeMarker(self, marker, level):
         """
         Sets a marker that written to the logs. Setting this
@@ -927,10 +924,10 @@ class TwistedLogObserver(Loggable):
     logCategory = "logobserver"
 
     def __init__(self):
-        self._ignoreErrors = [] # Failure types
+        self._ignoreErrors = []  # Failure types
 
     def emit(self, eventDict):
-        method = log # by default, lowest level
+        method = log  # by default, lowest level
         edm = eventDict['message']
         if not edm:
             if eventDict['isError'] and 'failure' in eventDict:
@@ -944,7 +941,7 @@ class TwistedLogObserver(Loggable):
 
                 self.log("Failure %r" % f)
 
-                method = debug # tracebacks from errors at debug level
+                method = debug  # tracebacks from errors at debug level
                 msg = "A twisted traceback occurred."
                 if getCategoryLevel("twisted") < WARN:
                     msg += "  Run with debug level >= 2 to see the traceback."
diff --git a/pitivi/log/loggable.py b/pitivi/log/loggable.py
index 5f9559d..2e3873c 100644
--- a/pitivi/log/loggable.py
+++ b/pitivi/log/loggable.py
@@ -22,6 +22,7 @@
 from pitivi.log.log import _canShortcutLogging, doLog, ERROR
 from pitivi.log import log
 
+
 class Loggable(log.Loggable):
     def __init__(self):
         if not hasattr(self, 'logCategory'):
diff --git a/pitivi/log/termcolor.py b/pitivi/log/termcolor.py
index fb27f1c..ac9f061 100644
--- a/pitivi/log/termcolor.py
+++ b/pitivi/log/termcolor.py
@@ -42,32 +42,32 @@ class TerminalController:
     they will be stored in the `COLS` and `LINES` attributes.
     """
     # Cursor movement:
-    BOL = ''             #: Move the cursor to the beginning of the line
-    UP = ''              #: Move the cursor up one line
-    DOWN = ''            #: Move the cursor down one line
-    LEFT = ''            #: Move the cursor left one char
-    RIGHT = ''           #: Move the cursor right one char
+    BOL = ''             # : Move the cursor to the beginning of the line
+    UP = ''              # : Move the cursor up one line
+    DOWN = ''            # : Move the cursor down one line
+    LEFT = ''            # : Move the cursor left one char
+    RIGHT = ''           # : Move the cursor right one char
 
     # Deletion:
-    CLEAR_SCREEN = ''    #: Clear the screen and move to home position
-    CLEAR_EOL = ''       #: Clear to the end of the line.
-    CLEAR_BOL = ''       #: Clear to the beginning of the line.
-    CLEAR_EOS = ''       #: Clear to the end of the screen
+    CLEAR_SCREEN = ''    # : Clear the screen and move to home position
+    CLEAR_EOL = ''       # : Clear to the end of the line.
+    CLEAR_BOL = ''       # : Clear to the beginning of the line.
+    CLEAR_EOS = ''       # : Clear to the end of the screen
 
     # Output modes:
-    BOLD = ''            #: Turn on bold mode
-    BLINK = ''           #: Turn on blink mode
-    DIM = ''             #: Turn on half-bright mode
-    REVERSE = ''         #: Turn on reverse-video mode
-    NORMAL = ''          #: Turn off all modes
+    BOLD = ''            # : Turn on bold mode
+    BLINK = ''           # : Turn on blink mode
+    DIM = ''             # : Turn on half-bright mode
+    REVERSE = ''         # : Turn on reverse-video mode
+    NORMAL = ''          # : Turn off all modes
 
     # Cursor display:
-    HIDE_CURSOR = ''     #: Make the cursor invisible
-    SHOW_CURSOR = ''     #: Make the cursor visible
+    HIDE_CURSOR = ''     # : Make the cursor invisible
+    SHOW_CURSOR = ''     # : Make the cursor visible
 
     # Terminal size:
-    COLS = None          #: Width of the terminal (None for unknown)
-    LINES = None         #: Height of the terminal (None for unknown)
+    COLS = None          # : Width of the terminal (None for unknown)
+    LINES = None         # : Height of the terminal (None for unknown)
 
     # Foreground colors:
     BLACK = BLUE = GREEN = CYAN = RED = MAGENTA = YELLOW = WHITE = ''
@@ -131,12 +131,12 @@ class TerminalController:
         set_bg = self._tigetstr('setb')
         if set_bg:
             for i, color in zip(range(len(self._COLORS)), self._COLORS):
-                setattr(self, 'BG_'+color, curses.tparm(set_bg, i) or '')
+                setattr(self, 'BG_' + color, curses.tparm(set_bg, i) or '')
         set_bg_ansi = self._tigetstr('setab')
         if set_bg_ansi:
             for i, color in zip(range(len(self._ANSICOLORS)),
                                 self._ANSICOLORS):
-                setattr(self, 'BG_'+color, curses.tparm(set_bg_ansi, i) or '')
+                setattr(self, 'BG_' + color, curses.tparm(set_bg_ansi, i) or '')
 
     def _tigetstr(self, cap_name):
         # String capabilities can include "delays" of the form "$<2>".
@@ -188,17 +188,17 @@ class ProgressBar:
         self.width = self.term.COLS or 75
         self.bar = term.render(self.BAR)
         self.header = self.term.render(self.HEADER % header.center(self.width))
-        self.cleared = 1 #: true if we haven't drawn the bar yet.
+        self.cleared = 1  # : true if we haven't drawn the bar yet.
         self.update(0, '')
 
     def update(self, percent, message):
         if self.cleared:
             sys.stdout.write(self.header)
             self.cleared = 0
-        n = int((self.width-10)*percent)
+        n = int((self.width - 10) * percent)
         sys.stdout.write(
             self.term.BOL + self.term.UP + self.term.CLEAR_EOL +
-            (self.bar % (100*percent, '='*n, '-'*(self.width-10-n))) +
+            (self.bar % (100 * percent, '=' * n, '-' * (self.width - 10 - n))) +
             self.term.CLEAR_EOL + message.center(self.width))
 
     def clear(self):
diff --git a/pitivi/pipeline.py b/pitivi/pipeline.py
index 1e07e89..d05fa34 100644
--- a/pitivi/pipeline.py
+++ b/pitivi/pipeline.py
@@ -38,6 +38,7 @@ import gst
  STATE_PAUSED,
  STATE_PLAYING) = (gst.STATE_NULL, gst.STATE_READY, gst.STATE_PAUSED, gst.STATE_PLAYING)
 
+
 # FIXME : define/document a proper hierarchy
 class PipelineError(Exception):
     pass
@@ -52,6 +53,7 @@ class PipelineError(Exception):
 # Maybe that convenience method could be put in a higher-level module, like the
 # one that handles all the Pipelines existing in the application.
 
+
 class FactoryEntry(object):
     def __init__(self, factory):
         self.factory = factory
@@ -60,6 +62,7 @@ class FactoryEntry(object):
     def __str__(self):
         return "<FactoryEntry %s>" % self.factory
 
+
 class StreamEntry(object):
     def __init__(self, factory_entry, stream, parent=None):
         self.factory_entry = factory_entry
@@ -85,6 +88,7 @@ class StreamEntry(object):
     def __str__(self):
         return "<StreamEntry %s '%s'>" % (self.factory_entry.factory, self.stream)
 
+
 class Pipeline(Signallable, Loggable):
     """
     A container for all multimedia processing.
@@ -123,16 +127,16 @@ class Pipeline(Signallable, Loggable):
     """
 
     __signals__ = {
-        "action-added" : ["action"],
-        "action-removed" : ["action"],
-        "factory-added" : ["factory"],
-        "factory-removed" : ["factory"],
-        "state-changed" : ["state"],
-        "position" : ["position"],
-        "duration-changed" : ["duration"],
-        "unhandled-stream" : ["factory", "stream"],
-        "eos" : [],
-        "error" : ["message", "details"],
+        "action-added": ["action"],
+        "action-removed": ["action"],
+        "factory-added": ["factory"],
+        "factory-removed": ["factory"],
+        "state-changed": ["state"],
+        "position": ["position"],
+        "duration-changed": ["duration"],
+        "unhandled-stream": ["factory", "stream"],
+        "eos": [],
+        "error": ["message", "details"],
         "element-message": ["message"]
         }
 
@@ -146,8 +150,8 @@ class Pipeline(Signallable, Loggable):
         self._bus.set_sync_handler(self._busSyncMessageHandler)
         self.factories = {}
         self.actions = []
-        self._listening = False # for the position handler
-        self._listeningInterval = 300 # default 300ms
+        self._listening = False  # for the position handler
+        self._listeningInterval = 300  # default 300ms
         self._listeningSigId = 0
         self._stream_entry_from_pad = {}
 
@@ -419,14 +423,14 @@ class Pipeline(Signallable, Loggable):
         @raise PipelineError: If seek failed
         """
         if format == gst.FORMAT_TIME:
-            self.debug("position : %s", gst.TIME_ARGS (position))
+            self.debug("position : %s", gst.TIME_ARGS(position))
         else:
             self.debug("position : %d , format:%d", position, format)
         # FIXME : temporarily deactivate position listener
         #self._listenToPosition(False)
 
         # clamp between [0, duration]
-        if format==gst.FORMAT_TIME:
+        if format == gst.FORMAT_TIME:
             position = max(0, min(position, self.getDuration()))
 
         res = self._pipeline.seek(1.0, format, gst.SEEK_FLAG_FLUSH,
@@ -446,7 +450,7 @@ class Pipeline(Signallable, Loggable):
     #{ GStreamer object methods (For Action usage only)
 
     def _getFactoryEntryForStream(self, factory, stream, create=False):
-        self.debug("factory %r, stream %r" , factory, stream)
+        self.debug("factory %r, stream %r", factory, stream)
         try:
             factory_entry = self.factories[factory]
         except KeyError:
@@ -717,7 +721,7 @@ class Pipeline(Signallable, Loggable):
         there are none for the given factory.
         @rtype: C{gst.Element}
         """
-        self.debug("factory %r, stream %r" , factory, stream)
+        self.debug("factory %r, stream %r", factory, stream)
         if not isinstance(factory, SinkFactory):
             raise PipelineError("Given ObjectFactory isn't a SinkFactory")
 
@@ -839,7 +843,7 @@ class Pipeline(Signallable, Loggable):
             self.debug("Duration might have changed, querying it")
             gobject.idle_add(self._queryDurationAsync)
         else:
-            self.info("%s [%r]" , message.type, message.src)
+            self.info("%s [%r]", message.type, message.src)
 
     def _queryDurationAsync(self, *args, **kwargs):
         try:
@@ -918,7 +922,6 @@ class Pipeline(Signallable, Loggable):
             self.debug("Done handling new pad")
             self._lock.release()
 
-
     def _binPadRemovedCb(self, bin, pad):
         self._lock.acquire()
         try:
diff --git a/pitivi/pitivigstutils.py b/pitivi/pitivigstutils.py
index ac59732..99fc67f 100644
--- a/pitivi/pitivigstutils.py
+++ b/pitivi/pitivigstutils.py
@@ -30,20 +30,24 @@ import gst.interfaces
 import gst.audio
 import gst.video
 
+
 def fraction_float(frac):
     """ override for gst.Fraction.__float__ """
     return float(frac.num) / float(frac.denom)
 
+
 def fraction_eq(frac, other):
     """ override for gst.Fraction.__eq__ """
     if isinstance(other, gst.Fraction):
         return frac.num * other.denom == frac.denom * other.num
     return False
 
+
 def fraction_ne(frac, other):
     """ override for gst.Fraction.__ne__ """
     return not fraction_eq(frac, other)
 
+
 def fraction_mul(frac, other):
     """ override for gst.Fraction.__mul__ """
     if isinstance(other, gst.Fraction):
@@ -55,6 +59,7 @@ def fraction_mul(frac, other):
         return float(frac.num) * other / float(frac.denom)
     raise TypeError
 
+
 def fraction_div(frac, other):
     """ override for gst.Fraction.__div__ """
     if isinstance(other, int):
@@ -63,6 +68,7 @@ def fraction_div(frac, other):
         return float(frac.num) / (other * float(frac.denom))
     return TypeError
 
+
 def patch_gst_python():
     """ override gst.Fraction methods not available in all gst-python """
     gst.Fraction.__float__ = fraction_float
diff --git a/pitivi/plugincore.py b/pitivi/plugincore.py
index bd0825c..b350609 100644
--- a/pitivi/plugincore.py
+++ b/pitivi/plugincore.py
@@ -25,6 +25,7 @@ from zope.interface import Interface, Attribute
 PiTiVi plugin system
 """
 
+
 # Interfaces
 class IPlugin(Interface):
     """ Every plugin must implement this interface """
@@ -41,37 +42,45 @@ class IPlugin(Interface):
     def __call__(self):
         """ Initialize the plugin passing a reference to the plugin manager """
 
+
 class IConfigurable(Interface):
     """Allow user customization of plugin settings """
 
     def configure(self):
         """ Display preferences dialog """
 
+
 class IUpdateSettings(Interface):
     """ Allow importing settings from different versions of the plugin """
 
     def update_settings(self):
         """ import settings from a different version """
 
+
 # Exceptions
 class PluginError(Exception):
     pass
 
+
 class InvalidPluginError(PluginError):
     def __init__(self, filename):
         self.filename = filename
 
+
 class InvalidPluginClassError(InvalidPluginError):
     pass
 
+
 class IPluginNotImplementedError(InvalidPluginError):
     pass
 
+
 class DuplicatePluginError(PluginError):
     def __init__(self, old_plugin, new_plugin):
         self.old_plugin = old_plugin
         self.new_plugin = new_plugin
 
+
 class RemovePluginError(PluginError):
     def __init__(self, filename):
         self.filename = filename
diff --git a/pitivi/plumber.py b/pitivi/plumber.py
index 822ef2c..de18db4 100644
--- a/pitivi/plumber.py
+++ b/pitivi/plumber.py
@@ -35,6 +35,7 @@ import gst
 from gst import interfaces
 from pitivi.factories.base import SinkFactory
 
+
 class DefaultVideoSink(SinkFactory):
 
     def __init__(self, *args, **kwargs):
@@ -111,6 +112,7 @@ class DefaultVideoSink(SinkFactory):
             self._realsink.props.sync = self.sync
             self._realsink.props.qos = self.sync
 
+
 class DefaultAudioSink(SinkFactory):
 
     def __init__(self, *args, **kwargs):
@@ -132,7 +134,7 @@ class DefaultAudioSink(SinkFactory):
         self._realsink.props.sync = self.sync
 
         audiosink = gst.Bin("pitivi-audiosink")
-        aconv = gst.element_factory_make("audioconvert","audiobin-convert")
+        aconv = gst.element_factory_make("audioconvert", "audiobin-convert")
         ares = gst.element_factory_make("audioresample", "audiobin-resample")
 
         audiosink.add(aconv, ares, autoaudiosink)
@@ -162,6 +164,7 @@ class DefaultAudioSink(SinkFactory):
         if self._realsink:
             self._realsink.props.sync = self.sync
 
+
 def find_recursive_element(bin, typ):
     if not isinstance(bin, gst.Bin):
         if isinstance(bin, typ):
diff --git a/pitivi/project.py b/pitivi/project.py
index 45f9b79..f68da48 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -34,10 +34,12 @@ from pitivi.action import ViewAction
 from pitivi.utils import Seeker
 import gst
 
+
 class ProjectError(Exception):
     """Project error"""
     pass
 
+
 class Project(Signallable, Loggable):
     """The base class for PiTiVi projects
 
@@ -63,8 +65,8 @@ class Project(Signallable, Loggable):
     """
 
     __signals__ = {
-        "settings-changed" : ['old', 'new'],
-        "project-changed" : [],
+        "settings-changed": ['old', 'new'],
+        "project-changed": [],
         }
 
     def __init__(self, name="", uri=None, **kwargs):
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index e3498ba..6048cd2 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -37,6 +37,7 @@ from pitivi.stream import AudioStream, VideoStream
 from pitivi.timeline.track import Track
 from pitivi.undo import UndoableAction
 
+
 class ProjectSettingsChanged(UndoableAction):
 
     def __init__(self, project, old, new):
@@ -52,6 +53,7 @@ class ProjectSettingsChanged(UndoableAction):
         self.project.setSettings(self.oldsettings)
         self._undone()
 
+
 class ProjectLogObserver(UndoableAction):
 
     def __init__(self, log):
@@ -69,6 +71,7 @@ class ProjectLogObserver(UndoableAction):
         self.log.push(action)
         self.log.commit()
 
+
 class ProjectManager(Signallable, Loggable):
     __signals__ = {
         "new-project-loading": ["uri"],
@@ -80,7 +83,7 @@ class ProjectManager(Signallable, Loggable):
         "closing-project": ["project"],
         "project-closed": ["project"],
         "missing-uri": ["formatter", "uri", "factory"],
-        "reverting-to-saved":["project"],
+        "reverting-to-saved": ["project"],
     }
 
     def __init__(self, avalaible_effects={}):
diff --git a/pitivi/receiver.py b/pitivi/receiver.py
index f044777..d4e0a35 100644
--- a/pitivi/receiver.py
+++ b/pitivi/receiver.py
@@ -1,10 +1,12 @@
 from types import MethodType
 
+
 class _receiver_data(object):
 
     sender = None
     sigids = None
 
+
 class receiver(object):
 
     """A descriptor which wrapps signal connect and disconnect for a single
@@ -26,7 +28,7 @@ class receiver(object):
     def __set__(self, instance, value):
         if not hasattr(instance, "_receiver_data"):
             instance._receiver_data = {}
-        if not instance._receiver_data.has_key(self):
+        if not self in instance._receiver_data:
             instance._receiver_data[self] = _receiver_data()
             instance._receiver_data[self].sigids = {}
         rd = instance._receiver_data[self]
@@ -51,6 +53,7 @@ class receiver(object):
     def add_handler(self, signal, hdlr):
         self.handlers[signal] = hdlr
 
+
 def handler(prop, signal):
 
     """A decorator which registers a given function as a signal handler for
diff --git a/pitivi/reflect.py b/pitivi/reflect.py
index ec81284..fe5b3aa 100644
--- a/pitivi/reflect.py
+++ b/pitivi/reflect.py
@@ -6,6 +6,7 @@
 
 import sys
 
+
 def namedModule(name):
     """Return a module given its name."""
     topLevel = __import__(name)
@@ -23,7 +24,8 @@ def namedObject(name):
     module = namedModule('.'.join(classSplit[:-1]))
     return getattr(module, classSplit[-1])
 
-namedClass = namedObject # backwards compat
+#namedClass = namedObject  # backwards compat
+
 
 class _NoModuleFound(Exception):
     """
@@ -72,8 +74,8 @@ def _importAndCheckStack(importName):
             excType, excValue, excTraceback = sys.exc_info()
             while excTraceback:
                 execName = excTraceback.tb_frame.f_globals["__name__"]
-                if (execName is None or # python 2.4+, post-cleanup
-                    execName == importName): # python 2.3, no cleanup
+                if (execName is None or  # python 2.4+, post-cleanup
+                    execName == importName):  # python 2.3, no cleanup
                     raise excType, excValue, excTraceback
                 excTraceback = excTraceback.tb_next
             raise _NoModuleFound()
@@ -83,7 +85,6 @@ def _importAndCheckStack(importName):
         raise
 
 
-
 def namedAny(name):
     """
     Retrieve a Python object by its fully qualified name from the global Python
@@ -146,6 +147,7 @@ def namedAny(name):
 
     return obj
 
+
 def qual(clazz):
     """Return full import path of a class."""
     return clazz.__module__ + '.' + clazz.__name__
diff --git a/pitivi/settings.py b/pitivi/settings.py
index 709ea01..5350900 100644
--- a/pitivi/settings.py
+++ b/pitivi/settings.py
@@ -43,6 +43,7 @@ if platform.system() == 'Windows':
 else:
     HOME = 'HOME'
 
+
 def get_bool_env(var):
     value = os.getenv(var)
     if not value:
@@ -55,6 +56,7 @@ def get_bool_env(var):
     else:
         return bool(value)
 
+
 def get_env_by_type(type_, var):
     """
     Returns the environment variable.
@@ -76,44 +78,56 @@ def get_env_by_type(type_, var):
             return type_(os.getenv(var))
         return None
 
+
 def get_env_default(var, default):
     value = os.getenv(var)
     if value:
         return value
     return default
 
+
 def get_dir(path, autocreate=True):
     if autocreate and not os.path.exists(path):
         os.makedirs(path)
     return path
 
+
 def get_dirs(glob):
     return [d for d in glob.split(os.path.pathsep) if os.path.exists(d)]
 
+
 def get_env_dir(var, default, autocreate=True):
     return get_dir(get_env_default(var, default))
 
+
 def get_env_dirs(var, default):
     return get_dirs(get_env_default(var, default))
 
+
 def xdg_config_home(autocreate=True):
     return get_dir(xdg_dirs.xdg_config_home, autocreate)
 
+
 def xdg_data_home(autocreate=True):
     return get_dir(xdg_dirs.xdg_data_home, autocreate)
 
+
 def xdg_cache_home(autocreate=True):
     return get_dir(xdg_dirs.xdg_cache_home, autocreate)
 
+
 def xdg_data_dirs():
     return get_env_dirs(xdg_dirs.xdg_data_dirs)
 
+
 def xdg_config_dirs():
     return get_env_dirs(xdg_dirs.xdg_config_dirs)
 
+
 class ConfigError(Exception):
     pass
 
+
 class Notification(object):
 
     """A descriptor to help with the implementation of signals"""
@@ -129,6 +143,7 @@ class Notification(object):
         setattr(instance, self.attrname, value)
         instance.emit(self.signame)
 
+
 class GlobalSettings(Signallable):
     """
     Global PiTiVi settings.
@@ -363,6 +378,7 @@ class GlobalSettings(Signallable):
             raise ConfigError("Duplicate Section \"%s\"." % section)
         cls.options[section] = {}
 
+
 class StreamEncodeSettings(object):
     """
     Settings for encoding a L{MultimediaStream}.
@@ -417,6 +433,7 @@ class StreamEncodeSettings(object):
     def __str__(self):
         return "<StreamEncodeSettings %s>" % self.encoder
 
+
 class RenderSettings(object):
     """
     Settings for rendering and multiplexing one or multiple streams.
@@ -437,6 +454,7 @@ class RenderSettings(object):
     def __str__(self):
         return "<RenderSettings %s [%d streams]>" % (self.muxer, len(self.settings))
 
+
 class ExportSettings(Signallable, Loggable):
     """
     Multimedia export settings
@@ -450,8 +468,8 @@ class ExportSettings(Signallable, Loggable):
     @type render_scale: int
     """
     __signals__ = {
-        "settings-changed" : None,
-        "encoders-changed" : None,
+        "settings-changed": None,
+        "encoders-changed": None,
         }
 
     # Audio/Video settings for processing/export
@@ -507,7 +525,7 @@ class ExportSettings(Signallable, Loggable):
         msg = _("Export Settings\n")
         msg += _("Video: ") + str(self.videowidth) + " " + str(self.videoheight) +\
                " " + str(self.videorate) + " " + str(self.videopar)
-        msg += "\n\t" + str(self.vencoder) + " " +str(self.vcodecsettings)
+        msg += "\n\t" + str(self.vencoder) + " " + str(self.vcodecsettings)
         msg += _("\nAudio: ") + str(self.audiochannels) + " " + str(self.audiorate) +\
                " " + str(self.audiodepth)
         msg += "\n\t" + str(self.aencoder) + " " + str(self.acodecsettings)
@@ -638,6 +656,7 @@ class ExportSettings(Signallable, Loggable):
         muxer """
         return self.vencoders[self.muxer]
 
+
 def export_settings_to_render_settings(export,
         have_video=True, have_audio=True):
     """Convert the specified ExportSettings object to a RenderSettings object.
diff --git a/pitivi/signalgroup.py b/pitivi/signalgroup.py
index 9188bab..d2e99e1 100644
--- a/pitivi/signalgroup.py
+++ b/pitivi/signalgroup.py
@@ -25,6 +25,7 @@ A group of signals, which can be disconnected easily.
 Used to make it easy to keep signals attached to the current project.
 """
 
+
 class SignalGroup:
     def __init__(self):
         self.signal_handler_ids = {}
@@ -73,7 +74,6 @@ class SignalGroup:
             old_object.disconnect(handler_id)
         self.signal_handler_ids = {}
 
-
     def disconnectForObject(self, obj):
         """
         Disconnects all signal in the group connect on the given object
diff --git a/pitivi/signalinterface.py b/pitivi/signalinterface.py
index 9692f8b..9b895c4 100644
--- a/pitivi/signalinterface.py
+++ b/pitivi/signalinterface.py
@@ -31,6 +31,7 @@ Interfaces for event-based programming
 
 from random import randint
 
+
 class Signallable(object):
     """
     Signallable interface
@@ -68,9 +69,9 @@ class Signallable(object):
             if not callable(cb):
                 raise Exception("Provided callable '%r' is not callable" % cb)
 
-            uuid = randint(0, 2**64)
+            uuid = randint(0, 2 ** 64)
             while uuid in self.ids:
-                uuid = randint(0, 2**64)
+                uuid = randint(0, 2 ** 64)
 
             self.ids[uuid] = (cb, args, kwargs)
             self.callback_ids.setdefault(cb, []).append(uuid)
@@ -119,10 +120,9 @@ class Signallable(object):
                 res = cb(*ar, **kw)
             return res
 
-
     # key : name (string)
     # value : signature (list of any strings)
-    __signals__ = { }
+    __signals__ = {}
 
     def emit(self, signame, *args, **kwargs):
         """
diff --git a/pitivi/sourcelist.py b/pitivi/sourcelist.py
index 344db04..05e9022 100644
--- a/pitivi/sourcelist.py
+++ b/pitivi/sourcelist.py
@@ -29,9 +29,11 @@ from pitivi.discoverer import Discoverer
 from pitivi.signalinterface import Signallable
 from pitivi.log.loggable import Loggable
 
+
 class SourceListError(Exception):
     pass
 
+
 class SourceList(Signallable, Loggable):
     discovererClass = Discoverer
 
@@ -52,12 +54,12 @@ class SourceList(Signallable, Loggable):
     """
 
     __signals__ = {
-        "ready" : [],
-        "starting" : [],
+        "ready": [],
+        "starting": [],
         "missing-plugins": ["uri", "factory", "details", "descriptions"],
-        "source-added" : ["factory"],
-        "source-removed" : ["uri"],
-        "discovery-error" : ["uri", "reason"],
+        "source-added": ["factory"],
+        "source-removed": ["uri"],
+        "discovery-error": ["uri", "reason"],
         }
 
     def __init__(self):
@@ -76,7 +78,6 @@ class SourceList(Signallable, Loggable):
         self.discoverer.connect("missing-plugins",
                 self._discovererMissingPluginsCb)
 
-
     def addUri(self, uri):
         """
         Add c{uri} to the source list.
diff --git a/pitivi/sourcelist_undo.py b/pitivi/sourcelist_undo.py
index c2bc2b6..29bd096 100644
--- a/pitivi/sourcelist_undo.py
+++ b/pitivi/sourcelist_undo.py
@@ -21,6 +21,7 @@
 
 from pitivi.undo import UndoableAction
 
+
 class SourceListSourceAddedAction(UndoableAction):
     def __init__(self, sourcelist, source):
         self.sourcelist = sourcelist
@@ -34,6 +35,7 @@ class SourceListSourceAddedAction(UndoableAction):
         self.sourcelist.addFactory(self.source)
         self._done()
 
+
 class SourceListSourceRemovedAction(UndoableAction):
     def __init__(self, sourcelist, uri, source):
         self.sourcelist = sourcelist
@@ -48,6 +50,7 @@ class SourceListSourceRemovedAction(UndoableAction):
         self.sourcelist.removeUri(self.source.uri)
         self._done()
 
+
 class SourceListLogObserver(object):
     def __init__(self, log):
         self.log = log
diff --git a/pitivi/stream.py b/pitivi/stream.py
index a8e3153..bedf454 100644
--- a/pitivi/stream.py
+++ b/pitivi/stream.py
@@ -33,6 +33,7 @@ STREAM_MATCH_COMPATIBLE_CAPS = 20
 STREAM_MATCH_SAME_TYPE = 10
 STREAM_MATCH_NONE = 0
 
+
 class MultimediaStream(Loggable):
     """
     Defines a media stream
@@ -98,6 +99,7 @@ class MultimediaStream(Loggable):
     def __str__(self):
         return "<%s(%s) '%s'>" % (self.__class__.__name__, self.pad_name, self.caps)
 
+
 class VideoStream(MultimediaStream):
     """
     Video Stream
@@ -175,6 +177,7 @@ class VideoStream(MultimediaStream):
                     self.format == gst.Fourcc('AYUV'))
         return False
 
+
 class AudioStream(MultimediaStream):
     """
     Audio stream
@@ -215,6 +218,7 @@ class AudioStream(MultimediaStream):
         if self.width and not self.depth:
             self.depth = self.width
 
+
 class TextStream(MultimediaStream):
     """
     Text media stream
@@ -223,6 +227,7 @@ class TextStream(MultimediaStream):
     def _analyzeCaps(self):
         self.texttype = self.caps[0].get_name()
 
+
 def find_decoder(pad):
     decoder = None
     while pad is not None:
@@ -248,6 +253,7 @@ def find_decoder(pad):
 
     return decoder
 
+
 def find_upstream_demuxer_and_pad(pad):
     while pad:
         if pad.props.direction == gst.PAD_SRC \
@@ -292,8 +298,9 @@ def find_upstream_demuxer_and_pad(pad):
 
     return None, None
 
+
 def get_type_from_decoder(decoder):
-    log.debug("stream","%r" % decoder)
+    log.debug("stream", "%r" % decoder)
     klass = decoder.get_factory().get_klass()
     parts = klass.split('/', 2)
     if len(parts) != 3:
@@ -301,6 +308,7 @@ def get_type_from_decoder(decoder):
 
     return parts[2].lower()
 
+
 def get_pad_type(pad):
     decoder = find_decoder(pad)
     if decoder:
@@ -312,6 +320,7 @@ def get_pad_type(pad):
 
     return caps[0].get_name().split('/', 1)[0]
 
+
 def get_pad_id(pad):
     lst = []
     while pad:
@@ -327,12 +336,13 @@ def get_pad_id(pad):
 
     return lst
 
+
 def get_stream_for_caps(caps, pad=None):
     """
     Returns the appropriate MediaStream corresponding to the
     given caps.
     """
-    log.debug("stream","caps:%s, pad:%r" % (caps.to_string(), pad))
+    log.debug("stream", "caps:%s, pad:%r" % (caps.to_string(), pad))
     # FIXME : we should have an 'unknown' data stream class
     ret = None
 
@@ -343,7 +353,7 @@ def get_stream_for_caps(caps, pad=None):
         pad_name = None
         stream_type = caps[0].get_name().split('/', 1)[0]
 
-    log.debug("stream","stream_type:%s" % stream_type)
+    log.debug("stream", "stream_type:%s" % stream_type)
     if stream_type in ('video', 'image'):
         ret = VideoStream(caps, pad_name, stream_type == 'image')
     elif stream_type == 'audio':
@@ -352,6 +362,7 @@ def get_stream_for_caps(caps, pad=None):
         ret = TextStream(caps, pad_name)
     return ret
 
+
 def get_stream_for_pad(pad, store_pad=False):
     log.debug("stream", "pad:%r")
     caps = pad.props.caps
@@ -365,6 +376,7 @@ def get_stream_for_pad(pad, store_pad=False):
 
     return stream
 
+
 def pad_compatible_stream(pad, stream):
     """
     Checks whether the given pad is compatible with the given stream.
@@ -376,7 +388,7 @@ def pad_compatible_stream(pad, stream):
     @return: Whether the pad is compatible with the given stream
     @rtype: C{bool}
     """
-    log.debug("stream","pad:%r, stream:%r" % (pad, stream))
+    log.debug("stream", "pad:%r, stream:%r" % (pad, stream))
     if stream == None:
         # yes, None is the magical stream that takes everything
         return True
@@ -385,6 +397,7 @@ def pad_compatible_stream(pad, stream):
         return not stream.caps.intersect(pad.get_caps()).is_empty()
     raise Exception("Can't figure out compatibility since the stream doesn't have any caps")
 
+
 def get_pads_for_stream(element, stream):
     """
     Fetches the pads of the given element which are compatible with the given
@@ -397,7 +410,7 @@ def get_pads_for_stream(element, stream):
     @return: The compatible pads
     @rtype: List of C{gst.Pad}
     """
-    log.debug("stream","element:%r, stream:%r" % (element, stream))
+    log.debug("stream", "element:%r, stream:%r" % (element, stream))
     while True:
         try:
             ls = [x for x in element.pads() if pad_compatible_stream(x, stream)]
@@ -411,6 +424,7 @@ def get_pads_for_stream(element, stream):
         return [x for x in ls if x.get_name() == stream.pad_name]
     return ls
 
+
 def get_src_pads_for_stream(element, stream):
     """
     Fetches the source pads of the given element which are compatible with the
@@ -425,6 +439,7 @@ def get_src_pads_for_stream(element, stream):
     """
     return [x for x in get_pads_for_stream(element, stream) if x.get_direction() == gst.PAD_SRC]
 
+
 def get_sink_pads_for_stream(element, stream):
     """
     Fetches the sink pads of the given element which are compatible with the
@@ -439,6 +454,7 @@ def get_sink_pads_for_stream(element, stream):
     """
     return [x for x in get_pads_for_stream(element, stream) if x.get_direction() == gst.PAD_SINK]
 
+
 def stream_compare(stream_a, stream_b):
     """
     Compare two streams.
@@ -462,6 +478,7 @@ def stream_compare(stream_a, stream_b):
 
     return current_rank
 
+
 def match_stream(stream, stream_list):
     """
     Get the stream contained in stream_list that best matches the given stream.
@@ -477,6 +494,7 @@ def match_stream(stream, stream_list):
 
     return best_stream, best_rank
 
+
 class StreamGroupWalker(object):
     """
     Utility class used to match two groups of streams.
@@ -528,6 +546,7 @@ class StreamGroupWalker(object):
 
         return matches
 
+
 def match_stream_groups(group_a, group_b):
     """
     Match two groups of streams.
@@ -559,6 +578,7 @@ def match_stream_groups(group_a, group_b):
 
     return best_map
 
+
 def match_stream_groups_map(group_a, group_b):
     stream_map = match_stream_groups(group_a, group_b)
     return dict(stream_map.keys())
diff --git a/pitivi/threads.py b/pitivi/threads.py
index b1d1de2..5b65b0b 100644
--- a/pitivi/threads.py
+++ b/pitivi/threads.py
@@ -31,13 +31,14 @@ from pitivi.log.loggable import Loggable
 #   John Stowers <john stowers gmail com>
 #
 
+
 class Thread(threading.Thread, Signallable, Loggable):
     """
     Event-powered thread
     """
 
     __signals__ = {
-        "done" : None
+        "done": None
         }
 
     def __init__(self):
@@ -62,8 +63,8 @@ class Thread(threading.Thread, Signallable, Loggable):
         """ Abort the thread. Subclass have to implement this method ! """
         pass
 
-class CallbackThread(Thread):
 
+class CallbackThread(Thread):
     def __init__(self, callback, *args, **kwargs):
         self.callback = callback
         self.args = args
@@ -73,6 +74,7 @@ class CallbackThread(Thread):
     def process(self):
         self.callback(*self.args, **self.kwargs)
 
+
 class ThreadMaster(Loggable):
     """
     Controls all thread existing in pitivi
diff --git a/pitivi/thumbnailcache.py b/pitivi/thumbnailcache.py
index 68be22c..eb0222d 100644
--- a/pitivi/thumbnailcache.py
+++ b/pitivi/thumbnailcache.py
@@ -25,6 +25,7 @@ Dictionary-Like object for caching of thumbnails.
 
 import collections
 
+
 class ThumbnailCache(object):
 
     """Caches thumbnails by key using LRU policy, implemented with heapq"""
diff --git a/pitivi/timeline/gap.py b/pitivi/timeline/gap.py
index 72c3e2d..5f25af2 100644
--- a/pitivi/timeline/gap.py
+++ b/pitivi/timeline/gap.py
@@ -21,6 +21,7 @@
 
 from pitivi.utils import infinity
 
+
 class Gap(object):
     def __init__(self, left_object, right_object, start, duration):
         self.left_object = left_object
@@ -111,11 +112,13 @@ class Gap(object):
                 (self.left_object.start + self.left_object.duration)
         return res
 
+
 class InvalidGap(object):
     pass
 
 invalid_gap = InvalidGap()
 
+
 class SmallestGapsFinder(object):
     def __init__(self, internal_objects):
         self.left_gap = None
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 5bd21c5..0c26ec4 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -43,10 +43,12 @@ SELECT_ADD = 2
 SELECT_BETWEEN = 3
 """Select a range of clips"""
 
+
 class TimelineError(Exception):
     """Base Exception for errors happening in L{Timeline}s or L{TimelineObject}s"""
     pass
 
+
 class TimelineObject(Signallable, Loggable):
     """
     Base class for contents of a C{Timeline}.
@@ -88,7 +90,7 @@ class TimelineObject(Signallable, Loggable):
         'out-point-changed': ['in-point'],
         'media-duration-changed': ['media-duration'],
         'priority-changed': ['priority'],
-        'selected-changed' : ['state'],
+        'selected-changed': ['state'],
         'track-object-added': ["track_object"],
         'track-object-removed': ["track_object"],
     }
@@ -444,6 +446,7 @@ class TimelineObject(Signallable, Loggable):
 
         self.emit("track-object-removed", obj)
 
+
 class Selection(Signallable):
     """
     A collection of L{TimelineObject}.
@@ -456,7 +459,7 @@ class Selection(Signallable):
     """
 
     __signals__ = {
-        "selection-changed" : []
+        "selection-changed": []
     }
 
     def __init__(self):
@@ -558,7 +561,6 @@ class LinkEntry(object):
         self.duration = duration
 
 
-
 class LinkPropertyChangeTracker(PropertyChangeTracker):
     """
     Tracker for private usage by L{Link}
@@ -572,6 +574,7 @@ class LinkPropertyChangeTracker(PropertyChangeTracker):
 
     property_names = ('start', 'duration')
 
+
 class Link(object):
 
     def __init__(self):
@@ -660,6 +663,7 @@ class Link(object):
         else:
             self.waiting_update.remove(timeline_object)
 
+
 # FIXME: This seems overly complicated and (therefore) a potential speed bottleneck.
 # It would be much simpler to just track objects, and specify for each object
 # which property we would like to track (start, end, both). We could then have
@@ -919,6 +923,7 @@ class TimelineEdges(object):
             return self.by_start[end]
         return []
 
+
 class EditingContext(object):
 
     DEFAULT = 0
@@ -1218,7 +1223,7 @@ class MoveContext(EditingContext):
         if len(self.timeline_objects) == 1:
             if not self._overlapsAreTransitions(focus_timeline_object,
                 priority):
-                self._defaultTo (initial_position, initial_priority)
+                self._defaultTo(initial_position, initial_priority)
             EditingContext.finish(self)
             return
 
@@ -1238,7 +1243,6 @@ class MoveContext(EditingContext):
                 else:
                     priority += 1
 
-
                 self._defaultTo(final_position, priority)
             else:
                 overlap = False
@@ -1269,7 +1273,7 @@ class MoveContext(EditingContext):
         position = max(self.min_position, position)
 
         self.focus.priority = priority
-        self.focus.setStart(position, snap = self._snap)
+        self.focus.setStart(position, snap=self._snap)
 
         for obj, (s_offset, p_offset) in self.offsets.iteritems():
             obj.setStart(position + s_offset)
@@ -1313,6 +1317,7 @@ class MoveContext(EditingContext):
 
         return position, priority
 
+
 class TrimStartContext(EditingContext):
 
     def __init__(self, timeline, focus, other):
@@ -1390,8 +1395,8 @@ class TrimStartContext(EditingContext):
             self._defaultTo(position, self.focus.priority)
         EditingContext.finish(self)
 
-class TrimEndContext(EditingContext):
 
+class TrimEndContext(EditingContext):
     def __init__(self, timeline, focus, other):
         EditingContext.__init__(self, timeline, focus, other)
         self.adjacent = timeline.edges.getObjsAdjacentToEnd(focus)
@@ -1466,6 +1471,7 @@ class TrimEndContext(EditingContext):
             duration = absolute_initial_duration + right_gap.duration
             self._defaultTo(duration, self.focus.priority)
 
+
 class Timeline(Signallable, Loggable):
     """
     Top-level container for L{TimelineObject}s.
@@ -1561,7 +1567,7 @@ class Timeline(Signallable, Loggable):
             self.duration = duration
             self.emit('duration-changed', duration)
 
-    def updateVideoCaps(self, caps= None):
+    def updateVideoCaps(self, caps=None):
         if caps:
             self._video_caps = caps
 
@@ -1752,7 +1758,7 @@ class Timeline(Signallable, Loggable):
             listTimelineObjectTrackObject.append((obj, copy_track_obj))
 
         self.debug("%s", ["TimelineObject %s => Track object: %s |"\
-                           %(listTo[0], listTo[1])\
+                           % (listTo[0], listTo[1])\
                            for listTo in listTimelineObjectTrackObject])
         return listTimelineObjectTrackObject
 
@@ -2061,7 +2067,7 @@ class Timeline(Signallable, Loggable):
                 break
 
         keyframe_positions = self._getKeyframePositions(tl_objs)
-        for n in range(len(keyframe_positions) -1, -1, -1):
+        for n in range(len(keyframe_positions) - 1, -1, -1):
             if keyframe_positions[n] < time:
                 return keyframe_positions[n]
         return None
diff --git a/pitivi/timeline/timeline_undo.py b/pitivi/timeline/timeline_undo.py
index 5b63e22..d9a5ede 100644
--- a/pitivi/timeline/timeline_undo.py
+++ b/pitivi/timeline/timeline_undo.py
@@ -29,6 +29,7 @@ from pitivi.timeline.track import TrackEffect
 from pitivi.ui.effectsconfiguration import PROPS_TO_IGNORE
 from pitivi.effects import EffectGstElementPropertyChangeTracker
 
+
 class TimelineObjectPropertyChangeTracker(PropertyChangeTracker):
     # no out-point
     property_names = ["start", "duration", "in-point",
@@ -61,6 +62,7 @@ class TimelineObjectPropertyChangeTracker(PropertyChangeTracker):
             PropertyChangeTracker._propertyChangedCb(self,
                     timeline_object, value, property_name)
 
+
 class KeyframeChangeTracker(Signallable):
     __signals__ = {
         "keyframe-moved": ["keyframe"]
@@ -105,6 +107,7 @@ class KeyframeChangeTracker(Signallable):
     def _getKeyframeSnapshot(self, keyframe):
         return (keyframe.mode, keyframe.time, keyframe.value)
 
+
 class TimelineObjectPropertyChanged(UndoableAction):
     def __init__(self, timeline_object, property_name, old_value, new_value):
         self.timeline_object = timeline_object
@@ -122,6 +125,7 @@ class TimelineObjectPropertyChanged(UndoableAction):
                 self.property_name.replace("-", "_"), self.old_value)
         self._undone()
 
+
 class TimelineObjectAdded(UndoableAction):
     def __init__(self, timeline, timeline_object):
         self.timeline = timeline
@@ -140,6 +144,7 @@ class TimelineObjectAdded(UndoableAction):
         self.timeline.removeTimelineObject(self.timeline_object, deep=True)
         self._undone()
 
+
 class TimelineObjectRemoved(UndoableAction):
     def __init__(self, timeline, timeline_object):
         self.timeline = timeline
@@ -159,6 +164,7 @@ class TimelineObjectRemoved(UndoableAction):
 
         self._undone()
 
+
 class TrackEffectAdded(UndoableAction):
     # Note: We have a bug if we just remove the TrackEffect from the timeline
     # and keep it saved here and then readd it to corresponding timeline (it
@@ -195,12 +201,12 @@ class TrackEffectAdded(UndoableAction):
 
     def undo(self):
         element = self.track_object.getElement()
-        props =  gobject.list_properties(element)
+        props = gobject.list_properties(element)
         self.effect_props = [(prop.name, element.get_property(prop.name))
                               for prop in props
                               if prop.flags & gobject.PARAM_WRITABLE
                               and prop.name not in PROPS_TO_IGNORE]
-        gnl_props =  gobject.list_properties(self.track_object.gnl_object)
+        gnl_props = gobject.list_properties(self.track_object.gnl_object)
         gnl_obj = self.track_object.gnl_object
         self.gnl_obj_props = [(prop.name, gnl_obj.get_property(prop.name))
                               for prop in gnl_props
@@ -215,6 +221,7 @@ class TrackEffectAdded(UndoableAction):
 
         self._undone()
 
+
 class TrackEffectRemoved(UndoableAction):
     def __init__(self, timeline_object, track_object, properties_watcher):
         self.track_object = track_object
@@ -227,13 +234,13 @@ class TrackEffectRemoved(UndoableAction):
 
     def do(self):
         element = self.track_object.getElement()
-        props =  gobject.list_properties(element)
+        props = gobject.list_properties(element)
         self.effect_props = [(prop.name, element.get_property(prop.name))
                               for prop in props
                               if prop.flags & gobject.PARAM_WRITABLE
                               and prop.name not in PROPS_TO_IGNORE]
 
-        gnl_props =  gobject.list_properties(self.track_object.gnl_object)
+        gnl_props = gobject.list_properties(self.track_object.gnl_object)
         gnl_obj = self.track_object.gnl_object
         self.gnl_obj_props = [(prop.name, gnl_obj.get_property(prop.name))
                               for prop in gnl_props
@@ -265,6 +272,7 @@ class TrackEffectRemoved(UndoableAction):
 
         self._undone()
 
+
 class InterpolatorKeyframeAdded(UndoableAction):
     def __init__(self, track_object, keyframe):
         self.track_object = track_object
@@ -278,6 +286,7 @@ class InterpolatorKeyframeAdded(UndoableAction):
         self.track_object.removeKeyframe(self.keyframe)
         self._undone()
 
+
 class InterpolatorKeyframeRemoved(UndoableAction):
     def __init__(self, track_object, keyframe):
         self.track_object = track_object
@@ -292,6 +301,7 @@ class InterpolatorKeyframeRemoved(UndoableAction):
                 self.keyframe.value, self.keyframe.mode)
         self._done()
 
+
 class InterpolatorKeyframeChanged(UndoableAction):
     def __init__(self, track_object, keyframe, old_snapshot, new_snapshot):
         self.track_object = track_object
@@ -313,6 +323,7 @@ class InterpolatorKeyframeChanged(UndoableAction):
         self.keyframe.setTime(time)
         self.keyframe.setValue(value)
 
+
 class ActivePropertyChanged(UndoableAction):
     def __init__(self, effect_action, active):
         self.effect_action = effect_action
@@ -328,6 +339,7 @@ class ActivePropertyChanged(UndoableAction):
         self.active = not self.active
         self._undone()
 
+
 class TimelineLogObserver(object):
     timelinePropertyChangedAction = TimelineObjectPropertyChanged
     timelineObjectAddedAction = TimelineObjectAdded
@@ -399,7 +411,7 @@ class TimelineLogObserver(object):
         for prop, interpolator in track_object.getInterpolators().itervalues():
             self._connectToInterpolator(interpolator)
         if isinstance(track_object, TrackEffect):
-            self.effect_properties_tracker.addEffectElement (track_object.getElement())
+            self.effect_properties_tracker.addEffectElement(track_object.getElement())
 
     def _disconnectFromTrackObject(self, track_object):
         for prop, interpolator in track_object.getInterpolators().itervalues():
@@ -451,7 +463,6 @@ class TimelineLogObserver(object):
         else:
             self._connectToTrackObject(track_object)
 
-
     def _timelineObjectTrackObjectRemovedCb(self, timeline_object,
                                             track_object):
         if isinstance(track_object, TrackEffect):
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index a6ab93c..f52bcaf 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -32,17 +32,19 @@ from pitivi.factories.test import VideoTestSourceFactory, \
 from pitivi.elements.mixer import SmartAdderBin, SmartVideomixerBin
 from pitivi.timeline.gap import Gap
 
+
 class TrackError(Exception):
     pass
 
+
 class Keyframe(Signallable):
 
     """Represents a single point on an interpolation curve"""
 
     __signals__ = {
-        "value-changed" : ['value'],
-        "time-changed" : ['time'],
-        "mode-changed" : ['mode'],
+        "value-changed": ['value'],
+        "time-changed": ['time'],
+        "mode-changed": ['mode'],
     }
 
     def __init__(self, parent):
@@ -106,6 +108,7 @@ class Keyframe(Signallable):
             return cmp(self.time, other.time)
         return self
 
+
 class FixedKeyframe(Keyframe):
 
     def setTime(self, time):
@@ -113,6 +116,7 @@ class FixedKeyframe(Keyframe):
 
     time = property(Keyframe.getTime, setTime)
 
+
 class Interpolator(Signallable, Loggable):
 
     """The bridge between the gstreamer dynamic property API and pitivi track
@@ -132,9 +136,9 @@ class Interpolator(Signallable, Loggable):
     """
 
     __signals__ = {
-        'keyframe-added' : ['keyframe'],
-        'keyframe-removed' : ['keyframe', 'old_value'],
-        'keyframe-moved' : ['keyframe', 'old_value'],
+        'keyframe-added': ['keyframe'],
+        'keyframe-removed': ['keyframe', 'old_value'],
+        'keyframe-moved': ['keyframe', 'old_value'],
     }
 
     def __init__(self, trackobject, element, prop, minimum=None, maximum=None,
@@ -300,6 +304,7 @@ class Interpolator(Signallable, Loggable):
 
     keyframes = property(getKeyframes)
 
+
 class TrackObject(Signallable, Loggable):
 
     __signals__ = {
@@ -309,9 +314,9 @@ class TrackObject(Signallable, Loggable):
         'out-point-changed': ['out-point'],
         'media-duration-changed': ['media-duration'],
         'priority-changed': ['priority'],
-        'selected-changed' : ['state'],
-        'stagger-changed' : ['stagger'],
-        'active-changed' : ['active'],
+        'selected-changed': ['state'],
+        'stagger-changed': ['stagger'],
+        'active-changed': ['active'],
     }
 
     def __init__(self, factory, stream, start=0,
@@ -693,7 +698,7 @@ class TrackObject(Signallable, Loggable):
             public_priority = (true_priority - 2 - self._stagger) // 3
         elif self.stream_type is AudioStream:
             true_priority = obj.props.priority
-            public_priority = (true_priority - 2 - (2 * self._stagger))// 4
+            public_priority = (true_priority - 2 - (2 * self._stagger)) // 4
         if self._public_priority != public_priority:
             self._public_priority = public_priority
             self.emit('priority-changed', public_priority)
@@ -733,6 +738,7 @@ class TrackObject(Signallable, Loggable):
             self._updatePriority(self._public_priority)
             self.emit("stagger-changed", self._stagger)
 
+
 class SourceTrackObject(TrackObject):
 
     numobjs = 0
@@ -744,6 +750,7 @@ class SourceTrackObject(TrackObject):
         SourceTrackObject.numobjs += 1
         return source
 
+
 class TrackEffect(TrackObject):
 
     numobjs = 0
@@ -792,12 +799,13 @@ class TrackEffect(TrackObject):
         effect_bin = list(self.gnl_object.elements())[0]
         return effect_bin.get_by_name("effect")
 
+
 class Transition(Signallable):
 
     __signals__ = {
-        "start-changed" : ["start"],
-        "duration-changed" : ["duration"],
-        "priority-changed" : ["priority"],
+        "start-changed": ["start"],
+        "duration-changed": ["duration"],
+        "priority-changed": ["priority"],
     }
 
     def __init__(self, a, b):
@@ -868,6 +876,7 @@ class Transition(Signallable):
     def removeThyselfFromComposition(self, composition):
         pass
 
+
 class VideoTransition(Transition):
 
     caps = gst.Caps("video/x-raw-yuv,format=(fourcc)AYUV")
@@ -913,6 +922,7 @@ class VideoTransition(Transition):
             self.controller.set("alpha", 0, 1.0)
             self.controller.set("alpha", self.duration, 0.0)
 
+
 class AudioTransition(Transition):
 
     def _makeGnlObject(self):
@@ -934,7 +944,6 @@ class AudioTransition(Transition):
 
         self.b_operation.props.media_start = 0
 
-
     def addThyselfToComposition(self, composition):
         composition.add(self.a_operation, self.b_operation)
 
@@ -967,6 +976,7 @@ class AudioTransition(Transition):
         self.b_controller.set("volume", 0, 0.0)
         self.b_controller.set("volume", self.duration, 1.0)
 
+
 class Track(Signallable, Loggable):
     logCategory = "track"
 
@@ -976,8 +986,8 @@ class Track(Signallable, Loggable):
         'track-object-added': ['track_object'],
         'track-object-removed': ['track_object'],
         'max-priority-changed': ['track_object'],
-        'transition-added' : ['transition'],
-        'transition-removed' : ['transition'],
+        'transition-added': ['transition'],
+        'transition-removed': ['transition'],
     }
 
     def __init__(self, stream):
diff --git a/pitivi/undo.py b/pitivi/undo.py
index e3e6431..bcf6582 100644
--- a/pitivi/undo.py
+++ b/pitivi/undo.py
@@ -22,12 +22,15 @@
 from pitivi.signalinterface import Signallable
 from pitivi.log.loggable import Loggable
 
+
 class UndoError(Exception):
     pass
 
+
 class UndoWrongStateError(UndoError):
     pass
 
+
 class UndoableAction(Signallable):
     __signals__ = {
         "done": [],
@@ -50,6 +53,7 @@ class UndoableAction(Signallable):
     def _undone(self):
         self.emit("undone")
 
+
 class UndoableActionStack(UndoableAction):
     __signals__ = {
         "done": [],
@@ -99,6 +103,7 @@ class UndoableActionLog(Signallable):
         "redo": ["stack"],
         "cleaned": [],
     }
+
     def __init__(self):
         self.undo_stacks = []
         self.redo_stacks = []
@@ -221,6 +226,7 @@ class UndoableActionLog(Signallable):
     def _stackIsNested(self, stack):
         return bool(len(self.stacks))
 
+
 class DebugActionLogObserver(Loggable):
     def startObserving(self, log):
         self._connectToActionLog(log)
diff --git a/pitivi/utils.py b/pitivi/utils.py
index 321677b..21a4bd4 100644
--- a/pitivi/utils.py
+++ b/pitivi/utils.py
@@ -24,7 +24,8 @@
 
 import sys
 import gobject
-import gst, bisect
+import gst
+import bisect
 import os
 import struct
 from pitivi.signalinterface import Signallable
@@ -37,9 +38,11 @@ except ImportError:
 
 UNKNOWN_DURATION = 2 ** 63 - 1
 
+
 def between(a, b, c):
     return (a <= b) and (b <= c)
 
+
 def time_to_string(value):
     """
     Converts the given time in nanoseconds to a human readable string
@@ -57,6 +60,7 @@ def time_to_string(value):
     mins = mins % 60
     return "%01d:%02d:%02d.%03d" % (hours, mins, sec, ms)
 
+
 def beautify_length(length):
     """
     Converts the given time in nanoseconds to a human readable string
@@ -79,6 +83,7 @@ def beautify_length(length):
 
     return ", ".join(parts)
 
+
 def beautify_ETA(length):
     """
     Converts the given time in nanoseconds to a fuzzy estimate,
@@ -102,6 +107,7 @@ def beautify_ETA(length):
 
     return ", ".join(parts)
 
+
 def bin_contains(bin, element):
     """ Returns True if the bin contains the given element, the search is recursive """
     if not isinstance(bin, gst.Bin):
@@ -126,21 +132,22 @@ def bin_contains(bin, element):
 # matches the list, this function returns the index of the lement closest to
 # value in the array.
 
+
 def binary_search(col, value):
     low = 0
     high = len(col)
     while (low < high):
-        mid = (low + high)/2
+        mid = (low + high) / 2
         if (col[mid] < value):
             low = mid + 1
         else:
             #can't be high = mid-1: here col[mid] >= value,
             #so high can't be < mid if col[mid] == value
-            high = mid;
+            high = mid
     return low
 
-# Returns the element of seq nearest to item, and the difference between them
 
+# Returns the element of seq nearest to item, and the difference between them
 def closest_item(seq, item, lo=0):
     index = bisect.bisect(seq, item, lo)
     if index >= len(seq):
@@ -162,6 +169,7 @@ def closest_item(seq, item, lo=0):
 
     return res, diff, index
 
+
 def argmax(func, seq):
     """return the element of seq that gives max(map(func, seq))"""
     def compare(a1, b1):
@@ -172,6 +180,7 @@ def argmax(func, seq):
     objs = ((func(val), val) for val in seq)
     return reduce(compare, objs)[1]
 
+
 def same(seq):
     i = iter(seq)
     first = i.next()
@@ -180,6 +189,7 @@ def same(seq):
             return None
     return first
 
+
 def data_probe(pad, data, section=""):
     """Callback to use for gst.Pad.add_*_probe.
 
@@ -188,25 +198,26 @@ def data_probe(pad, data, section=""):
     if section == "":
         section = "%s:%s" % (pad.get_parent().get_name(), pad.get_name())
     if isinstance(data, gst.Buffer):
-        log.debug("probe","%s BUFFER timestamp:%s , duration:%s , size:%d , offset:%d , offset_end:%d",
+        log.debug("probe", "%s BUFFER timestamp:%s , duration:%s , size:%d , offset:%d , offset_end:%d",
                   section, gst.TIME_ARGS(data.timestamp), gst.TIME_ARGS(data.duration),
                   data.size, data.offset, data.offset_end)
         if data.flags & gst.BUFFER_FLAG_DELTA_UNIT:
-            log.debug("probe","%s DELTA_UNIT", section)
+            log.debug("probe", "%s DELTA_UNIT", section)
         if data.flags & gst.BUFFER_FLAG_DISCONT:
-            log.debug("probe","%s DISCONT", section)
+            log.debug("probe", "%s DISCONT", section)
         if data.flags & gst.BUFFER_FLAG_GAP:
-            log.debug("probe","%s GAP", section)
-        log.debug("probe","%s flags:%r", section, data.flags)
+            log.debug("probe", "%s GAP", section)
+        log.debug("probe", "%s flags:%r", section, data.flags)
     else:
-        log.debug("probe","%s EVENT %s", section, data.type)
+        log.debug("probe", "%s EVENT %s", section, data.type)
         if data.type == gst.EVENT_NEWSEGMENT:
             upd, rat, fmt, start, stop, pos = data.parse_new_segment()
-            log.debug("probe","%s Update:%r rate:%f fmt:%s, start:%s, stop:%s, pos:%s",
+            log.debug("probe", "%s Update:%r rate:%f fmt:%s, start:%s, stop:%s, pos:%s",
                       section, upd, rat, fmt, gst.TIME_ARGS(start),
                       gst.TIME_ARGS(stop), gst.TIME_ARGS(pos))
     return True
 
+
 def linkDynamic(element, target):
 
     def pad_added(bin, pad, target):
@@ -215,9 +226,11 @@ def linkDynamic(element, target):
             pad.link_full(compatpad, gst.PAD_LINK_CHECK_NOTHING)
     element.connect("pad-added", pad_added, target)
 
+
 def element_make_many(*args):
     return tuple((gst.element_factory_make(arg) for arg in args))
 
+
 def pipeline(graph):
     E = graph.iteritems()
     V = graph.iterkeys()
@@ -231,6 +244,7 @@ def pipeline(graph):
                 linkDynamic(u, v)
     return p
 
+
 def filter_(caps):
     f = gst.element_factory_make("capsfilter")
     f.props.caps = gst.caps_from_string(caps)
@@ -253,6 +267,7 @@ def uri_is_valid(uri):
         return len(os.path.basename(gst.uri_get_location(uri))) > 0
     return res
 
+
 def uri_is_reachable(uri):
     """ Check whether the given uri is reachable and we can read/write
     to it.
@@ -269,6 +284,7 @@ def uri_is_reachable(uri):
             _("%s doesn't yet handle non local projects") % APPNAME)
     return os.path.isfile(gst.uri_get_location(uri))
 
+
 class PropertyChangeTracker(Signallable):
 
     __signals__ = {}
@@ -304,6 +320,7 @@ class PropertyChangeTracker(Signallable):
 
         self.emit(property_name + '-changed', object, old_value, value)
 
+
 class Seeker(Signallable):
     __signals__ = {'seek': ['position', 'format']}
 
@@ -343,9 +360,11 @@ class Seeker(Signallable):
                 return False
         return False
 
+
 def get_filesystem_encoding():
     return sys.getfilesystemencoding() or "utf-8"
 
+
 def get_controllable_properties(element):
     """
     Returns a list of controllable properties for the given
@@ -367,33 +386,43 @@ def get_controllable_properties(element):
                 res.append((element, prop))
     return res
 
+
 def start_insort_left(a, x, lo=0, hi=None):
     if hi is None:
         hi = len(a)
     while lo < hi:
-        mid = (lo+hi)//2
-        if a[mid].start < x.start: lo = mid+1
-        else: hi = mid
+        mid = (lo + hi) // 2
+        if a[mid].start < x.start:
+            lo = mid + 1
+        else:
+            hi = mid
     a.insert(lo, x)
 
+
 def start_insort_right(a, x, lo=0, hi=None):
     if hi is None:
         hi = len(a)
     while lo < hi:
-        mid = (lo+hi)//2
-        if x.start < a[mid].start: hi = mid
-        else: lo = mid+1
+        mid = (lo + hi) // 2
+        if x.start < a[mid].start:
+            hi = mid
+        else:
+            lo = mid + 1
     a.insert(lo, x)
 
+
 def start_bisect_left(a, x, lo=0, hi=None):
     if hi is None:
         hi = len(a)
     while lo < hi:
-        mid = (lo+hi)//2
-        if a[mid].start < x.start: lo = mid+1
-        else: hi = mid
+        mid = (lo + hi) // 2
+        if a[mid].start < x.start:
+            lo = mid + 1
+        else:
+            hi = mid
     return lo
 
+
 class Infinity(object):
     def __cmp__(self, other):
         if isinstance(other, Infinity):
@@ -403,6 +432,7 @@ class Infinity(object):
 
 infinity = Infinity()
 
+
 def findObject(obj, objects):
     low = 0
     high = len(objects)
@@ -418,6 +448,7 @@ def findObject(obj, objects):
 
     return low
 
+
 def getPreviousObject(obj, objects, priority=-1, skip=None):
     if priority == -1:
         priority = obj.priority
@@ -439,7 +470,6 @@ def getPreviousObject(obj, objects, priority=-1, skip=None):
         if priority is None or prev_obj.priority == priority:
             return prev_obj
 
-
     # check if there are objects with start < obj.start
     prev_obj_index = obj_index - 1
     while prev_obj_index >= 0:
@@ -452,6 +482,7 @@ def getPreviousObject(obj, objects, priority=-1, skip=None):
 
     return None
 
+
 def getNextObject(obj, objects, priority=-1, skip=None):
     if priority == -1:
         priority = obj.priority
@@ -501,6 +532,7 @@ class CachedFactoryList(object):
         log.warning("utils", "New feature added, invalidating cached factories")
         self._factories = None
 
+
 def profile(func, profiler_filename="result.prof"):
     import os.path
     counter = 1
@@ -509,7 +541,7 @@ def profile(func, profiler_filename="result.prof"):
         output_filename = profiler_filename + str(counter)
         counter += 1
 
-    def _wrapper(*args,**kwargs):
+    def _wrapper(*args, **kwargs):
         local_func = func
         cProfile.runctx("result = local_func(*args, **kwargs)", globals(), locals(),
                         filename=output_filename)
@@ -517,6 +549,7 @@ def profile(func, profiler_filename="result.prof"):
 
     return _wrapper
 
+
 def formatPercent(value):
     return "%3d%%" % (value * 100)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]