aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2024-02-04 22:27:32 +0100
committerHarald Welte <laforge@osmocom.org>2024-02-05 09:52:12 +0100
commitf5a8e70f44acafc0d46fe573d5780471e04363d8 (patch)
tree4e66848be477c153f25374e0569be3918b2f1781
parentfd9188d306365e9063bf83a2ff21c06873fe3a31 (diff)
pylint: gsm_r.py
pySim/gsm_r.py:97:0: W0311: Bad indentation. Found 11 spaces, expected 12 (bad-indentation) pySim/gsm_r.py:32:0: C0411: standard import "from struct import pack, unpack" should be placed before "from pySim.utils import *" (wrong-import-order) pySim/gsm_r.py:33:0: C0411: third party import "from construct import Struct, Bytes, Int8ub, Int16ub, Int24ub, Int32ub, FlagsEnum" should be placed before "from pySim.utils import *" (wrong-import-order) pySim/gsm_r.py:34:0: C0411: third party import "from construct import Optional as COptional" should be placed before "from pySim.utils import *" (wrong-import-order) pySim/gsm_r.py:35:0: C0412: Imports from package pySim are not grouped (ungrouped-imports) pySim/gsm_r.py:30:0: W0611: Unused import enum (unused-import) pySim/gsm_r.py:32:0: W0611: Unused pack imported from struct (unused-import) pySim/gsm_r.py:32:0: W0611: Unused unpack imported from struct (unused-import) pySim/gsm_r.py:39:0: W0611: Unused import pySim.ts_51_011 (unused-import) Change-Id: I2a3bba5994d0d4d90fcd3f51bee962fec3a8b0dc
-rw-r--r--pySim/gsm_r.py60
1 files changed, 27 insertions, 33 deletions
diff --git a/pySim/gsm_r.py b/pySim/gsm_r.py
index db7819c..14dbb2d 100644
--- a/pySim/gsm_r.py
+++ b/pySim/gsm_r.py
@@ -1,13 +1,10 @@
-# -*- coding: utf-8 -*-
-
-# without this, pylint will fail when inner classes are used
-# within the 'nested' kwarg of our TlvMeta metaclass on python 3.7 :(
-# pylint: disable=undefined-variable
-
"""
The File (and its derived classes) uses the classes of pySim.filesystem in
order to describe the files specified in UIC Reference P38 T 9001 5.0 "FFFIS for GSM-R SIM Cards"
"""
+# without this, pylint will fail when inner classes are used
+# within the 'nested' kwarg of our TlvMeta metaclass on python 3.7 :(
+# pylint: disable=undefined-variable
#
# Copyright (C) 2021 Harald Welte <laforge@osmocom.org>
@@ -28,16 +25,13 @@ order to describe the files specified in UIC Reference P38 T 9001 5.0 "FFFIS for
from pySim.utils import *
-#from pySim.tlv import *
from struct import pack, unpack
-from construct import *
+from construct import Struct, Bytes, Int8ub, Int16ub, Int24ub, Int32ub, FlagsEnum
from construct import Optional as COptional
-from pySim.construct import *
-import enum
+from pySim.construct import *
from pySim.profile import CardProfileAddon
from pySim.filesystem import *
-import pySim.ts_51_011
######################################################################
# DF.EIRENE (FFFIS for GSM-R SIM Cards)
@@ -77,15 +71,15 @@ class PlConfAdapter(Adapter):
num = int(obj) & 0x7
if num == 0:
return 'None'
- elif num == 1:
+ if num == 1:
return 4
- elif num == 2:
+ if num == 2:
return 3
- elif num == 3:
+ if num == 3:
return 2
- elif num == 4:
+ if num == 4:
return 1
- elif num == 5:
+ if num == 5:
return 0
def _encode(self, obj, context, path):
@@ -94,13 +88,13 @@ class PlConfAdapter(Adapter):
obj = int(obj)
if obj == 4:
return 1
- elif obj == 3:
+ if obj == 3:
return 2
- elif obj == 2:
+ if obj == 2:
return 3
- elif obj == 1:
+ if obj == 1:
return 4
- elif obj == 0:
+ if obj == 0:
return 5
@@ -111,19 +105,19 @@ class PlCallAdapter(Adapter):
num = int(obj) & 0x7
if num == 0:
return 'None'
- elif num == 1:
+ if num == 1:
return 4
- elif num == 2:
+ if num == 2:
return 3
- elif num == 3:
+ if num == 3:
return 2
- elif num == 4:
+ if num == 4:
return 1
- elif num == 5:
+ if num == 5:
return 0
- elif num == 6:
+ if num == 6:
return 'B'
- elif num == 7:
+ if num == 7:
return 'A'
def _encode(self, obj, context, path):
@@ -131,17 +125,17 @@ class PlCallAdapter(Adapter):
return 0
if obj == 4:
return 1
- elif obj == 3:
+ if obj == 3:
return 2
- elif obj == 2:
+ if obj == 2:
return 3
- elif obj == 1:
+ if obj == 1:
return 4
- elif obj == 0:
+ if obj == 0:
return 5
- elif obj == 'B':
+ if obj == 'B':
return 6
- elif obj == 'A':
+ if obj == 'A':
return 7