Change in pysim[master]: pySim-prog: rename variable card_handler

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
Fri Sep 17 11:39:54 UTC 2021


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


Change subject: pySim-prog: rename variable card_handler
......................................................................

pySim-prog: rename variable card_handler

The variable card_handler is assigned in the following way:

card_handler = card_handler(sl)

This may cause problems since the class name and the variable name are
the same. Lets rename card_handler to avoid problems here.

Change-Id: I84dafc49862e373ae9f6a56bd2e8d1a02c27430a
---
M pySim-prog.py
1 file changed, 9 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/01/25501/1

diff --git a/pySim-prog.py b/pySim-prog.py
index 4c85be7..922ca86 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -649,11 +649,11 @@
 	fh.close()
 
 
-def process_card(opts, first, card_handler):
+def process_card(opts, first, ch):
 
 	if opts.dry_run is False:
 		# Connect transport
-		card_handler.get(first)
+		ch.get(first)
 
 	if opts.dry_run is False:
 		# Get card
@@ -681,13 +681,13 @@
 		if opts.read_iccid:
 			if opts.dry_run:
 				# Connect transport
-				card_handler.get(False)
+				ch.get(False)
 			(res,_) = scc.read_binary(['3f00', '2fe2'], length=10)
 			iccid = dec_iccid(res)
 		elif opts.read_imsi:
 			if opts.dry_run:
 				# Connect transport
-				card_handler.get(False)
+				ch.get(False)
 			(res,_) = scc.read_binary(EF['IMSI'])
 			imsi = swap_nibbles(res)[3:]
 		else:
@@ -713,7 +713,7 @@
 		opts.num += 1
 	save_batch(opts)
 
-	card_handler.done()
+	ch.done()
 	return 0
 
 
@@ -741,9 +741,9 @@
 	init_batch(opts)
 
 	if opts.card_handler:
-		card_handler = card_handler_auto(sl, opts.card_handler)
+		ch = card_handler_auto(sl, opts.card_handler)
 	else:
-		card_handler = card_handler(sl)
+		ch = card_handler(sl)
 
 	# Iterate
 	first = True
@@ -751,7 +751,7 @@
 
 	while 1:
 		try:
-			rc = process_card(opts, first, card_handler)
+			rc = process_card(opts, first, ch)
 		except (KeyboardInterrupt):
 			print("")
 			print("Terminated by user!")
@@ -770,7 +770,7 @@
 		# Something did not work as well as expected, however, lets
 		# make sure the card is pulled from the reader.
 		if rc != 0:
-			card_handler.error()
+			ch.error()
 
 		# If we are not in batch mode we are done in any case, so lets
 		# exit here.

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I84dafc49862e373ae9f6a56bd2e8d1a02c27430a
Gerrit-Change-Number: 25501
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/20210917/4a63df55/attachment.htm>


More information about the gerrit-log mailing list