laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/35811?usp=email )
Change subject: pylint: cards.py ......................................................................
pylint: cards.py
pySim/cards.py:30:0: W0401: Wildcard import pySim.utils (wildcard-import) pySim/cards.py:41:8: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) pySim/cards.py:55:4: R1711: Useless return at end of function or method (useless-return) pySim/cards.py:78:8: R1725: Consider using Python 3 style super() without arguments (super-with-arguments) pySim/cards.py:91:8: R1725: Consider using Python 3 style super() without arguments (super-with-arguments) pySim/cards.py:159:12: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return) pySim/cards.py:28:0: C0411: standard import "import abc" should be placed before "from pySim.ts_102_221 import EF_DIR" (wrong-import-order) pySim/cards.py:25:0: W0611: Unused Dict imported from typing (unused-import) pySim/cards.py:28:0: W0611: Unused import abc (unused-import)
Change-Id: I708da28caffb417ed2f8413f9611526b18b29cd4 --- M pySim/cards.py 1 file changed, 25 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/11/35811/1
diff --git a/pySim/cards.py b/pySim/cards.py index 4573616..802c921 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -22,10 +22,9 @@ # along with this program. If not, see http://www.gnu.org/licenses/. #
-from typing import Optional, Dict, Tuple +from typing import Optional, Tuple from pySim.ts_102_221 import EF_DIR from pySim.ts_51_011 import DF_GSM -import abc
from pySim.utils import * from pySim.commands import Path, SimCardCommands @@ -40,8 +39,7 @@ rc = self._scc.reset_card() if rc == 1: return self._scc.get_atr() - else: - return None + return None
def set_apdu_parameter(self, cla: Hexstr, sel_ctrl: Hexstr) -> None: """Set apdu parameters (class byte and selection control bytes)""" @@ -54,7 +52,6 @@
def erase(self): print("warning: erasing is not supported for specified card type!") - return
def file_exists(self, fid: Path) -> bool: res_arr = self._scc.try_select_path(fid) @@ -75,7 +72,7 @@ name = 'SIM'
def __init__(self, scc: SimCardCommands): - super(SimCardBase, self).__init__(scc) + super().__init__(scc) self._scc.cla_byte = "A0" self._scc.sel_ctrl = "0000"
@@ -88,7 +85,7 @@ name = 'UICC'
def __init__(self, scc: SimCardCommands): - super(UiccCardBase, self).__init__(scc) + super().__init__(scc) self._scc.cla_byte = "00" self._scc.sel_ctrl = "0004" # request an FCP # See also: ETSI TS 102 221, Table 9.3 @@ -158,9 +155,8 @@ aid_full = self._complete_aid(aid) if aid_full: return scc.select_adf(aid_full) - else: - # If we cannot get the full AID, try with short AID - return scc.select_adf(aid) + # If we cannot get the full AID, try with short AID + return scc.select_adf(aid) return (None, None)
def card_detect(scc: SimCardCommands) -> Optional[CardBase]: