From d58c632277d64cad63e8e426be69ec1a4347f8ef Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 12 May 2020 16:47:45 +0200 Subject: [PATCH] cards: remove empty erase() methods. Some of the cards do not implement the erase method that each card should have. However, having an empty method in each of those classes does not make too much sense. Lets rather have an erase method in the superclass (Card) that prints a warning to inform the user that erasing the spcified card is not supported. Change-Id: If5add960ec0cab58a01d8f83e6af8cb86ec70a8d --- pySim/cards.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/pySim/cards.py b/pySim/cards.py index 73b07635..c7b34eb4 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -37,6 +37,10 @@ class Card(object): def reset(self): self._scc.reset_card() + def erase(self): + print("warning: erasing is not supported for specified card type!") + return + def verify_adm(self, key): ''' Authenticate with ADM key @@ -529,8 +533,6 @@ class GrcardSim(Card): # FIXME: EF.MSISDN - def erase(self): - return class SysmoSIMgr1(GrcardSim): """ @@ -575,9 +577,6 @@ class SysmoUSIMgr1(Card): ) data, sw = self._scc._tp.send_apdu_checksw("0099000033" + par) - def erase(self): - return - class SysmoSIMgr2(Card): """ @@ -653,8 +652,6 @@ class SysmoSIMgr2(Card): if p.get('smsp'): data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 80)) - def erase(self): - return class SysmoUSIMSJS1(Card): """ @@ -759,9 +756,6 @@ class SysmoUSIMSJS1(Card): r = self._scc.select_file(['3f00', '7f10']) data, sw = self._scc.update_record('6F40', 1, data, force_len=True) - def erase(self): - return - class FairwavesSIM(Card): """ @@ -903,10 +897,6 @@ class FairwavesSIM(Card): if sw != '9000': print("Programming ACC failed with code %s"%sw) - def erase(self): - return - - class OpenCellsSim(Card): """ OpenCellsSim @@ -1046,9 +1036,6 @@ class WavemobileSim(Card): return None - def erase(self): - return - class SysmoISIMSJA2(Card): """ @@ -1169,9 +1156,6 @@ class SysmoISIMSJA2(Card): return - def erase(self): - return - # In order for autodetection ... _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim,