From dd014ea3064e5a349e8b938a7ef272460c53036a Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Mon, 19 Oct 2020 10:35:11 +0200 Subject: Lint fixes: false -> False, missing imports, Index list, not map iter Change-Id: Iff4123a49c8dbcfc405612c0663d5c7d0f549748 --- pySim-prog.py | 4 ++-- pySim/transport/pcsc.py | 4 ++-- pySim/utils.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pySim-prog.py b/pySim-prog.py index f2d3676..942cfb0 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -647,13 +647,13 @@ def process_card(opts, first, card_handler): if opts.read_iccid: if opts.dry_run: # Connect transport - card_handler.get(false) + card_handler.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) + card_handler.get(False) (res,_) = scc.read_binary(EF['IMSI']) imsi = swap_nibbles(res)[3:] else: diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py index 4775a1b..7b50869 100644 --- a/pySim/transport/pcsc.py +++ b/pySim/transport/pcsc.py @@ -24,10 +24,10 @@ from smartcard.CardConnection import CardConnection from smartcard.CardRequest import CardRequest -from smartcard.Exceptions import NoCardException, CardRequestTimeoutException +from smartcard.Exceptions import NoCardException, CardRequestTimeoutException, CardConnectionException from smartcard.System import readers -from pySim.exceptions import NoCardError +from pySim.exceptions import NoCardError, ProtocolError from pySim.transport import LinkBase from pySim.utils import h2i, i2h diff --git a/pySim/utils.py b/pySim/utils.py index c5cf480..f7d099b 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -249,7 +249,7 @@ def calculate_luhn(cc): """ Calculate Luhn checksum used in e.g. ICCID and IMEI """ - num = map(int, str(cc)) + num = list(map(int, str(cc))) check_digit = 10 - sum(num[-2::-2] + [sum(divmod(d * 2, 10)) for d in num[::-2]]) % 10 return 0 if check_digit == 10 else check_digit -- cgit v1.2.3