From eb18ed08b075797618fb74d5c748b1d12ead9028 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 4 Feb 2024 22:13:05 +0100 Subject: [PATCH] pylint: ts_31_102_telecom.py pySim/ts_31_102_telecom.py:45:0: C0325: Unnecessary parens after '=' keyword (superfluous-parens) pySim/ts_31_102_telecom.py:33:0: W0401: Wildcard import construct (wildcard-import) pySim/ts_31_102_telecom.py:76:15: C0121: Comparison 'in_json[srv]['activated'] == True' should be 'in_json[srv]['activated'] is True' if checking for the singleton value True, or 'in_json[srv]['activated']' if testing for truthiness (singleton-comparison) pySim/ts_31_102_telecom.py:85:23: W0612: Unused variable 'sw' (unused-variable) pySim/ts_31_102_telecom.py:124:22: W0612: Unused variable 'sw' (unused-variable) pySim/ts_31_102_telecom.py:32:0: C0411: third party import "from construct import Optional as COptional" should be placed before "from pySim.tlv import *" (wrong-import-order) pySim/ts_31_102_telecom.py:33:0: C0411: third party import "from construct import *" should be placed before "from pySim.tlv import *" (wrong-import-order) Change-Id: I4ee0d0e1b5b418b8527b4674141cbaef896a64a2 --- pySim/ts_31_102_telecom.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pySim/ts_31_102_telecom.py b/pySim/ts_31_102_telecom.py index 575ccaed..962b7dde 100644 --- a/pySim/ts_31_102_telecom.py +++ b/pySim/ts_31_102_telecom.py @@ -26,11 +26,12 @@ Needs to be a separate python module to avoid cyclic imports # along with this program. If not, see . # +from construct import Optional as COptional +from construct import Struct, Int16ub, Int32ub + from pySim.tlv import * from pySim.filesystem import * from pySim.construct import * -from construct import Optional as COptional -from construct import * # TS 31.102 Section 4.2.8 class EF_UServiceTable(TransparentEF): @@ -42,7 +43,7 @@ class EF_UServiceTable(TransparentEF): def _bit_byte_offset_for_service(service: int) -> Tuple[int, int]: i = service - 1 byte_offset = i//8 - bit_offset = (i % 8) + bit_offset = i % 8 return (byte_offset, bit_offset) def _decode_bin(self, in_bin): @@ -73,7 +74,7 @@ class EF_UServiceTable(TransparentEF): service_nr = int(srv) (byte_offset, bit_offset) = EF_UServiceTable._bit_byte_offset_for_service( service_nr) - if in_json[srv]['activated'] == True: + if in_json[srv]['activated'] is True: bit = 1 else: bit = 0 @@ -82,7 +83,7 @@ class EF_UServiceTable(TransparentEF): def get_active_services(self, cmd): # obtain list of currently active services - (service_data, sw) = cmd.lchan.read_binary_dec() + (service_data, _sw) = cmd.lchan.read_binary_dec() active_services = [] for s in service_data.keys(): if service_data[s]['activated']: @@ -121,7 +122,7 @@ class EF_UServiceTable(TransparentEF): return num_problems def ust_update(self, cmd, activate=[], deactivate=[]): - service_data, sw = cmd.lchan.read_binary() + service_data, _sw = cmd.lchan.read_binary() service_data = h2b(service_data) for service in activate: