aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2024-02-04 23:18:35 +0100
committerHarald Welte <laforge@osmocom.org>2024-02-18 22:30:08 +0100
commit5ff0bafcdab012ceaaa5f9372d3014d50145db07 (patch)
treea58b79ca1f687653623c13d287eba0ecc77f1696
parentd16a20ccc3e67ffab1142d4f0541989ccc36a7ec (diff)
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
-rw-r--r--pySim/esim/saip/__init__.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index fb064a1..82ed2b7 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)