From: <lu...@us...> - 2010-06-06 15:10:50
|
Revision: 427 http://pyscard.svn.sourceforge.net/pyscard/?rev=427&view=rev Author: ludov Date: 2010-06-06 15:10:44 +0000 (Sun, 06 Jun 2010) Log Message: ----------- make pep8 happy Modified Paths: -------------- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py Modified: trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 15:08:13 UTC (rev 426) +++ trunk/pyscard/src/smartcard/pcsc/PCSCExceptions.py 2010-06-06 15:10:44 UTC (rev 427) @@ -27,6 +27,7 @@ # gemalto scard library import smartcard.scard + class BaseSCardException: """Base class for scard (aka PCSC) exceptions. @@ -34,40 +35,52 @@ low-level PCSC access to readers and cards. """ - def __init__( self, hresult ): + + def __init__(self, hresult): """Constructor that stores the pcsc error status.""" - self.hresult=hresult + self.hresult = hresult def __str__(self): """Returns a string representation of the exception.""" - return repr("scard exception: " + + return repr("scard exception: " + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class EstablishContextException(BaseSCardException): """Raised when scard failed to establish context with PCSC.""" def __str__(self): """Returns a string representation of the exception.""" - return repr( 'Failure to establish context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to establish context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class ListReadersException(BaseSCardException): """Raised when scard failed to list readers.""" + def __str__(self): - return repr( 'Failure to list readers: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to list readers: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class EstablishContextException(BaseSCardException): """Raised when scard failed to establish a PCSC context.""" + def __str__(self): - return repr( 'Failure to establish context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to establish context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) + class ReleaseContextException(BaseSCardException): """Raised when scard failed to release PCSC context.""" + def __str__(self): - return repr( 'Failure to release context: ' + smartcard.scard.SCardGetErrorMessage(self.hresult) ) + return repr('Failure to release context: ' + + smartcard.scard.SCardGetErrorMessage(self.hresult)) if __name__ == "__main__": import sys try: - raise EstablishContextException( smartcard.scard.SCARD_E_NO_MEMORY ) + raise EstablishContextException(smartcard.scard.SCARD_E_NO_MEMORY) except BaseSCardException as exc: print exc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |