laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35826?usp=email )
Change subject: pylint: apdu_source/gsmtap.py ......................................................................
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 --- M pySim/apdu_source/gsmtap.py 1 file changed, 23 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/26/35826/1
diff --git a/pySim/apdu_source/gsmtap.py b/pySim/apdu_source/gsmtap.py index aaf97ad..bcfb66d 100644 --- a/pySim/apdu_source/gsmtap.py +++ b/pySim/apdu_source/gsmtap.py @@ -16,12 +16,14 @@ # along with this program. If not, see http://www.gnu.org/licenses/.
-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 @@ 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: