From 528d9225100724a928b71d2974775adc8754fd89 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 4 Feb 2024 22:44:59 +0100 Subject: [PATCH] pylint: apdu_source/gsmtap.py pySim/apdu_source/gsmtap.py:48:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return) pySim/apdu_source/gsmtap.py:44:20: W0612: Unused variable 'addr' (unused-variable) pySim/apdu_source/gsmtap.py:22:0: C0411: first party import "from pySim.apdu.ts_102_221 import ApduCommands as UiccApduCommands" should be placed before "from . import ApduSource, PacketType, CardReset" (wrong-import-order) pySim/apdu_source/gsmtap.py:23:0: C0411: first party import "from pySim.apdu.ts_31_102 import ApduCommands as UsimApduCommands" should be placed before "from . import ApduSource, PacketType, CardReset" (wrong-import-order) pySim/apdu_source/gsmtap.py:24:0: C0411: first party import "from pySim.apdu.global_platform import ApduCommands as GpApduCommands" should be placed before "from . import ApduSource, PacketType, CardReset" (wrong-import-order) pySim/apdu_source/gsmtap.py:19:0: W0611: Unused GsmtapMessage imported from pySim.gsmtap (unused-import) Change-Id: I672e8838ebe11015863fd4fd6047181a3f184658 --- pySim/apdu_source/gsmtap.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pySim/apdu_source/gsmtap.py b/pySim/apdu_source/gsmtap.py index aaf97adc..bcfb66df 100644 --- a/pySim/apdu_source/gsmtap.py +++ b/pySim/apdu_source/gsmtap.py @@ -16,12 +16,14 @@ # along with this program. If not, see . -from pySim.gsmtap import GsmtapMessage, GsmtapSource -from . import ApduSource, PacketType, CardReset +from pySim.gsmtap import GsmtapSource from pySim.apdu.ts_102_221 import ApduCommands as UiccApduCommands from pySim.apdu.ts_31_102 import ApduCommands as UsimApduCommands from pySim.apdu.global_platform import ApduCommands as GpApduCommands + +from . import ApduSource, PacketType, CardReset + ApduCommands = UiccApduCommands + UsimApduCommands + GpApduCommands class GsmtapApduSource(ApduSource): @@ -41,16 +43,16 @@ class GsmtapApduSource(ApduSource): self.gsmtap = GsmtapSource(bind_ip, bind_port) def read_packet(self) -> PacketType: - gsmtap_msg, addr = self.gsmtap.read_packet() + gsmtap_msg, _addr = self.gsmtap.read_packet() if gsmtap_msg['type'] != 'sim': raise ValueError('Unsupported GSMTAP type %s' % gsmtap_msg['type']) sub_type = gsmtap_msg['sub_type'] if sub_type == 'apdu': return ApduCommands.parse_cmd_bytes(gsmtap_msg['body']) - elif sub_type == 'atr': + if sub_type == 'atr': # card has been reset return CardReset(gsmtap_msg['body']) - elif sub_type in ['pps_req', 'pps_rsp']: + if sub_type in ['pps_req', 'pps_rsp']: # simply ignore for now pass else: