|
From: <lu...@us...> - 2009-11-22 17:00:37
|
Revision: 358
http://pyscard.svn.sourceforge.net/pyscard/?rev=358&view=rev
Author: ludov
Date: 2009-11-22 17:00:29 +0000 (Sun, 22 Nov 2009)
Log Message:
-----------
pep8: E111 indentation is not a multiple of four
Modified Paths:
--------------
trunk/pyscard/src/smartcard/Observer.py
trunk/pyscard/src/smartcard/Synchronization.py
trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
trunk/pyscard/src/smartcard/util/__init__.py
trunk/pyscard/src/smartcard/wx/__init__.py
Modified: trunk/pyscard/src/smartcard/Observer.py
===================================================================
--- trunk/pyscard/src/smartcard/Observer.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/Observer.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -8,67 +8,67 @@
for all smartcard package observers.
Known subclasses:
- smartcard.ReaderObserver
+ smartcard.ReaderObserver
"""
from smartcard.Synchronization import *
class Observer:
- def update(observable, arg):
- '''Called when the observed object is
- modified. You call an Observable object's
- notifyObservers method to notify all the
- object's observers of the change.'''
- pass
+ def update(observable, arg):
+ '''Called when the observed object is
+ modified. You call an Observable object's
+ notifyObservers method to notify all the
+ object's observers of the change.'''
+ pass
class Observable(Synchronization):
- def __init__(self):
- self.obs = []
- self.changed = 0
- Synchronization.__init__(self)
+ def __init__(self):
+ self.obs = []
+ self.changed = 0
+ Synchronization.__init__(self)
- def addObserver(self, observer):
- if observer not in self.obs:
- self.obs.append(observer)
+ def addObserver(self, observer):
+ if observer not in self.obs:
+ self.obs.append(observer)
- def deleteObserver(self, observer):
- self.obs.remove(observer)
+ def deleteObserver(self, observer):
+ self.obs.remove(observer)
- def notifyObservers(self, arg=None):
- '''If 'changed' indicates that this object
- has changed, notify all its observers, then
- call clearChanged(). Each observer has its
- update() called with two arguments: this
- observable object and the generic 'arg'.'''
+ def notifyObservers(self, arg=None):
+ '''If 'changed' indicates that this object
+ has changed, notify all its observers, then
+ call clearChanged(). Each observer has its
+ update() called with two arguments: this
+ observable object and the generic 'arg'.'''
- self.mutex.acquire()
- try:
- if not self.changed:
- return
- # Make a local copy in case of synchronous
- # additions of observers:
- localArray = self.obs[:]
- self.clearChanged()
- finally:
- self.mutex.release()
- # Update observers
- for observer in localArray:
- observer.update(self, arg)
+ self.mutex.acquire()
+ try:
+ if not self.changed:
+ return
+ # Make a local copy in case of synchronous
+ # additions of observers:
+ localArray = self.obs[:]
+ self.clearChanged()
+ finally:
+ self.mutex.release()
+ # Update observers
+ for observer in localArray:
+ observer.update(self, arg)
- def deleteObservers(self):
- self.obs = []
- def setChanged(self):
- self.changed = 1
- def clearChanged(self):
- self.changed = 0
- def hasChanged(self):
- return self.changed
- def countObservers(self):
- return len(self.obs)
+ def deleteObservers(self):
+ self.obs = []
+ def setChanged(self):
+ self.changed = 1
+ def clearChanged(self):
+ self.changed = 0
+ def hasChanged(self):
+ return self.changed
+ def countObservers(self):
+ return len(self.obs)
synchronize(Observable,
- "addObserver deleteObserver deleteObservers " +
- "setChanged clearChanged hasChanged " +
- "countObservers")
+ "addObserver deleteObserver deleteObservers " +
+ "setChanged clearChanged hasChanged " +
+ "countObservers")
#:~
Modified: trunk/pyscard/src/smartcard/Synchronization.py
===================================================================
--- trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/Synchronization.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -9,32 +9,32 @@
from threading import RLock
def synchronized(method):
- def f(*args):
- self = args[0]
- self.mutex.acquire()
- # print method.__name__, 'acquired'
- try:
- return apply(method, args)
- finally:
- self.mutex.release()
- # print method.__name__, 'released'
- return f
+ def f(*args):
+ self = args[0]
+ self.mutex.acquire()
+ # print method.__name__, 'acquired'
+ try:
+ return apply(method, args)
+ finally:
+ self.mutex.release()
+ # 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(''):
- names = names.split()
- for (name, val) in klass.__dict__.items():
- if callable(val) and name != '__init__' and \
- (names == None or name in names):
- # print "synchronizing", name
- klass.__dict__[name] = synchronized(val)
+ """Synchronize methods in the given class.
+ Only synchronize the methods whose names are
+ given, or all methods if names=None."""
+ if type(names)==type(''):
+ names = names.split()
+ for (name, val) in klass.__dict__.items():
+ if callable(val) and name != '__init__' and \
+ (names == None or name in names):
+ # print "synchronizing", name
+ klass.__dict__[name] = synchronized(val)
# You can create your own self.mutex, or inherit
# from this class:
class Synchronization:
- def __init__(self):
- self.mutex = RLock()
+ def __init__(self):
+ self.mutex = RLock()
#:~
Modified: trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py
===================================================================
--- trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -46,7 +46,7 @@
# Where this link is in the chain:
location = self.chain.index(self)
if not self.end():
- return self.chain[location + 1]
+ return self.chain[location + 1]
def addFilterException( self, exClass ):
"""Add an exception filter to the error checking chain.
Modified: trunk/pyscard/src/smartcard/util/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/util/__init__.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/util/__init__.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -218,7 +218,7 @@
def BinStringToHexList( binstring ):
hexlist=[]
for byte in binstring:
- hexlist= hexlist + [ ord(byte) ]
+ hexlist= hexlist + [ ord(byte) ]
return hexlist
def hl2bs( hexlist ):
Modified: trunk/pyscard/src/smartcard/wx/__init__.py
===================================================================
--- trunk/pyscard/src/smartcard/wx/__init__.py 2009-11-22 16:56:41 UTC (rev 357)
+++ trunk/pyscard/src/smartcard/wx/__init__.py 2009-11-22 17:00:29 UTC (rev 358)
@@ -27,7 +27,7 @@
import sys
def main_is_frozen():
- return( hasattr( sys, "frozen" ) or hasattr( sys, "importers" ) or imp.is_frozen( "__main__") )
+ return( hasattr( sys, "frozen" ) or hasattr( sys, "importers" ) or imp.is_frozen( "__main__") )
ICO_SMARTCARD=None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|