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. |
From: <lu...@us...> - 2011-10-19 12:47:36
|
Revision: 572 http://pyscard.svn.sourceforge.net/pyscard/?rev=572&view=rev Author: ludov Date: 2011-10-19 12:47:30 +0000 (Wed, 19 Oct 2011) Log Message: ----------- Partly revert revision 571 because of side effect The error is: File "/Library/Python/2.7/site-packages/smartcard/__init__.py", line 34, in <module> from smartcard.System import listReaders File "/Library/Python/2.7/site-packages/smartcard/System.py", line 27, in <module> import smartcard.reader.ReaderFactory File "/Library/Python/2.7/site-packages/smartcard/reader/ReaderFactory.py", line 34, in <module> from smartcard.pcsc.PCSCReader import PCSCReader File "/Library/Python/2.7/site-packages/smartcard/pcsc/PCSCReader.py", line 25, in <module> from smartcard.CardConnectionDecorator import CardConnectionDecorator File "/Library/Python/2.7/site-packages/smartcard/CardConnectionDecorator.py", line 27, in <module> from smartcard.CardConnection import CardConnection File "/Library/Python/2.7/site-packages/smartcard/CardConnection.py", line 28, in <module> from smartcard.Observer import Observer File "/Library/Python/2.7/site-packages/smartcard/Observer.py", line 81, in <module> "countObservers") File "/Library/Python/2.7/site-packages/smartcard/Synchronization.py", line 36, in synchronize klass.__dict__[name] = synchronized(val) TypeError: 'dictproxy' object does not support item assignment Revision Links: -------------- http://pyscard.svn.sourceforge.net/pyscard/?rev=571&view=rev Modified Paths: -------------- trunk/pyscard/src/smartcard/Synchronization.py Modified: trunk/pyscard/src/smartcard/Synchronization.py =================================================================== --- trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 12:25:28 UTC (rev 571) +++ trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 12:47:30 UTC (rev 572) @@ -36,7 +36,7 @@ klass.__dict__[name] = synchronized(val) -class Synchronization(object): +class Synchronization: # You can create your own self.mutex, or inherit from this class: def __init__(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2011-10-19 13:01:55
|
Revision: 573 http://pyscard.svn.sourceforge.net/pyscard/?rev=573&view=rev Author: ludov Date: 2011-10-19 13:01:49 +0000 (Wed, 19 Oct 2011) Log Message: ----------- Use setattr() instead of a direct access to __dict__ Closes Feature Request 3110077 "new style classes" https://sourceforge.net/tracker/?func=detail&aid=3110077&group_id=196342&atid=957075 Modified Paths: -------------- trunk/pyscard/src/smartcard/Synchronization.py Modified: trunk/pyscard/src/smartcard/Synchronization.py =================================================================== --- trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 12:47:30 UTC (rev 572) +++ trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 13:01:49 UTC (rev 573) @@ -33,10 +33,10 @@ if callable(val) and name != '__init__' and \ (names == None or name in names): # print "synchronizing", name - klass.__dict__[name] = synchronized(val) + setattr(klass, name, synchronized(val)) -class Synchronization: +class Synchronization(object): # You can create your own self.mutex, or inherit from this class: def __init__(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |