Change in pysim[master]: cards: get rid of "kls" parameter in autodetect methos

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Wed May 5 13:30:25 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/24141 )


Change subject: cards: get rid of "kls" parameter in autodetect methos
......................................................................

cards: get rid of "kls" parameter in autodetect methos

The autodetect methods have a "kls" parameter as first parameter that
somehow replaces the "self" parameter for unknown reason.

Change-Id: I3e5defee394e1301bad8f04853fab8e9ded84335
---
M pySim/cards.py
1 file changed, 22 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/24141/1

diff --git a/pySim/cards.py b/pySim/cards.py
index f06aa02..9bbf385 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -503,9 +503,9 @@
 	_ki_file = None # type: Optional[str]
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
-			for p, l, t in kls._files.values():
+			for p, l, t in self._files.values():
 				if not t:
 					continue
 				if scc.record_size(['3f00', '7f4d', p]) != l:
@@ -637,14 +637,14 @@
 	name = 'fakemagicsim'
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			if scc.record_size(['3f00', '000c']) != 0x5a:
 				return None
 		except:
 			return None
 
-		return kls(scc)
+		return self(scc)
 
 	def _get_infos(self):
 		"""
@@ -704,7 +704,7 @@
 	name = 'grcardsim'
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		return None
 
 	def program(self, p):
@@ -762,11 +762,11 @@
 	name = 'sysmosim-gr1'
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 99 18 00 11 88 22 33 44 55 66 77 60"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -778,7 +778,7 @@
 	name = 'sysmoUSIM-GR1'
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		# TODO: Access the ATR
 		return None
 
@@ -805,11 +805,11 @@
 	name = 'sysmoSIM-GR2'
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -885,11 +885,11 @@
 		self._scc.sel_ctrl = "0004" #request an FCP
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -1012,11 +1012,11 @@
 		self._adm2_chv_num = 0x12
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 44 22 06 10 00 00 01 A9"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -1148,11 +1148,11 @@
 
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 9F 95 80 1F C3 80 31 E0 73 FE 21 13 57 86 81 02 86 98 44 18 A8"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -1198,11 +1198,11 @@
 		self._scc.sel_ctrl = "0004" #request an FCP
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Look for ATR
 			if scc.get_atr() == toBytes("3B 9F 95 80 1F C7 80 31 E0 73 F6 21 13 67 4D 45 16 00 43 01 00 8F"):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None
@@ -1289,22 +1289,22 @@
 		self._scc.sel_ctrl = "0004" #request an FCP
 
 	@classmethod
-	def autodetect(kls, scc):
+	def autodetect(self, scc):
 		try:
 			# Try card model #1
 			atr = "3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 4C 75 30 34 05 4B A9"
 			if scc.get_atr() == toBytes(atr):
-				return kls(scc)
+				return self(scc)
 
 			# Try card model #2
 			atr = "3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 4C 75 31 33 02 51 B2"
 			if scc.get_atr() == toBytes(atr):
-				return kls(scc)
+				return self(scc)
 
 			# Try card model #3
 			atr = "3B 9F 96 80 1F 87 80 31 E0 73 FE 21 1B 67 4A 4C 52 75 31 04 51 D5"
 			if scc.get_atr() == toBytes(atr):
-				return kls(scc)
+				return self(scc)
 		except:
 			return None
 		return None

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24141
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3e5defee394e1301bad8f04853fab8e9ded84335
Gerrit-Change-Number: 24141
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210505/808fea4d/attachment.htm>


More information about the gerrit-log mailing list