laforge has uploaded this change for review. (
https://gerrit.osmocom.org/c/pysim/+/35819?usp=email )
Change subject: pylint: gsm_r.py
......................................................................
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
---
M pySim/gsm_r.py
1 file changed, 46 insertions(+), 33 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/35819/1
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(a)osmocom.org>
@@ -28,16 +25,13 @@
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 @@
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 @@
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 @@
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 @@
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
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/35819?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I2a3bba5994d0d4d90fcd3f51bee962fec3a8b0dc
Gerrit-Change-Number: 35819
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: newchange