From: <jda...@us...> - 2011-10-16 09:27:11
|
Revision: 547 http://pyscard.svn.sourceforge.net/pyscard/?rev=547&view=rev Author: jdaussel Date: 2011-10-16 09:27:05 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Make pep8 happy by replacing has_key with in Modified Paths: -------------- trunk/pyscard/src/smartcard/ATR.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py Modified: trunk/pyscard/src/smartcard/ATR.py =================================================================== --- trunk/pyscard/src/smartcard/ATR.py 2011-10-16 09:15:29 UTC (rev 546) +++ trunk/pyscard/src/smartcard/ATR.py 2011-10-16 09:27:05 UTC (rev 547) @@ -235,17 +235,17 @@ def isT0Supported(self): """Return True if T=0 is supported.""" protocols = self.getSupportedProtocols() - return protocols.has_key('T=0') + return 'T=0' in protocols def isT1Supported(self): """Return True if T=1 is supported.""" protocols = self.getSupportedProtocols() - return protocols.has_key('T=1') + return 'T=1' in protocols def isT15Supported(self): """Return True if T=15 is supported.""" protocols = self.getSupportedProtocols() - return protocols.has_key('T=15') + return 'T=15' in protocols def dump(self): """Dump the details of an ATR.""" Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2011-10-16 09:15:29 UTC (rev 546) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2011-10-16 09:27:05 UTC (rev 547) @@ -88,7 +88,6 @@ for i in newstates: printstate(i) - finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 09:15:29 UTC (rev 546) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 09:27:05 UTC (rev 547) @@ -37,7 +37,6 @@ znewcardPrimGuid = smartcard.guid.strToGUID('{128F3806-4F70-4ccf-977A-60C390664840}') znewcardSecGuid = smartcard.guid.strToGUID('{EB7F69EA-BA20-47d0-8C50-11CFDEB63BBE}') - try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 10:34:47
|
Revision: 552 http://pyscard.svn.sourceforge.net/pyscard/?rev=552&view=rev Author: jdaussel Date: 2011-10-16 10:34:40 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Replaced deprecated has_key() with in (pep8) Modified Paths: -------------- trunk/pyscard/src/smartcard/CardNames.py trunk/pyscard/src/smartcard/Session.py trunk/pyscard/src/smartcard/test/framework/testcase_Card.py trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py trunk/pyscard/src/smartcard/test/framework/testcase_readers.py trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py Modified: trunk/pyscard/src/smartcard/CardNames.py =================================================================== --- trunk/pyscard/src/smartcard/CardNames.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/CardNames.py 2011-10-16 10:34:40 UTC (rev 552) @@ -64,7 +64,7 @@ def dump(self): for k, v in self.db.iteritems(): - print k, `loads(v)` + print k, repr(loads(v)) def find(self, atr, reader=None): for k, v in self.db.iteritems(): Modified: trunk/pyscard/src/smartcard/Session.py =================================================================== --- trunk/pyscard/src/smartcard/Session.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/Session.py 2011-10-16 10:34:40 UTC (rev 552) @@ -58,7 +58,7 @@ if readerName == None: if len(readers()) > 0: self.reader = readers()[0] - self.readerName = `self.reader` + self.readerName = repr(self.reader) else: raise NoReadersException() @@ -68,7 +68,7 @@ for reader in readers(): if readerName == str(reader): self.reader = reader - self.readerName = `self.reader` + self.readerName = repr(self.reader) try: self.reader Modified: trunk/pyscard/src/smartcard/test/framework/testcase_Card.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_Card.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_Card.py 2011-10-16 10:34:40 UTC (rev 552) @@ -65,7 +65,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "9f 20": 2, "6e 0": 3} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) @@ -83,7 +83,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "9f 20": 2, "6e 0": 3} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) Modified: trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_CardConnection.py 2011-10-16 10:34:40 UTC (rev 552) @@ -64,7 +64,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "6e 0": 2, "9f 20": 3, "9f 22": 4} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) cc.disconnect() @@ -81,7 +81,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "6e 0": 2, "9f 20": 3, "9f 22": 4} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) cc.disconnect() @@ -126,7 +126,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "6e 0": 2, "9f 20": 3, "9f 22": 4} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) cc.disconnect() @@ -143,7 +143,7 @@ response, sw1, sw2 = cc.transmit(SELECT + DF_TELECOM, CardConnection.T0_protocol) expectedSWs = {"9f 1a": 1, "6e 0": 2, "9f 20": 3, "9f 22": 4} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) else: self.assertRaises(NoCardException, cc.connect) cc.disconnect() Modified: trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_CardMonitor.py 2011-10-16 10:34:40 UTC (rev 552) @@ -63,7 +63,7 @@ foundcards[toHexString(card.atr)] = 1 for atr in expectedATRs: if [] != atr and {} != foundcards: - self.testcase.assert_(foundcards.has_key(toHexString(atr))) + self.testcase.assert_(toHexString(atr) in foundcards) class testthread(threading.Thread): Modified: trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_CardService.py 2011-10-16 10:34:40 UTC (rev 552) @@ -63,7 +63,7 @@ response, sw1, sw2 = cs.connection.transmit(SELECT + DF_TELECOM) expectedSWs = {"9f 1a": 1, "6e 0": 2, "9f 20": 3, "9f 22": 4} self.assertEquals([], response) - self.assert_(expectedSWs.has_key("%x %x" % (sw1, sw2)) or "9f" == "%x" % sw1) + self.assert_("%x %x" % (sw1, sw2) in expectedSWs or "9f" == "%x" % sw1) def suite(): Modified: trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2011-10-16 10:34:40 UTC (rev 552) @@ -117,7 +117,7 @@ for sw1 in range(0x00, 0xff + 1): sw2range = [] exception = None - if tiso7816_4SW1.has_key(sw1): + if sw1 in tiso7816_4SW1: exception = tiso7816_4SW1[sw1] for sw2 in range(0x00, 0xff + 1): if None != exception: @@ -145,7 +145,7 @@ for sw1 in range(0x00, 0xff + 1): sw2range = [] - if tiso7816_4SW.has_key(sw1): + if sw1 in tiso7816_4SW: exception, sw2range = tiso7816_4SW[sw1] for sw2 in range(0x00, 0xff + 1): if sw2 in sw2range: @@ -169,7 +169,7 @@ for sw1 in range(0x00, 0xff + 1): sw2range = [] - if tiso7816_8SW.has_key(sw1): + if sw1 in tiso7816_8SW: exception, sw2range = tiso7816_8SW[sw1] for sw2 in range(0x00, 0xff + 1): if sw2 in sw2range: @@ -190,7 +190,7 @@ for sw1 in range(0x00, 0xff + 1): sw2range = [] - if tiso7816_9SW.has_key(sw1): + if sw1 in tiso7816_9SW: exception, sw2range = tiso7816_9SW[sw1] for sw2 in range(0x00, 0xff + 1): if sw2 in sw2range: @@ -217,7 +217,7 @@ for sw1 in range(0x00, 0xff + 1): sw2range = [] - if top21_SW.has_key(sw1): + if sw1 in top21_SW: exception, sw2range = top21_SW[sw1] for sw2 in range(0x00, 0xff + 1): if sw2 in sw2range: Modified: trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_readermonitor.py 2011-10-16 10:34:40 UTC (rev 552) @@ -62,7 +62,7 @@ foundreaders[str(reader)] = 1 if {} != foundreaders: for reader in expectedReaders: - self.testcase.assert_(foundreaders.has_key(reader)) + self.testcase.assert_(reader in foundreaders) class testthread(threading.Thread): Modified: trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_readermonitorstress.py 2011-10-16 10:34:40 UTC (rev 552) @@ -85,7 +85,7 @@ mutexvreaders.acquire() if newreader not in virtualreaders: virtualreaders.append(newreader) - if insertedreaderstats.has_key(newreader): + if newreader in insertedreaderstats: insertedreaderstats[newreader] += 1 else: insertedreaderstats[newreader] = 1 @@ -109,7 +109,7 @@ if virtualreaders: oldreader = random.choice(virtualreaders) virtualreaders.remove(oldreader) - if removedreaderstats.has_key(oldreader): + if oldreader in removedreaderstats: removedreaderstats[oldreader] += 1 else: removedreaderstats[oldreader] = 1 @@ -130,12 +130,12 @@ def update(self, observable, (addedreaders, removedreaders)): self.countnotified += 1 for newreader in addedreaders: - if self.insertedreaderstats.has_key(newreader): + if newreader in self.insertedreaderstats: self.insertedreaderstats[newreader] += 1 else: self.insertedreaderstats[newreader] = 1 for oldreader in removedreaders: - if self.removedreaderstats.has_key(oldreader): + if oldreader in self.removedreaderstats: self.removedreaderstats[oldreader] += 1 else: self.removedreaderstats[oldreader] = 1 Modified: trunk/pyscard/src/smartcard/test/framework/testcase_readers.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_readers.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/framework/testcase_readers.py 2011-10-16 10:34:40 UTC (rev 552) @@ -58,28 +58,28 @@ for reader in readers(): foundreaders[str(reader)] = 1 for reader in expectedReaders: - self.assert_(foundreaders.has_key(reader)) + self.assert_(reader in foundreaders) def testcase_legacyreaders(self): foundreaders = {} for reader in listReaders(): foundreaders[reader] = 1 for reader in expectedReaders: - self.assert_(foundreaders.has_key(reader)) + self.assert_(reader in foundreaders) def testcase_readers_in_readergroup(self): foundreaders = {} for reader in readers(['SCard$DefaultReaders']): foundreaders[str(reader)] = 1 for reader in expectedReaders: - self.assert_(foundreaders.has_key(reader)) + self.assert_(reader in foundreaders) def testcase_readers_in_readergroup_empty(self): foundreaders = {} for reader in readers([]): foundreaders[str(reader)] = 1 for reader in expectedReaders: - self.assert_(foundreaders.has_key(reader)) + self.assert_(reader in foundreaders) if 'winscard' == resourceManager: @@ -88,7 +88,7 @@ for reader in readers(['dummy$group']): foundreaders[reader] = 1 for reader in expectedReaders: - self.assert_(not foundreaders.has_key(reader)) + self.assert_(not reader in foundreaders) self.assertEquals(0, len(foundreaders)) def testcase_readergroups(self): @@ -96,7 +96,7 @@ for readergroup in readergroups(): foundreadergroups[readergroup] = 1 for readergroup in expectedReaderGroups: - self.assert_(foundreadergroups.has_key(readergroup)) + self.assert_(readergroup in foundreadergroups) def suite(): Modified: trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/scard/testcase_getattrib.py 2011-10-16 10:34:40 UTC (rev 552) @@ -69,7 +69,7 @@ self.assertEquals(reader, expectedReaders[r]) self.assertEquals(atr, expectedATRs[r]) - if scard.__dict__.has_key('SCARD_ATTR_ATR_STRING'): + if 'SCARD_ATTR_ATR_STRING' in scard.__dict__: hresult, attrib = SCardGetAttrib(hcard, SCARD_ATTR_ATR_STRING) self.assertEquals(hresult, 0) self.assertEquals(expectedATRs[r], attrib) Modified: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 10:34:40 UTC (rev 552) @@ -128,7 +128,7 @@ for i in xrange(len(cards)): foundCards[cards[i]] = 1 for i in expectedCards: - self.assert_(foundCards.has_key(i)) + self.assert_(i in foundCards) # dummycard has a primary provider, other cards have no primary provider if 'Windows-7-6.1.7600'==platform.platform(): @@ -146,7 +146,7 @@ for i in xrange(len(cards)): hresult, providername = SCardGetCardTypeProviderName( self.hcontext, cards[i], SCARD_PROVIDER_PRIMARY) - if expectedPrimaryProviderResult.has_key(cards[i]): + if cards[i] in expectedPrimaryProviderResult: self.assertEquals(hresult, expectedPrimaryProviderResult[cards[i]][0]) if hresult == 0: self.assertEquals(providername, smartcard.guid.GUIDToStr(expectedPrimaryProviderResult[cards[i]][1])) @@ -167,7 +167,7 @@ for i in xrange(len(cards)): hresult, providername = SCardGetCardTypeProviderName( self.hcontext, cards[i], SCARD_PROVIDER_CSP) - if expectedProviderCSPResult.has_key(cards[i]): + if cards[i] in expectedProviderCSPResult: self.assertEquals(hresult, expectedProviderCSPResult[cards[i]][0]) self.assertEquals(providername, expectedProviderCSPResult[cards[i]][1]) Modified: trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py 2011-10-16 10:15:14 UTC (rev 551) +++ trunk/pyscard/src/smartcard/test/scard/testcase_locatecards.py 2011-10-16 10:34:40 UTC (rev 552) @@ -62,7 +62,7 @@ for reader in readers: foundReaders[reader] = 1 for reader in expectedReaders: - self.assert_(foundReaders.has_key(reader)) + self.assert_(reader in foundReaders) if 'winscard' == resourceManager: hresult, cards = SCardListCards(self.hcontext, [], []) @@ -79,7 +79,7 @@ for reader in expectedReaders: dictexpectedreaders[reader] = 1 for reader, eventstate, atr in newstates: - if dictexpectedreaders.has_key(reader) and [] != expectedATRinReader[reader]: + if reader in dictexpectedreaders and [] != expectedATRinReader[reader]: self.assertEquals(expectedATRinReader[reader], atr) self.assert_(eventstate & SCARD_STATE_PRESENT) self.assert_(eventstate & SCARD_STATE_CHANGED) @@ -101,7 +101,7 @@ for reader in expectedReaders: dictexpectedreaders[reader] = 1 for reader, eventstate, atr in newstates: - if dictexpectedreaders.has_key(reader) and [] != expectedATRinReader[reader]: + if reader in dictexpectedreaders and [] != expectedATRinReader[reader]: self.assertEquals(expectedATRinReader[reader], atr) self.assert_(eventstate & SCARD_STATE_PRESENT) self.assert_(eventstate & SCARD_STATE_CHANGED) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 10:40:49
|
Revision: 553 http://pyscard.svn.sourceforge.net/pyscard/?rev=553&view=rev Author: jdaussel Date: 2011-10-16 10:40:43 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Replaced backticks with repr() Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py trunk/pyscard/src/smartcard/test/configcheck.py Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 10:34:40 UTC (rev 552) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 10:40:43 UTC (rev 553) @@ -102,7 +102,7 @@ elif 'pcsclite' == resourceManager: hresult, readers = SCardListReaders(hcontext, readerGroups) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers in groups ' + `readerGroups` + ' : ' + SCardGetErrorMessage(hresult) + raise error, 'Failed to list readers in groups ' + repr(readerGroups) + ' : ' + SCardGetErrorMessage(hresult) print 'PCSC Readers in reader group', readerGroups, ':', readers Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2011-10-16 10:34:40 UTC (rev 552) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2011-10-16 10:40:43 UTC (rev 553) @@ -59,38 +59,38 @@ """Called when a card is activated by double-clicking on the card or reader tree control or toolbar. In this sample, we just connect to the card on the first activation.""" SimpleSCardAppEventObserver.OnActivateCard(self, card) - self.feedbacktext.SetLabel('Activated card: ' + `card`) + self.feedbacktext.SetLabel('Activated card: ' + repr(card)) self.transmitbutton.Enable() def OnActivateReader(self, reader): """Called when a reader is activated by double-clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnActivateReader(self, reader) - self.feedbacktext.SetLabel('Activated reader: ' + `reader`) + self.feedbacktext.SetLabel('Activated reader: ' + repr(reader)) self.transmitbutton.Disable() def OnDeactivateCard(self, card): """Called when a card is deactivated in the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnActivateCard(self, card) - self.feedbacktext.SetLabel('Deactivated card: ' + `card`) + self.feedbacktext.SetLabel('Deactivated card: ' + repr(card)) self.transmitbutton.Disable() def OnDeselectCard(self, card): """Called when a card is selected by clicking on the card or reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectCard(self, card) - self.feedbacktext.SetLabel('Deselected card: ' + `card`) + self.feedbacktext.SetLabel('Deselected card: ' + repr(card)) self.transmitbutton.Disable() def OnSelectCard(self, card): """Called when a card is selected by clicking on the card or reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectCard(self, card) - self.feedbacktext.SetLabel('Selected card: ' + `card`) + self.feedbacktext.SetLabel('Selected card: ' + repr(card)) if hasattr(self.selectedcard, 'connection'): self.transmitbutton.Enable() def OnSelectReader(self, reader): """Called when a reader is selected by clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectReader(self, reader) - self.feedbacktext.SetLabel('Selected reader: ' + `reader`) + self.feedbacktext.SetLabel('Selected reader: ' + repr(reader)) self.transmitbutton.Disable() # callbacks Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:34:40 UTC (rev 552) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:40:43 UTC (rev 553) @@ -83,27 +83,27 @@ """Called when a card is activated by double-clicking on the card or reader tree control or toolbar. In this sample, we just connect to the card on the first activation.""" SimpleSCardAppEventObserver.OnActivateCard(self, card) - self.feedbacktext.SetLabel('Activated card: ' + `card`) + self.feedbacktext.SetLabel('Activated card: ' + repr(card)) def OnActivateReader(self, reader): """Called when a reader is activated by double-clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnActivateReader(self, reader) - self.feedbacktext.SetLabel('Activated reader: ' + `reader`) + self.feedbacktext.SetLabel('Activated reader: ' + repr(reader)) def OnDeactivateCard(self, card): """Called when a card is deactivated in the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnActivateCard(self, card) - self.feedbacktext.SetLabel('Deactivated card: ' + `card`) + self.feedbacktext.SetLabel('Deactivated card: ' + repr(card)) def OnSelectCard(self, card): """Called when a card is selected by clicking on the card or reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectCard(self, card) - self.feedbacktext.SetLabel('Selected card: ' + `card`) + self.feedbacktext.SetLabel('Selected card: ' + repr(card)) def OnSelectReader(self, reader): """Called when a reader is selected by clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectReader(self, reader) - self.feedbacktext.SetLabel('Selected reader: ' + `reader`) + self.feedbacktext.SetLabel('Selected reader: ' + repr(reader)) def main(argv): Modified: trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py 2011-10-16 10:34:40 UTC (rev 552) +++ trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py 2011-10-16 10:40:43 UTC (rev 553) @@ -70,7 +70,7 @@ readerNode = self.tree.AppendItem(self.tree.GetRootItem(), "Readers") for reader in smartcard.System.readers(): - childReader = self.tree.AppendItem(readerNode, `reader`) + childReader = self.tree.AppendItem(readerNode, repr(reader)) childCard = self.tree.AppendItem(childReader, getATR(reader)) @@ -79,7 +79,7 @@ childReaderGroup = self.tree.AppendItem(readerGroupNode, readergroup) readers = smartcard.System.readers(readergroup) for reader in readers: - child = self.tree.AppendItem(childReaderGroup, `reader`) + child = self.tree.AppendItem(childReaderGroup, repr(reader)) def OnExpandAll(self): """ expand all nodes """ Modified: trunk/pyscard/src/smartcard/test/configcheck.py =================================================================== --- trunk/pyscard/src/smartcard/test/configcheck.py 2011-10-16 10:34:40 UTC (rev 552) +++ trunk/pyscard/src/smartcard/test/configcheck.py 2011-10-16 10:40:43 UTC (rev 553) @@ -60,7 +60,7 @@ expectedATRs.append([]) f.write('expectedATRs = ') #for atr in expectedATRs: print `toHexString(atr)` - f.write(`expectedATRs` + '\n') + f.write(repr(expectedATRs) + '\n') f.write('expectedATRinReader = {}\n') f.write('for i in xrange(len(expectedReaders)):\n') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 10:51:48
|
Revision: 554 http://pyscard.svn.sourceforge.net/pyscard/?rev=554&view=rev Author: jdaussel Date: 2011-10-16 10:51:41 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed blank lines issues for pep8 Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py trunk/pyscard/src/smartcard/pyro/__init__.py trunk/pyscard/src/smartcard/pyro/server/__init__.py trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 10:51:41 UTC (rev 554) @@ -59,7 +59,6 @@ if hresult != SCARD_S_SUCCESS: raise error, 'Failed to introduce card type: ' + SCardGetErrorMessage(hresult) - # list card interfaces hresult, interfaces = SCardListInterfaces(hcontext, znewcardName) if hresult != SCARD_S_SUCCESS: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2011-10-16 10:51:41 UTC (rev 554) @@ -62,7 +62,6 @@ raise error, 'Failure to list cards' print 'Cards:', cards - readerstates = [] for i in xrange(len(readers)): readerstates += [(readers[i], SCARD_STATE_UNAWARE)] Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 10:51:41 UTC (rev 554) @@ -105,7 +105,6 @@ raise error, 'Failed to list readers in groups ' + repr(readerGroups) + ' : ' + SCardGetErrorMessage(hresult) print 'PCSC Readers in reader group', readerGroups, ':', readers - finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/SampleAPDUManagerPanel.py 2011-10-16 10:51:41 UTC (rev 554) @@ -153,7 +153,6 @@ boxsizerEvents = wx.StaticBoxSizer(staticboxEvents, wx.HORIZONTAL) boxsizerEvents.Add(self.feedbacktext, 0, wx.ALIGN_CENTER | wx.ALL, 5) - sizerboxTransmitButton = wx.BoxSizer(wx.HORIZONTAL) sizerboxTransmitButton.Add([20, 20], 0, wx.ALIGN_CENTER | wx.ALL, 5) self.transmitbutton = wx.Button(self, ID_TRANSMIT, "Transmit", wx.DefaultPosition, wx.DefaultSize, 0) Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2011-10-16 10:51:41 UTC (rev 554) @@ -44,12 +44,12 @@ """ This will get us the program's directory, even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" - if we_are_frozen(): - return os.path.dirname( unicode(sys.executable, sys.getfilesystemencoding( )) ) + return os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))) return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( ))) + def main(argv): app = SimpleSCardApp( appname='A tool to send apdu to a card', Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 10:51:41 UTC (rev 554) @@ -40,5 +40,3 @@ "py2exe":{"dll_excludes":["MSVCP90.dll"]} } ) - - Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:51:41 UTC (rev 554) @@ -31,6 +31,7 @@ ID_TEXT = 10000 + def we_are_frozen(): """Returns whether we are frozen via py2exe. This will affect how we find out where we are located. @@ -43,7 +44,6 @@ """ This will get us the program's directory, even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" - if we_are_frozen(): return os.path.dirname( unicode(sys.executable, sys.getfilesystemencoding( )) ) Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 10:51:41 UTC (rev 554) @@ -39,5 +39,3 @@ "py2exe":{"dll_excludes":["MSVCP90.dll"]} } ) - - Modified: trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/pcscdiag/pcscdiag.py 2011-10-16 10:51:41 UTC (rev 554) @@ -73,7 +73,6 @@ childReader = self.tree.AppendItem(readerNode, repr(reader)) childCard = self.tree.AppendItem(childReader, getATR(reader)) - readerGroupNode = self.tree.AppendItem(self.tree.GetRootItem(), "Readers Groups") for readergroup in smartcard.System.readergroups(): childReaderGroup = self.tree.AppendItem(readerGroupNode, readergroup) Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2011-10-16 10:51:41 UTC (rev 554) @@ -40,7 +40,6 @@ """ This will get us the program's directory, even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" - if we_are_frozen(): return os.path.dirname( unicode(sys.executable, sys.getfilesystemencoding( )) ) Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 10:51:41 UTC (rev 554) @@ -40,5 +40,3 @@ "py2exe":{"dll_excludes":["MSVCP90.dll"]} } ) - - Modified: trunk/pyscard/src/smartcard/pyro/__init__.py =================================================================== --- trunk/pyscard/src/smartcard/pyro/__init__.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/pyro/__init__.py 2011-10-16 10:51:41 UTC (rev 554) @@ -1 +1,23 @@ +"""pyro (remote python) utility module. +__author__ = "http://www.gemalto.com" + +Copyright 2011 gemalto +Author: Jean-Daniel Aussel, mailto:jea...@ge... + +This file is part of pyscard. + +pyscard is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +pyscard is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with pyscard; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" Modified: trunk/pyscard/src/smartcard/pyro/server/__init__.py =================================================================== --- trunk/pyscard/src/smartcard/pyro/server/__init__.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/pyro/server/__init__.py 2011-10-16 10:51:41 UTC (rev 554) @@ -1 +1,23 @@ +"""pyro server utility module. +__author__ = "http://www.gemalto.com" + +Copyright 2011 gemalto +Author: Jean-Daniel Aussel, mailto:jea...@ge... + +This file is part of pyscard. + +pyscard is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +pyscard is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with pyscard; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +""" Modified: trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py =================================================================== --- trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/test/framework/testcase_ErrorChecking.py 2011-10-16 10:51:41 UTC (rev 554) @@ -263,7 +263,6 @@ ErrorCheckingChain(errorchain, ISO7816_4ErrorChecker()), ErrorCheckingChain(errorchain, ISO7816_4_SW1ErrorChecker())] - # don't care about Warning Exceptions errorchain[0].addFilterException(smartcard.sw.SWExceptions.WarningProcessingException) Modified: trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py =================================================================== --- trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py 2011-10-16 10:40:43 UTC (rev 553) +++ trunk/pyscard/src/smartcard/wx/SimpleSCardAppFrame.py 2011-10-16 10:51:41 UTC (rev 554) @@ -73,7 +73,6 @@ boxsizer = wx.BoxSizer(wx.HORIZONTAL) - # create user dialog if None != apppanelclass: self.dialogpanel = apppanelclass(self) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 10:57:36
|
Revision: 555 http://pyscard.svn.sourceforge.net/pyscard/?rev=555&view=rev Author: jdaussel Date: 2011-10-16 10:57:30 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed pep8 E201 error: whitespace after ( Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/apdumanager.py 2011-10-16 10:57:30 UTC (rev 555) @@ -45,9 +45,9 @@ even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" if we_are_frozen(): - return os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding( ))) + return os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding())) - return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( ))) + return os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) def main(argv): @@ -55,7 +55,7 @@ appname='A tool to send apdu to a card', apppanel=SampleAPDUManagerPanel, appstyle=TR_SMARTCARD | TR_READER | PANEL_APDUTRACER, - appicon=os.path.join( module_path(), 'images', 'mysmartcard.ico'), + appicon=os.path.join(module_path(), 'images', 'mysmartcard.ico'), size=(800, 600)) app.MainLoop() Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 10:57:30 UTC (rev 555) @@ -33,10 +33,10 @@ Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER ])] -setup( windows=['apdumanager.py'], - data_files = Mydata_files, - options = - { - "py2exe":{"dll_excludes":["MSVCP90.dll"]} - } - ) +setup(windows=['apdumanager.py'], + data_files = Mydata_files, + options = + { + "py2exe":{"dll_excludes":["MSVCP90.dll"]} + } +) Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/cardmonitor.py 2011-10-16 10:57:30 UTC (rev 555) @@ -45,9 +45,9 @@ even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" if we_are_frozen(): - return os.path.dirname( unicode(sys.executable, sys.getfilesystemencoding( )) ) + return os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding())) - return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( ))) + return os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) class SamplePanel(wx.Panel, SimpleSCardAppEventObserver): Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 10:57:30 UTC (rev 555) @@ -32,10 +32,10 @@ Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER ])] -setup( windows=['cardmonitor.py'], - data_files = Mydata_files, - options = - { - "py2exe":{"dll_excludes":["MSVCP90.dll"]} - } - ) +setup(windows=['cardmonitor.py'], + data_files = Mydata_files, + options = + { + "py2exe":{"dll_excludes":["MSVCP90.dll"]} + } +) Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/readerviewer.py 2011-10-16 10:57:30 UTC (rev 555) @@ -41,9 +41,9 @@ even if we are frozen using py2exe. From WhereAmI page on py2exe wiki.""" if we_are_frozen(): - return os.path.dirname( unicode(sys.executable, sys.getfilesystemencoding( )) ) + return os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding())) - return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( ))) + return os.path.dirname(unicode(__file__, sys.getfilesystemencoding())) def main(argv): Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 10:57:30 UTC (rev 555) @@ -33,10 +33,10 @@ Mydata_files = [('images', ['images/readerviewer.ico', ICO_SMARTCARD, ICO_READER ])] -setup( windows=['readerviewer.py'], - data_files = Mydata_files, - options = - { - "py2exe":{"dll_excludes":["MSVCP90.dll"]} - } - ) +setup(windows=['readerviewer.py'], + data_files = Mydata_files, + options = + { + "py2exe":{"dll_excludes":["MSVCP90.dll"]} + } +) Modified: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 10:51:41 UTC (rev 554) +++ trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 10:57:30 UTC (rev 555) @@ -113,7 +113,7 @@ def test_listallcards(self): if 'Windows-7-6.1.7600'==platform.platform(): - expectedCards = [ 'Identity Device (Microsoft Generic Profile)', + expectedCards = [ 'Identity Device (Microsoft Generic Profile)', 'Identity Device (NIST SP 800-73 [PIV])' ] else: # dummycard has been introduced in the test setup and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 11:00:29
|
Revision: 556 http://pyscard.svn.sourceforge.net/pyscard/?rev=556&view=rev Author: jdaussel Date: 2011-10-16 11:00:23 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed pep8 E202 and E201 whitespace after/before [] Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 10:57:30 UTC (rev 555) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 11:00:23 UTC (rev 556) @@ -30,7 +30,7 @@ from smartcard.wx import ICO_SMARTCARD, ICO_READER -Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER ])] +Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER])] setup(windows=['apdumanager.py'], Modified: trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 10:57:30 UTC (rev 555) +++ trunk/pyscard/src/smartcard/Examples/wx/cardmonitor/setup.py 2011-10-16 11:00:23 UTC (rev 556) @@ -30,7 +30,7 @@ from smartcard.wx import ICO_SMARTCARD, ICO_READER -Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER ])] +Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER])] setup(windows=['cardmonitor.py'], data_files = Mydata_files, Modified: trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 10:57:30 UTC (rev 555) +++ trunk/pyscard/src/smartcard/Examples/wx/readerviewer/setup.py 2011-10-16 11:00:23 UTC (rev 556) @@ -30,7 +30,7 @@ from smartcard.wx import ICO_SMARTCARD, ICO_READER -Mydata_files = [('images', ['images/readerviewer.ico', ICO_SMARTCARD, ICO_READER ])] +Mydata_files = [('images', ['images/readerviewer.ico', ICO_SMARTCARD, ICO_READER])] setup(windows=['readerviewer.py'], Modified: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 10:57:30 UTC (rev 555) +++ trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 11:00:23 UTC (rev 556) @@ -113,8 +113,8 @@ def test_listallcards(self): if 'Windows-7-6.1.7600'==platform.platform(): - expectedCards = [ 'Identity Device (Microsoft Generic Profile)', - 'Identity Device (NIST SP 800-73 [PIV])' ] + expectedCards = ['Identity Device (Microsoft Generic Profile)', + 'Identity Device (NIST SP 800-73 [PIV])'] else: # dummycard has been introduced in the test setup and # will be removed in the test teardown. Other cards are This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 12:12:03
|
Revision: 559 http://pyscard.svn.sourceforge.net/pyscard/?rev=559&view=rev Author: jdaussel Date: 2011-10-16 12:11:57 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed pep8 E225 missing whitespace around operator Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py Modified: trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 11:04:27 UTC (rev 558) +++ trunk/pyscard/src/smartcard/Examples/wx/apdumanager/setup.py 2011-10-16 12:11:57 UTC (rev 559) @@ -33,7 +33,7 @@ Mydata_files = [('images', ['images/mysmartcard.ico', ICO_SMARTCARD, ICO_READER])] -setup(windows=['apdumanager.py'], +setup(windows = ['apdumanager.py'], data_files = Mydata_files, options = { Modified: trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py =================================================================== --- trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 11:04:27 UTC (rev 558) +++ trunk/pyscard/src/smartcard/test/scard/testcase_listcards.py 2011-10-16 12:11:57 UTC (rev 559) @@ -79,7 +79,7 @@ # locate a known card # Cryptoflex 8k v2 is present in standard Windows 2000 def test_listcryptoflexbyatr(self): - if 'Windows-7-6.1.7600'==platform.platform(): + if 'Windows-7-6.1.7600' == platform.platform(): dmyATR = [0x3B, 0x75, 0x94, 0x00, 0x00, 0x62, 0x02, 0x02, 0x01, 0x01] dmyName = ['dummycard'] hresult, card = SCardListCards(self.hcontext, dmyATR, []) @@ -112,7 +112,7 @@ # locate all cards and interfaces in the system def test_listallcards(self): - if 'Windows-7-6.1.7600'==platform.platform(): + if 'Windows-7-6.1.7600' == platform.platform(): expectedCards = ['Identity Device (Microsoft Generic Profile)', 'Identity Device (NIST SP 800-73 [PIV])'] else: @@ -131,7 +131,7 @@ self.assert_(i in foundCards) # dummycard has a primary provider, other cards have no primary provider - if 'Windows-7-6.1.7600'==platform.platform(): + if 'Windows-7-6.1.7600' == platform.platform(): expectedPrimaryProviderResult = { 'dummycard': [0, self.dummycardguid1], 'Identity Device (Microsoft Generic Profile)': [2, None], @@ -152,7 +152,7 @@ self.assertEquals(providername, smartcard.guid.GUIDToStr(expectedPrimaryProviderResult[cards[i]][1])) # dummycard has no CSP, other cards have a CSP - if 'Windows-7-6.1.7600'==platform.platform(): + if 'Windows-7-6.1.7600' == platform.platform(): expectedProviderCSPResult = { 'dummycard': [2, None], 'Identity Device (Microsoft Generic Profile)': [0, 'Microsoft Base Smart Card Crypto Provider'], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-16 12:34:05
|
Revision: 560 http://pyscard.svn.sourceforge.net/pyscard/?rev=560&view=rev Author: jdaussel Date: 2011-10-16 12:33:58 +0000 (Sun, 16 Oct 2011) Log Message: ----------- Fixed W602 pep8 warning (deprecated form of raising exception) Modified Paths: -------------- trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py trunk/pyscard/src/smartcard/util/__init__.py Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_control.py 2011-10-16 12:33:58 UTC (rev 560) @@ -31,17 +31,17 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers if len(readers) < 1: - raise error, 'No smart card readers' + raise error('No smart card readers') for zreader in readers: @@ -51,7 +51,7 @@ hresult, hcard, dwActiveProtocol = SCardConnect( hcontext, zreader, SCARD_SHARE_DIRECT, SCARD_PROTOCOL_T0) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to connect: ' + SCardGetErrorMessage(hresult) + raise error('Unable to connect: ' + SCardGetErrorMessage(hresult)) print 'Connected with active protocol', dwActiveProtocol try: @@ -59,7 +59,7 @@ # IOCTL_SMARTCARD_GET_ATTRIBUTE = SCARD_CTL_CODE(2) hresult, response = SCardControl(hcard, SCARD_CTL_CODE(2), toBytes("%.8lx" % SCARD_ATTR_VENDOR_NAME)) if hresult != SCARD_S_SUCCESS: - raise error, 'SCardControl failed: ' + SCardGetErrorMessage(hresult) + raise error('SCardControl failed: ' + SCardGetErrorMessage(hresult)) r = "" for i in xrange(len(response)): r += "%c" % response[i] @@ -68,7 +68,7 @@ # get firmware on Gemplus readers hresult, response = SCardControl(hcard, SCARD_CTL_CODE(1), [0x02]) if hresult != SCARD_S_SUCCESS: - raise error, 'SCardControl failed: ' + SCardGetErrorMessage(hresult) + raise error('SCardControl failed: ' + SCardGetErrorMessage(hresult)) r = "" for i in xrange(len(response)): r += "%c" % response[i] @@ -76,7 +76,7 @@ finally: hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to disconnect: ' + SCardGetErrorMessage(hresult) + raise error('Failed to disconnect: ' + SCardGetErrorMessage(hresult)) print 'Disconnected' except error, (message): @@ -85,7 +85,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getATR.py 2011-10-16 12:33:58 UTC (rev 560) @@ -32,13 +32,13 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) if len(readers) < 1: raise Exception('No smart card readers') print 'PCSC Readers:', readers @@ -72,7 +72,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except Exception, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getAttrib.py 2011-10-16 12:33:58 UTC (rev 560) @@ -93,17 +93,17 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Faile to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers if len(readers) < 1: - raise error, 'No smart card readers' + raise error('No smart card readers') print 'Trying to retreive attributes of', readers[0] for reader in readers: @@ -127,13 +127,13 @@ finally: hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to disconnect: ' + SCardGetErrorMessage(hresult) + raise error('Failed to disconnect: ' + SCardGetErrorMessage(hresult)) print 'Disconnected' finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except Exception, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_getStatusChange.py 2011-10-16 12:33:58 UTC (rev 560) @@ -63,13 +63,13 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers readerstates = [] @@ -91,7 +91,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' import sys Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listCards.py 2011-10-16 12:33:58 UTC (rev 560) @@ -34,18 +34,18 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, card = SCardListCards(hcontext, slbCryptoFlex8kv2ATR, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failure to locate Schlumberger Cryptoflex 8k v2 card: ' + SCardGetErrorMessage(hresult) + raise error('Failure to locate Schlumberger Cryptoflex 8k v2 card: ' + SCardGetErrorMessage(hresult)) print 'Located by ATR:', card hresult, cards = SCardListCards(hcontext, [], []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failure to list cards: ' + SCardGetErrorMessage(hresult) + raise error('Failure to list cards: ' + SCardGetErrorMessage(hresult)) print 'Cards:', cards for i in cards: @@ -61,7 +61,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_listInterfaces.py 2011-10-16 12:33:58 UTC (rev 560) @@ -57,24 +57,24 @@ hresult = SCardIntroduceCardType(hcontext, znewcardName, znewcardPrimGuid, znewcardPrimGuid + znewcardSecGuid, znewcardATR, znewcardMask) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to introduce card type: ' + SCardGetErrorMessage(hresult) + raise error('Failed to introduce card type: ' + SCardGetErrorMessage(hresult)) # list card interfaces hresult, interfaces = SCardListInterfaces(hcontext, znewcardName) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list interfaces: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list interfaces: ' + SCardGetErrorMessage(hresult)) for i in interfaces: print 'Interface for ' + znewcardName + ' :', smartcard.guid.GUIDToStr(i) print 'Forgeting card ' + znewcardName hresult = SCardForgetCardType(hcontext, znewcardName) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to remove card type: ' + SCardGetErrorMessage(hresult) + raise error('Failed to remove card type: ' + SCardGetErrorMessage(hresult)) finally: hresult2 = SCardReleaseContext(hcontext) if hresult2 != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_locateCards.py 2011-10-16 12:33:58 UTC (rev 560) @@ -55,11 +55,11 @@ if hresult == ERROR_ALREADY_EXISTS: print 'Card already exists' else: - raise error, 'Failed to introduce card type: ' + SCardGetErrorMessage(hresult) + raise error('Failed to introduce card type: ' + SCardGetErrorMessage(hresult)) hresult, cards = SCardListCards(hcontext, [], []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failure to list cards' + raise error('Failure to list cards') print 'Cards:', cards readerstates = [] @@ -101,7 +101,7 @@ hresult = SCardForgetCardType(hcontext, znewcardName) hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readerGroups.py 2011-10-16 12:33:58 UTC (rev 560) @@ -33,82 +33,82 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers in all groups:', readers hresult, readerGroups = SCardListReaderGroups(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to list reader groups: ' + SCardGetErrorMessage(hresult) + raise error('Unable to list reader groups: ' + SCardGetErrorMessage(hresult)) print 'PCSC Reader groups:', readerGroups if 'winscard' == resourceManager: hresult = SCardIntroduceReaderGroup(hcontext, newgroup) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to introduce reader group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to introduce reader group: ' + SCardGetErrorMessage(hresult)) dummyreader = readers[0] + ' dummy' hresult = SCardIntroduceReader(hcontext, dummyreader, readers[0]) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to introduce reader: ' + dummyreader + ' : ' + SCardGetErrorMessage(hresult) + raise error('Unable to introduce reader: ' + dummyreader + ' : ' + SCardGetErrorMessage(hresult)) hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers in all groups:', readers hresult = SCardAddReaderToGroup(hcontext, dummyreader, newgroup) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to add reader to group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to add reader to group: ' + SCardGetErrorMessage(hresult)) hresult, readerGroups = SCardListReaderGroups(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to list reader groups: ' + SCardGetErrorMessage(hresult) + raise error('Unable to list reader groups: ' + SCardGetErrorMessage(hresult)) print 'PCSC Reader groups:', readerGroups hresult, readers = SCardListReaders(hcontext, [newgroup]) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers in group ' + newgroup + ' : ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers in group ' + newgroup + ' : ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers in reader group', newgroup, ':', readers hresult = SCardRemoveReaderFromGroup(hcontext, dummyreader, newgroup) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to remove reader from group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to remove reader from group: ' + SCardGetErrorMessage(hresult)) hresult, readerGroups = SCardListReaderGroups(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to list reader groups: ' + SCardGetErrorMessage(hresult) + raise error('Unable to list reader groups: ' + SCardGetErrorMessage(hresult)) print 'PCSC Reader groups:', readerGroups hresult = SCardForgetReaderGroup(hcontext, newgroup) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to forget reader group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to forget reader group: ' + SCardGetErrorMessage(hresult)) hresult = SCardForgetReader(hcontext, dummyreader) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to forget readers ' + SCardGetErrorMessage(hresult) + raise error('Failed to forget readers ' + SCardGetErrorMessage(hresult)) hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers in all groups:', readers elif 'pcsclite' == resourceManager: hresult, readers = SCardListReaders(hcontext, readerGroups) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers in groups ' + repr(readerGroups) + ' : ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers in groups ' + repr(readerGroups) + ' : ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers in reader group', readerGroups, ':', readers finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' import sys Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_readers.py 2011-10-16 12:33:58 UTC (rev 560) @@ -31,24 +31,24 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers hresult, readerGroups = SCardListReaderGroups(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to list reader groups: ' + SCardGetErrorMessage(hresult) + raise error('Unable to list reader groups: ' + SCardGetErrorMessage(hresult)) print 'PCSC Reader groups:', readerGroups finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' import sys Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_selectDFTelecom.py 2011-10-16 12:33:58 UTC (rev 560) @@ -36,17 +36,17 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context : ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context : ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers if len(readers) < 1: - raise error, 'No smart card readers' + raise error('No smart card readers') for zreader in readers: @@ -56,22 +56,22 @@ hresult, hcard, dwActiveProtocol = SCardConnect( hcontext, zreader, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1) if hresult != SCARD_S_SUCCESS: - raise error, 'Unable to connect: ' + SCardGetErrorMessage(hresult) + raise error('Unable to connect: ' + SCardGetErrorMessage(hresult)) print 'Connected with active protocol', dwActiveProtocol try: hresult, response = SCardTransmit(hcard, dwActiveProtocol, SELECT + DF_TELECOM) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to transmit: ' + SCardGetErrorMessage(hresult) + raise error('Failed to transmit: ' + SCardGetErrorMessage(hresult)) print 'Selected DF_TELECOM: ' + smartcard.util.toHexString(response, smartcard.util.HEX) hresult, response = SCardTransmit(hcard, dwActiveProtocol, GET_RESPONSE + [response[1]]) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to transmit: ' + SCardGetErrorMessage(hresult) + raise error('Failed to transmit: ' + SCardGetErrorMessage(hresult)) print 'GET_RESPONSE after SELECT DF_TELECOM: ' + smartcard.util.toHexString(response, smartcard.util.HEX) finally: hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to disconnect: ' + SCardGetErrorMessage(hresult) + raise error('Failed to disconnect: ' + SCardGetErrorMessage(hresult)) print 'Disconnected' except error, (message): @@ -80,7 +80,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error, e: Modified: trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py =================================================================== --- trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/Examples/scard-api/sample_transaction.py 2011-10-16 12:33:58 UTC (rev 560) @@ -31,17 +31,17 @@ try: hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) print 'Context established!' try: hresult, readers = SCardListReaders(hcontext, []) if hresult != SCARD_S_SUCCESS: - raise error, 'Failed to list readers:: ' + SCardGetErrorMessage(hresult) + raise error('Failed to list readers:: ' + SCardGetErrorMessage(hresult)) print 'PCSC Readers:', readers if len(readers) < 1: - raise error, 'No smart card readers' + raise error('No smart card readers') for zreader in readers: print 'Trying to perform transaction on card in', zreader @@ -50,18 +50,18 @@ hresult, hcard, dwActiveProtocol = SCardConnect( hcontext, zreader, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1) if hresult != SCARD_S_SUCCESS: - raise error, 'unable to connect: ' + SCardGetErrorMessage(hresult) + raise error('unable to connect: ' + SCardGetErrorMessage(hresult)) print 'Connected with active protocol', dwActiveProtocol try: hresult = SCardBeginTransaction(hcard) if hresult != SCARD_S_SUCCESS: - raise error, 'failed to begin transaction: ' + SCardGetErrorMessage(hresult) + raise error('failed to begin transaction: ' + SCardGetErrorMessage(hresult)) print 'Beginning transaction' hresult, reader, state, protocol, atr = SCardStatus(hcard) if hresult != SCARD_S_SUCCESS: - raise error, 'failed to get status: ' + SCardGetErrorMessage(hresult) + raise error('failed to get status: ' + SCardGetErrorMessage(hresult)) print 'ATR:', for i in xrange(len(atr)): print "0x%.2X" % atr[i], @@ -70,12 +70,12 @@ finally: hresult = SCardEndTransaction(hcard, SCARD_LEAVE_CARD) if hresult != SCARD_S_SUCCESS: - raise error, 'failed to end transaction: ' + SCardGetErrorMessage(hresult) + raise error('failed to end transaction: ' + SCardGetErrorMessage(hresult)) print 'Transaction ended' hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD) if hresult != SCARD_S_SUCCESS: - raise error, 'failed to disconnect: ' + SCardGetErrorMessage(hresult) + raise error('failed to disconnect: ' + SCardGetErrorMessage(hresult)) print 'Disconnected' except error, (message): print error, message @@ -83,7 +83,7 @@ finally: hresult = SCardReleaseContext(hcontext) if hresult != SCARD_S_SUCCESS: - raise error, 'failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('failed to release context: ' + SCardGetErrorMessage(hresult)) print 'Released context.' except error, e: Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2011-10-16 12:33:58 UTC (rev 560) @@ -65,15 +65,15 @@ hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if 0 != hresult: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) try: hresult = SCardIntroduceReaderGroup(hcontext, newgroup) if 0 != hresult: - raise error, 'Unable to introduce reader group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to introduce reader group: ' + SCardGetErrorMessage(hresult)) finally: hresult = SCardReleaseContext(hcontext) if 0 != hresult: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) def removereadergroup(self, group): """Remove a reader group""" @@ -82,15 +82,15 @@ hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if 0 != hresult: - raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to establish context: ' + SCardGetErrorMessage(hresult)) try: hresult = SCardForgetReaderGroup(hcontext, group) if hresult != 0: - raise error, 'Unable to forget reader group: ' + SCardGetErrorMessage(hresult) + raise error('Unable to forget reader group: ' + SCardGetErrorMessage(hresult)) finally: hresult = SCardReleaseContext(hcontext) if 0 != hresult: - raise error, 'Failed to release context: ' + SCardGetErrorMessage(hresult) + raise error('Failed to release context: ' + SCardGetErrorMessage(hresult)) class PCSCReaderGroups(readergroups): Modified: trunk/pyscard/src/smartcard/util/__init__.py =================================================================== --- trunk/pyscard/src/smartcard/util/__init__.py 2011-10-16 12:11:57 UTC (rev 559) +++ trunk/pyscard/src/smartcard/util/__init__.py 2011-10-16 12:33:58 UTC (rev 560) @@ -94,7 +94,7 @@ try: return reduce(lambda x, y: x + [int(y, 16)], unpack('2s' * (len(packedstring) / 2), packedstring), []) except: - raise TypeError, 'not a string representing a list of bytes' + raise TypeError('not a string representing a list of bytes') """GSM3.38 character conversion table.""" @@ -195,7 +195,7 @@ pass if type(bytes) is not list: - raise TypeError, 'not a list of bytes' + raise TypeError('not a list of bytes') if bytes == None or bytes == []: return "" 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:25:38
|
Revision: 571 http://pyscard.svn.sourceforge.net/pyscard/?rev=571&view=rev Author: ludov Date: 2011-10-19 12:25:28 +0000 (Wed, 19 Oct 2011) Log Message: ----------- Make all classes inherit from the object class instead of nothing 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/ATR.py trunk/pyscard/src/smartcard/AbstractCardRequest.py trunk/pyscard/src/smartcard/Card.py trunk/pyscard/src/smartcard/CardConnectionEvent.py trunk/pyscard/src/smartcard/CardMonitoring.py trunk/pyscard/src/smartcard/CardNames.py trunk/pyscard/src/smartcard/CardRequest.py trunk/pyscard/src/smartcard/CardService.py trunk/pyscard/src/smartcard/CardType.py trunk/pyscard/src/smartcard/Observer.py trunk/pyscard/src/smartcard/Session.py trunk/pyscard/src/smartcard/Synchronization.py trunk/pyscard/src/smartcard/pcsc/PCSCContext.py trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py trunk/pyscard/src/smartcard/reader/Reader.py trunk/pyscard/src/smartcard/reader/ReaderFactory.py trunk/pyscard/src/smartcard/reader/ReaderGroups.py trunk/pyscard/src/smartcard/sw/ErrorChecker.py trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py trunk/pyscard/src/smartcard/sw/SWExceptions.py trunk/pyscard/src/smartcard/wx/SimpleSCardAppEventObserver.py Modified: trunk/pyscard/src/smartcard/ATR.py =================================================================== --- trunk/pyscard/src/smartcard/ATR.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/ATR.py 2011-10-19 12:25:28 UTC (rev 571) @@ -25,7 +25,7 @@ from smartcard.Exceptions import SmartcardException -class ATR: +class ATR(object): """ATR class.""" clockrateconversion = [372, 372, 558, 744, 1116, 1488, 1860, 'RFU', Modified: trunk/pyscard/src/smartcard/AbstractCardRequest.py =================================================================== --- trunk/pyscard/src/smartcard/AbstractCardRequest.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/AbstractCardRequest.py 2011-10-19 12:25:28 UTC (rev 571) @@ -27,7 +27,7 @@ import smartcard.System -class AbstractCardRequest: +class AbstractCardRequest(object): """The base class for xxxCardRequest classes. A CardRequest is used for waitForCard() invocations and specifies what Modified: trunk/pyscard/src/smartcard/Card.py =================================================================== --- trunk/pyscard/src/smartcard/Card.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/Card.py 2011-10-19 12:25:28 UTC (rev 571) @@ -27,7 +27,7 @@ from smartcard.util import toHexString -class Card: +class Card(object): """Card class.""" def __init__(self, reader, atr): Modified: trunk/pyscard/src/smartcard/CardConnectionEvent.py =================================================================== --- trunk/pyscard/src/smartcard/CardConnectionEvent.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardConnectionEvent.py 2011-10-19 12:25:28 UTC (rev 571) @@ -24,7 +24,7 @@ """ -class CardConnectionEvent: +class CardConnectionEvent(object): """Base class for card connection events. This event is notified by CardConnection objects. Modified: trunk/pyscard/src/smartcard/CardMonitoring.py =================================================================== --- trunk/pyscard/src/smartcard/CardMonitoring.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardMonitoring.py 2011-10-19 12:25:28 UTC (rev 571) @@ -63,7 +63,7 @@ pass -class CardMonitor: +class CardMonitor(object): """Class that monitors smart card insertion/removal. and notify observers @@ -130,7 +130,7 @@ return getattr(self.instance, name) -class CardMonitoringThread: +class CardMonitoringThread(object): """Card insertion thread. This thread waits for card insertion. """ Modified: trunk/pyscard/src/smartcard/CardNames.py =================================================================== --- trunk/pyscard/src/smartcard/CardNames.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardNames.py 2011-10-19 12:25:28 UTC (rev 571) @@ -74,7 +74,7 @@ synchronize(__CardNames__, "add delete dump find") -class CardNames: +class CardNames(object): """The CardNames organizes cards by a unique name and an associated smartcard.CardType.CardType.""" Modified: trunk/pyscard/src/smartcard/CardRequest.py =================================================================== --- trunk/pyscard/src/smartcard/CardRequest.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardRequest.py 2011-10-19 12:25:28 UTC (rev 571) @@ -25,7 +25,7 @@ from smartcard.pcsc.PCSCCardRequest import PCSCCardRequest -class CardRequest: +class CardRequest(object): """A CardRequest is used for waitForCard() invocations and specifies what kind of smart card an application is waited for. """ Modified: trunk/pyscard/src/smartcard/CardService.py =================================================================== --- trunk/pyscard/src/smartcard/CardService.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardService.py 2011-10-19 12:25:28 UTC (rev 571) @@ -34,7 +34,7 @@ from smartcard.scard import * -class CardService: +class CardService(object): """Card service abstract class. Known subclasses: smartcard.PassThruCardService """ Modified: trunk/pyscard/src/smartcard/CardType.py =================================================================== --- trunk/pyscard/src/smartcard/CardType.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/CardType.py 2011-10-19 12:25:28 UTC (rev 571) @@ -25,7 +25,7 @@ from smartcard.util import toHexString -class CardType: +class CardType(object): """Abstract base class for CardTypes. Known sub-classes: smartcard.CardType.AnyCardType Modified: trunk/pyscard/src/smartcard/Observer.py =================================================================== --- trunk/pyscard/src/smartcard/Observer.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/Observer.py 2011-10-19 12:25:28 UTC (rev 571) @@ -15,7 +15,7 @@ from smartcard.Synchronization import * -class Observer: +class Observer(object): def update(observable, arg): '''Called when the observed object is Modified: trunk/pyscard/src/smartcard/Session.py =================================================================== --- trunk/pyscard/src/smartcard/Session.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/Session.py 2011-10-19 12:25:28 UTC (rev 571) @@ -29,7 +29,7 @@ from smartcard.System import readers -class Session: +class Session(object): """The Session object enables programmers to transmit APDU to smartcards. This is an example of use of the Session object: Modified: trunk/pyscard/src/smartcard/Synchronization.py =================================================================== --- trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/Synchronization.py 2011-10-19 12:25:28 UTC (rev 571) @@ -36,7 +36,7 @@ klass.__dict__[name] = synchronized(val) -class Synchronization: +class Synchronization(object): # You can create your own self.mutex, or inherit from this class: def __init__(self): Modified: trunk/pyscard/src/smartcard/pcsc/PCSCContext.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/pcsc/PCSCContext.py 2011-10-19 12:25:28 UTC (rev 571) @@ -28,7 +28,7 @@ from smartcard.pcsc.PCSCExceptions import EstablishContextException -class PCSCContext: +class PCSCContext(object): """Manage a singleton pcsc context handle.""" class __PCSCContextSingleton: Modified: trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py =================================================================== --- trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/pyro/server/PyroDaemon.py 2011-10-19 12:25:28 UTC (rev 571) @@ -30,7 +30,7 @@ import Pyro.naming -class PyroDaemon: +class PyroDaemon(object): """Singleton class to wrap the pyro daemon.""" class _PyroDaemon: Modified: trunk/pyscard/src/smartcard/reader/Reader.py =================================================================== --- trunk/pyscard/src/smartcard/reader/Reader.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/reader/Reader.py 2011-10-19 12:25:28 UTC (rev 571) @@ -23,7 +23,7 @@ """ -class Reader: +class Reader(object): """Reader abstract class. The reader class is responsible for creating connections Modified: trunk/pyscard/src/smartcard/reader/ReaderFactory.py =================================================================== --- trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/reader/ReaderFactory.py 2011-10-19 12:25:28 UTC (rev 571) @@ -34,7 +34,7 @@ from smartcard.pcsc.PCSCReader import PCSCReader -class ReaderFactory: +class ReaderFactory(object): """Class to create readers from reader type id.""" factories = {} Modified: trunk/pyscard/src/smartcard/reader/ReaderGroups.py =================================================================== --- trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2011-10-19 12:25:28 UTC (rev 571) @@ -91,7 +91,7 @@ pass -class readergroups: +class readergroups(object): """ReadersGroups organizes smart card reader as groups.""" """The single instance of __readergroups""" Modified: trunk/pyscard/src/smartcard/sw/ErrorChecker.py =================================================================== --- trunk/pyscard/src/smartcard/sw/ErrorChecker.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/sw/ErrorChecker.py 2011-10-19 12:25:28 UTC (rev 571) @@ -23,7 +23,7 @@ """ -class ErrorChecker: +class ErrorChecker(object): """Base class for status word error checking strategies. Error checking strategies are chained into an L{ErrorCheckingChain} to Modified: trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py =================================================================== --- trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/sw/ErrorCheckingChain.py 2011-10-19 12:25:28 UTC (rev 571) @@ -26,7 +26,7 @@ from sys import exc_info -class ErrorCheckingChain: +class ErrorCheckingChain(object): """The error checking chain is a list of response apdu status word (sw1, sw2) error check strategies. Each strategy in the chain is called until an error is detected. A L{smartcard.sw.SWException} Modified: trunk/pyscard/src/smartcard/sw/SWExceptions.py =================================================================== --- trunk/pyscard/src/smartcard/sw/SWExceptions.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/sw/SWExceptions.py 2011-10-19 12:25:28 UTC (rev 571) @@ -25,7 +25,7 @@ """ -class SWException: +class SWException(Exception): """Base class for status word exceptions. Status word exceptions are generated when errors and warnings are detected Modified: trunk/pyscard/src/smartcard/wx/SimpleSCardAppEventObserver.py =================================================================== --- trunk/pyscard/src/smartcard/wx/SimpleSCardAppEventObserver.py 2011-10-19 12:10:58 UTC (rev 570) +++ trunk/pyscard/src/smartcard/wx/SimpleSCardAppEventObserver.py 2011-10-19 12:25:28 UTC (rev 571) @@ -23,7 +23,7 @@ """ -class SimpleSCardAppEventObserver: +class SimpleSCardAppEventObserver(object): """This interface defines the event handlers called by the SimpleSCardApp.""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-22 17:22:59
|
Revision: 580 http://pyscard.svn.sourceforge.net/pyscard/?rev=580&view=rev Author: jdaussel Date: 2011-10-22 17:22:52 +0000 (Sat, 22 Oct 2011) Log Message: ----------- Fixed extended APDU issue where receive buffer should be 65536 plus 2 bytes for status words Modified Paths: -------------- trunk/pyscard/src/smartcard/ChangeLog trunk/pyscard/src/smartcard/scard/scard.i Modified: trunk/pyscard/src/smartcard/ChangeLog =================================================================== --- trunk/pyscard/src/smartcard/ChangeLog 2011-10-22 15:13:53 UTC (rev 579) +++ trunk/pyscard/src/smartcard/ChangeLog 2011-10-22 17:22:52 UTC (rev 580) @@ -1,7 +1,9 @@ 1.6.14 (October 2011) =================== * added support for windows 64bit amd64 (Jean-Daniel Aussel) - * support python "new" classes (derive classes from object) (Ludovic Rousseau from chrysn suggestion) + * support python "new" classes (derive classes from object) (Ludovic Rousseau from chrysn feature request ID 3110077) + * fixed Reader.__eq__() (Ludovic Rousseau from Bernard Paulus bug ID 3418113) + * fixed extended APDU transmit buffer too short by 2 (Jean-Daniel Aussel from bugs ID 2914636 and 3106761) 1.6.12 (August 2010) Modified: trunk/pyscard/src/smartcard/scard/scard.i =================================================================== --- trunk/pyscard/src/smartcard/scard/scard.i 2011-10-22 15:13:53 UTC (rev 579) +++ trunk/pyscard/src/smartcard/scard/scard.i 2011-10-22 17:22:52 UTC (rev 580) @@ -190,7 +190,7 @@ #else // !PCSCLITE // SCARD_CTL_CODE defined in WinSmCrd.h included by Win32 winscard.h // MAX_BUFFER_SIZE_EXTENDED is pcsc-lite specific -#define MAX_BUFFER_SIZE_EXTENDED (1<<16) +#define MAX_BUFFER_SIZE_EXTENDED (1<<16)+2 #endif //PCSCLITE #include "pcsctypes.h" @@ -430,8 +430,8 @@ { SCARDRETCODE lRet; - pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*sizeof(unsigned char)); - pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED; + pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*2*sizeof(unsigned char)); + pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED+2; lRet = (mySCardControl)( hcard, @@ -452,8 +452,8 @@ { SCARDRETCODE lRet; - pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*sizeof(unsigned char)); - pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED; + pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*2*sizeof(unsigned char)); + pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED+2; lRet = (mySCardControl)( hcard, @@ -758,8 +758,8 @@ PSCARD_IO_REQUEST piorequest=NULL; long ret; - pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*sizeof(unsigned char)); - pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED; + pblRecvBuffer->ab = (unsigned char*)mem_Malloc(MAX_BUFFER_SIZE_EXTENDED*2*sizeof(unsigned char)); + pblRecvBuffer->cBytes = MAX_BUFFER_SIZE_EXTENDED+2; // keep in sync with redefinition in PcscDefs.i switch(pioSendPci) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-23 14:25:41
|
Revision: 583 http://pyscard.svn.sourceforge.net/pyscard/?rev=583&view=rev Author: jdaussel Date: 2011-10-23 14:25:35 +0000 (Sun, 23 Oct 2011) Log Message: ----------- Fixed readergroups() that failed to return list of reader groups Modified Paths: -------------- trunk/pyscard/src/smartcard/System.py trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py trunk/pyscard/src/smartcard/reader/ReaderGroups.py Modified: trunk/pyscard/src/smartcard/System.py =================================================================== --- trunk/pyscard/src/smartcard/System.py 2011-10-22 18:21:25 UTC (rev 582) +++ trunk/pyscard/src/smartcard/System.py 2011-10-23 14:25:35 UTC (rev 583) @@ -44,7 +44,7 @@ def readergroups(): """Returns the list of reader groups.""" - return smartcard.pcsc.PCSCReaderGroups.PCSCReaderGroups() + return smartcard.pcsc.PCSCReaderGroups.PCSCReaderGroups().instance # for legacy only Modified: trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py =================================================================== --- trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2011-10-22 18:21:25 UTC (rev 582) +++ trunk/pyscard/src/smartcard/pcsc/PCSCReaderGroups.py 2011-10-23 14:25:35 UTC (rev 583) @@ -40,11 +40,7 @@ self.unremovablegroups = ['SCard$DefaultReaders'] def getreadergroups(self): - """ Returns the list of smartcard reader groups. - - import smartcard - print smartcard.reader_groups() - """ + """ Returns the list of smartcard reader groups.""" innerreadergroups.getreadergroups(self) hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) @@ -61,8 +57,6 @@ def addreadergroup(self, newgroup): """Add a reader group""" - innerreadergroups.addreadergroup(self, newgroup) - hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if 0 != hresult: raise error( @@ -74,6 +68,9 @@ raise error( 'Unable to introduce reader group: ' + \ SCardGetErrorMessage(hresult)) + else: + innerreadergroups.addreadergroup(self, newgroup) + finally: hresult = SCardReleaseContext(hcontext) if 0 != hresult: @@ -84,8 +81,6 @@ def removereadergroup(self, group): """Remove a reader group""" - innerreadergroups.removereadergroup(self, group) - hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER) if 0 != hresult: raise error( @@ -97,6 +92,9 @@ raise error( 'Unable to forget reader group: ' + \ SCardGetErrorMessage(hresult)) + else: + innerreadergroups.removereadergroup(self, group) + finally: hresult = SCardReleaseContext(hcontext) if 0 != hresult: @@ -108,20 +106,10 @@ class PCSCReaderGroups(readergroups): """PCSC readers groups.""" - """The single instance of __readergroups""" - instance = None - - """Constructor: create a single instance of __readergroups on first call""" - def __init__(self, initlist=None): - if None == PCSCReaderGroups.instance: - PCSCReaderGroups.instance = pcscinnerreadergroups(initlist) + """Create a single instance of pcscinnerreadergroups on first call""" + self.innerclazz = pcscinnerreadergroups + readergroups.__init__(self, initlist) - """All operators redirected to inner class.""" - - def __getattr__(self, name): - return getattr(self.instance, name) - - if __name__ == '__main__': print PCSCReaderGroups() Modified: trunk/pyscard/src/smartcard/reader/ReaderGroups.py =================================================================== --- trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2011-10-22 18:21:25 UTC (rev 582) +++ trunk/pyscard/src/smartcard/reader/ReaderGroups.py 2011-10-23 14:25:35 UTC (rev 583) @@ -64,6 +64,12 @@ """Called when a reader group is added.""" self.removereadergroup(item) + def __iter__(self): + return ulist.__iter__(self) + + def next(self): + return ulist.__next__(self) + # # abstract methods implemented in subclasses # @@ -76,11 +82,13 @@ """Add a reader group""" if not isinstance(newgroup, type("")): raise BadReaderGroupException + self += newgroup def removereadergroup(self, group): """Remove a reader group""" if not isinstance(group, type("")): raise BadReaderGroupException + self.remove(group) def addreadertogroup(self, readername, groupname): """Add a reader to a reader group""" @@ -96,12 +104,12 @@ """The single instance of __readergroups""" instance = None + innerclazz = innerreadergroups - """Constructor: create a single instance of __readergroups on first call""" - def __init__(self, initlist=None): + """Create a single instance of innerreadergroups on first call""" if None == readergroups.instance: - readergroups.instance = innerreadergroups(initlist) + readergroups.instance = self.innerclazz(initlist) """All operators redirected to inner class.""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jda...@us...> - 2011-10-29 09:58:44
|
Revision: 585 http://pyscard.svn.sourceforge.net/pyscard/?rev=585&view=rev Author: jdaussel Date: 2011-10-29 09:58:38 +0000 (Sat, 29 Oct 2011) Log Message: ----------- Make Card and Reader objects hashable Modified Paths: -------------- trunk/pyscard/src/smartcard/Card.py trunk/pyscard/src/smartcard/ChangeLog trunk/pyscard/src/smartcard/reader/Reader.py Modified: trunk/pyscard/src/smartcard/Card.py =================================================================== --- trunk/pyscard/src/smartcard/Card.py 2011-10-25 15:48:56 UTC (rev 584) +++ trunk/pyscard/src/smartcard/Card.py 2011-10-29 09:58:38 UTC (rev 585) @@ -56,6 +56,10 @@ False otherwise.""" return not self.__eq__(other) + def __hash__(self): + """Returns a hash value for this object (str(self) is unique).""" + return hash(str(self)) + def createConnection(self): """Return a CardConnection to the Card object.""" readerobj = None Modified: trunk/pyscard/src/smartcard/ChangeLog =================================================================== --- trunk/pyscard/src/smartcard/ChangeLog 2011-10-25 15:48:56 UTC (rev 584) +++ trunk/pyscard/src/smartcard/ChangeLog 2011-10-29 09:58:38 UTC (rev 585) @@ -4,6 +4,7 @@ * support python "new" classes (derive classes from object) (Ludovic Rousseau from chrysn feature request ID 3110077) * fixed Reader.__eq__() (Ludovic Rousseau from Bernard Paulus bug ID 3418113) * fixed extended APDU transmit buffer too short by 2 (Jean-Daniel Aussel from bugs ID 2914636 and 3106761) + + make Card and Reader objects hashable (Jean-Daniel Aussel from Hans-Peter Jansen feature request and patch) 1.6.12 (August 2010) Modified: trunk/pyscard/src/smartcard/reader/Reader.py =================================================================== --- trunk/pyscard/src/smartcard/reader/Reader.py 2011-10-25 15:48:56 UTC (rev 584) +++ trunk/pyscard/src/smartcard/reader/Reader.py 2011-10-29 09:58:38 UTC (rev 585) @@ -55,6 +55,10 @@ else: return False + def __hash__(self): + """Returns a hash value for this object (self.name is unique).""" + return hash(self.name) + def __repr__(self): """Returns card reader name string for `object` calls.""" return "'%s'" % self.name This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lu...@us...> - 2014-08-01 09:02:37
|
Revision: 619 http://sourceforge.net/p/pyscard/code/619 Author: ludov Date: 2014-08-01 09:02:34 +0000 (Fri, 01 Aug 2014) Log Message: ----------- Add missing license for Bruce Eckel code (c) Copyright 2008, Creative Commons Attribution-Share Alike 3.0. Thanks to Nikos Mavrogiannopoulos fro the bug report http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20140728/000081.html Modified Paths: -------------- trunk/pyscard/src/smartcard/Observer.py trunk/pyscard/src/smartcard/Synchronization.py Modified: trunk/pyscard/src/smartcard/Observer.py =================================================================== --- trunk/pyscard/src/smartcard/Observer.py 2014-01-14 18:48:44 UTC (rev 618) +++ trunk/pyscard/src/smartcard/Observer.py 2014-08-01 09:02:34 UTC (rev 619) @@ -1,7 +1,9 @@ """ from Thinking in Python, Bruce Eckel -http://mindview.net/Books/TIPython +http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Observer.html +(c) Copyright 2008, Creative Commons Attribution-Share Alike 3.0. + Class support for "observer" pattern. The observer class is the base class Modified: trunk/pyscard/src/smartcard/Synchronization.py =================================================================== --- trunk/pyscard/src/smartcard/Synchronization.py 2014-01-14 18:48:44 UTC (rev 618) +++ trunk/pyscard/src/smartcard/Synchronization.py 2014-08-01 09:02:34 UTC (rev 619) @@ -1,7 +1,9 @@ """ from Thinking in Python, Bruce Eckel -http://mindview.net/Books/TIPython +http://python-3-patterns-idioms-test.readthedocs.org/en/latest/Observer.html +(c) Copyright 2008, Creative Commons Attribution-Share Alike 3.0. + Simple emulation of Java's 'synchronized' keyword, from Peter Norvig. """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |