From 5ff0bafcdab012ceaaa5f9372d3014d50145db07 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 4 Feb 2024 23:18:35 +0100 Subject: [PATCH] pylint: esim/saip/__init__.py pySim/esim/saip/__init__.py:28:0: R0402: Use 'from pySim.esim.saip import templates' instead (consider-using-from-import) pySim/esim/saip/__init__.py:166:8: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) pySim/esim/saip/__init__.py:206:4: W0612: Unused variable 'tagdict' (unused-variable) pySim/esim/saip/__init__.py:273:23: C1802: Do not use `len(SEQUENCE)` without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len) Change-Id: I12ef46c847d197fb0c01e624818aeac14eb99e31 --- pySim/esim/saip/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index fb064a1c..82ed2b72 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -25,7 +25,7 @@ from pySim.utils import bertlv_parse_tag, bertlv_parse_len from pySim.ts_102_221 import FileDescriptor from pySim.construct import build_construct from pySim.esim import compile_asn1_subdir -import pySim.esim.saip.templates as templates +from pySim.esim.saip import templates asn1 = compile_asn1_subdir('saip') @@ -165,8 +165,7 @@ class ProfileElement: # unneccessarry compliaction by inconsistent naming :( if self.type.startswith('opt-'): return self.type.replace('-','') + '-header' - else: - return self.type + '-header' + return self.type + '-header' @property def header(self): @@ -203,7 +202,7 @@ class ProfileElement: def bertlv_first_segment(binary: bytes) -> Tuple[bytes, bytes]: """obtain the first segment of a binary concatenation of BER-TLV objects. Returns: tuple of first TLV and remainder.""" - tagdict, remainder = bertlv_parse_tag(binary) + _tagdict, remainder = bertlv_parse_tag(binary) length, remainder = bertlv_parse_len(remainder) tl_length = len(binary) - len(remainder) tlv_length = tl_length + length @@ -270,7 +269,7 @@ class ProfileElementSequence: cur_naa_list = [] cur_naa_list.append(pe) # append the final one - if cur_naa and len(cur_naa_list): + if cur_naa and len(cur_naa_list) > 0: if not cur_naa in self.pes_by_naa: self.pes_by_naa[cur_naa] = [] self.pes_by_naa[cur_naa].append(cur_naa_list)