From: <lu...@us...> - 2010-06-09 15:06:06
|
Revision: 466 http://pyscard.svn.sourceforge.net/pyscard/?rev=466&view=rev Author: ludov Date: 2010-06-09 15:06:00 +0000 (Wed, 09 Jun 2010) Log Message: ----------- make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/Synchronization.py Modified: trunk/pyscard/src/smartcard/Synchronization.py =================================================================== --- trunk/pyscard/src/smartcard/Synchronization.py 2010-06-09 15:04:13 UTC (rev 465) +++ trunk/pyscard/src/smartcard/Synchronization.py 2010-06-09 15:06:00 UTC (rev 466) @@ -8,7 +8,9 @@ from threading import RLock + def synchronized(method): + def f(*args): self = args[0] self.mutex.acquire() @@ -20,11 +22,12 @@ # print method.__name__, 'released' return f + def synchronize(klass, names=None): """Synchronize methods in the given class. Only synchronize the methods whose names are given, or all methods if names=None.""" - if type(names)==type(''): + if type(names) == type(''): names = names.split() for (name, val) in klass.__dict__.items(): if callable(val) and name != '__init__' and \ @@ -32,9 +35,9 @@ # print "synchronizing", name klass.__dict__[name] = synchronized(val) -# You can create your own self.mutex, or inherit -# from this class: + class Synchronization: + # You can create your own self.mutex, or inherit from this class: + def __init__(self): self.mutex = RLock() -#:~ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |