[pitivi] Never compare variable with True or False



commit 5e2b91c3ffba2c13dcacc2de9b1edd0822017a75
Author: Thibault Saunier <thibault saunier collabora com>
Date:   Fri Jun 3 00:26:41 2011 -0400

    Never compare variable with True or False

 pitivi/action.py         |   12 ++++++------
 pitivi/pipeline.py       |    8 ++++----
 pitivi/projectmanager.py |    2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/action.py b/pitivi/action.py
index d77e133..f29835a 100644
--- a/pitivi/action.py
+++ b/pitivi/action.py
@@ -219,7 +219,7 @@ class Action(Signallable, Loggable):
                     if isinstance(p, t):
                         val = True
                         continue
-                if val == False:
+                if not val:
                     raise ActionError("Some producers are not of the compatible type")
         for p in producers:
             if not p in self.producers:
@@ -262,7 +262,7 @@ class Action(Signallable, Loggable):
                     if isinstance(p, t):
                         val = True
                         continue
-                if val == False:
+                if not val:
                     raise ActionError("Some consumers are not of the compatible type")
         for p in consumers:
             if not p in self.consumers:
@@ -398,7 +398,7 @@ class Action(Signallable, Loggable):
         @rtype: List of (C{Producer}, C{Consumer}, C{ProducerStream}, C{ConsumerStream})
         """
         links = self._links[:]
-        if links == [] and autolink == True:
+        if links == [] and autolink:
             links = self._links = self.autoLink()
         self.debug("Returning %d links", len(links))
         return links
@@ -481,7 +481,7 @@ class Action(Signallable, Loggable):
                     self._pd.append((producer, stream))
 
 
-        if waspending == False:
+        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
             # links we've *already* handled
@@ -604,7 +604,7 @@ class Action(Signallable, Loggable):
                                                      automake=True)
 
         except PipelineError, e:
-            if init != True:
+            if not init:
                 self.debug("Could not create link %s" % e)
                 return False
 
@@ -618,7 +618,7 @@ class Action(Signallable, Loggable):
                 consstream, automake=True)
 
         self.info("Got our bin for our consumer: %r", bin)
-        if init != True:
+        if not init:
             # we set the sink to paused, since we are adding this link during
             # auto-plugging
             bin.sync_state_with_parent()
diff --git a/pitivi/pipeline.py b/pitivi/pipeline.py
index 92a9aaa..e1b0299 100644
--- a/pitivi/pipeline.py
+++ b/pitivi/pipeline.py
@@ -372,7 +372,7 @@ class Pipeline(Signallable, Loggable):
         @return: Whether the position listener was activated or not
         @rtype: L{bool}
         """
-        if self._listening == True:
+        if self._listening:
             return True
         self._listening = True
         self._listeningInterval = interval
@@ -400,8 +400,8 @@ class Pipeline(Signallable, Loggable):
     def _listenToPosition(self, listen=True):
         # stupid and dumm method, not many checks done
         # i.e. it does NOT check for current state
-        if listen == True:
-            if self._listening == True and self._listeningSigId == 0:
+        if listen:
+            if self._listening and self._listeningSigId == 0:
                 self._listeningSigId = gobject.timeout_add(self._listeningInterval,
                                                            self._positionListenerCb)
         elif self._listeningSigId != 0:
@@ -911,7 +911,7 @@ class Pipeline(Signallable, Loggable):
             for action in compatactions:
                 handled |= action.handleNewStream(factory, stream)
 
-            if handled == False:
+            if not handled:
                 self.debug("No action handled this Stream")
                 self.emit('unhandled-stream', stream)
         finally:
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index 16aefeb..11bf3de 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -156,7 +156,7 @@ class ProjectManager(Signallable, Loggable):
         if self.current is None:
             return True
 
-        if self.emit("closing-project", self.current) == False:
+        if not self.emit("closing-project", self.current):
             return False
 
         self.emit("project-closed", self.current)



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