[SCM] morituri/master: make a LogStub class

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:43 UTC 2014


The following commit has been merged in the master branch:
commit 2a0bc4a8dfdd6c0203a80e01f67166380ecf2f24
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Nov 18 12:31:15 2012 +0000

    make a LogStub class

diff --git a/morituri/extern/task/task.py b/morituri/extern/task/task.py
index d580dab..da4639a 100644
--- a/morituri/extern/task/task.py
+++ b/morituri/extern/task/task.py
@@ -1,4 +1,4 @@
-# -*- Mode: Python; test-case-name: test_task -*-
+# -*- Mode: Python -*-
 # vi:si:et:sw=4:sts=4:ts=4
 
 # Morituri - for those about to RIP
@@ -64,8 +64,29 @@ def _getExceptionMessage(exception, frame=-1, filename=None):
         % locals()
 
 
+class LogStub(object):
+    """
+    I am a stub for a log interface.
+    """
+
+    ### log stubs
+    def log(self, message, *args):
+        pass
+
+    def debug(self, message, *args):
+        pass
+
+    def info(self, message, *args):
+        pass
+
+    def warning(self, message, *args):
+        pass
 
-class Task(object):
+    def error(self, message, *args):
+        pass
+
+
+class Task(LogStub):
     """
     I wrap a task in an asynchronous interface.
     I can be listened to for starting, stopping, description changes
@@ -94,22 +115,6 @@ class Task(object):
     _listeners = None
 
 
-    ### log stubs
-    def warning(self, message, *args):
-        pass
-
-    def info(self, message, *args):
-        pass
-
-    def debug(self, message, *args):
-        pass
-
-    def log(self, message, *args):
-        pass
-
-    def error(self, message, *args):
-        pass
-
     ### subclass methods
     def start(self, runner):
         """
@@ -421,30 +426,13 @@ class MultiCombinedTask(BaseMultiTask):
         self.setProgress(float(self._stopped) / len(self.tasks))
         BaseMultiTask.stopped(self, task)
 
-class TaskRunner(object):
+class TaskRunner(LogStub):
     """
     I am a base class for task runners.
     Task runners should be reusable.
     """
     logCategory = 'TaskRunner'
 
-    ### log stubs
-    def warning(self, message, *args):
-        pass
-
-    def info(self, message, *args):
-        pass
-
-    def debug(self, message, *args):
-        pass
-
-    def log(self, message, *args):
-        pass
-
-    def error(self, message, *args):
-        pass
-
-
     def run(self, task):
         """
         Run the given task.

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list