[pitivi] Get rid of assert False



commit bfdc458582bd806a0e99a3add8a0d33dd6ba213a
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Mon Dec 2 05:14:03 2013 +0100

    Get rid of assert False

 pitivi/medialibrary.py |    2 +-
 pitivi/utils/system.py |    9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 8fb360f..e9afdd5 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -795,7 +795,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
                 selection = view.get_selected_items()
                 return view.path_is_selected(path) and len(selection)
         else:
-            assert False
+            raise RuntimeError("Unknown media library view type: %s" % type(view))
 
         return False
 
diff --git a/pitivi/utils/system.py b/pitivi/utils/system.py
index 6e74616..095d919 100644
--- a/pitivi/utils/system.py
+++ b/pitivi/utils/system.py
@@ -53,9 +53,8 @@ class System(Signallable, Loggable):
 
     #generic functions
     def _inhibit(self, list_, key):
-        if key is None or (not isinstance(key, str)):
-            assert False
-
+        assert key is not None
+        assert isinstance(key, str)
         if not key in list_:
             list_.append(key)
             self.log("emitting 'update-power-inhibition'")
@@ -68,9 +67,7 @@ class System(Signallable, Loggable):
                 self.log("emitting 'update-power-inhibition'")
                 self.emit('update-power-inhibition')
         else:
-            if not isinstance(key, str):
-                assert False
-
+            assert isinstance(key, str)
             if key in list_:
                 list_.remove(key)
                 self.log("emitting 'update-power-inhibition'")


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