[Piglit] [PATCH 16/26] threads.py: PEP8 compliance

Dylan Baker baker.dylan.c at gmail.com
Wed Jul 10 15:19:07 PDT 2013


---
 framework/threads.py | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/framework/threads.py b/framework/threads.py
index 71e9b43..fcc266e 100644
--- a/framework/threads.py
+++ b/framework/threads.py
@@ -21,16 +21,18 @@
 # IN THE SOFTWARE.
 #
 
+from weakref import WeakKeyDictionary
+import multiprocessing
+
 from threadpool import ThreadPool, WorkRequest
 from patterns import Singleton
 from threading import RLock
-from weakref import WeakKeyDictionary
-import multiprocessing
+
 
 def synchronized_self(function):
     '''
-            A decorator function for providing multithreaded, synchronized access
-            amongst one or more functions within a class instance.
+    A decorator function for providing multithreaded, synchronized access
+    amongst one or more functions within a class instance.
     '''
     def wrapper(self, *args, **kwargs):
         synchronized_self.locks.setdefault(self, RLock()).acquire()
@@ -40,7 +42,10 @@ def synchronized_self(function):
             synchronized_self.locks[self].release()
     return wrapper
 
-synchronized_self.locks = WeakKeyDictionary() # track the locks for each instance
+
+# track the locks for each instance
+synchronized_self.locks = WeakKeyDictionary()
+
 
 class ConcurrentTestPool(Singleton):
     @synchronized_self
@@ -48,12 +53,8 @@ class ConcurrentTestPool(Singleton):
         self.pool = ThreadPool(multiprocessing.cpu_count())
 
     @synchronized_self
-    def put(self, callable_, args = None, kwds = None):
-        self.pool.putRequest(
-                WorkRequest(
-                        callable_, args = args, kwds = kwds
-                )
-        )
+    def put(self, callable_, args=None, kwds=None):
+        self.pool.putRequest(WorkRequest(callable_, args=args, kwds=kwds))
 
     def join(self):
         self.pool.wait()
-- 
1.8.3.1



More information about the Piglit mailing list