profile: decode_select_response use object instead 'Any'

the return type of decode_select_response is 'Any', lets be more
specific and use 'object'

Change-Id: Ic5c7ace234bc94ab1381d87e091369ade8011cab
This commit is contained in:
Philipp Maier
2021-11-16 15:46:42 +01:00
parent 5998a3a8b3
commit 9e42e7ffce
4 changed files with 5 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ import cmd2
from cmd2 import CommandSet, with_default_category, with_argparser from cmd2 import CommandSet, with_default_category, with_argparser
import argparse import argparse
from typing import cast, Optional, Iterable, List, Any, Dict, Tuple from typing import cast, Optional, Iterable, List, Dict, Tuple
from smartcard.util import toBytes from smartcard.util import toBytes
@@ -354,7 +354,7 @@ class CardMF(CardDF):
sels.update({x.name: x for x in self.applications.values() if x.name}) sels.update({x.name: x for x in self.applications.values() if x.name})
return sels return sels
def decode_select_response(self, data_hex:str) -> Any: def decode_select_response(self, data_hex:str) -> object:
"""Decode the response to a SELECT command. """Decode the response to a SELECT command.
This is the fall-back method which automatically defers to the standard decoding This is the fall-back method which automatically defers to the standard decoding

View File

@@ -24,7 +24,6 @@
from pySim.commands import SimCardCommands from pySim.commands import SimCardCommands
from pySim.filesystem import CardApplication, interpret_sw from pySim.filesystem import CardApplication, interpret_sw
from pySim.utils import all_subclasses from pySim.utils import all_subclasses
from typing import Any
import abc import abc
import operator import operator
@@ -107,7 +106,7 @@ class CardProfile(object):
return interpret_sw(self.sw, sw) return interpret_sw(self.sw, sw)
@staticmethod @staticmethod
def decode_select_response(data_hex:str) -> Any: def decode_select_response(data_hex:str) -> object:
"""Decode the response to a SELECT command. """Decode the response to a SELECT command.
This is the fall-back method which doesn't perform any decoding. It mostly This is the fall-back method which doesn't perform any decoding. It mostly

View File

@@ -673,7 +673,7 @@ class CardProfileUICC(CardProfile):
super().__init__(name, desc='ETSI TS 102 221', cla="00", sel_ctrl="0004", files_in_mf=files, sw=sw) super().__init__(name, desc='ETSI TS 102 221', cla="00", sel_ctrl="0004", files_in_mf=files, sw=sw)
@staticmethod @staticmethod
def decode_select_response(resp_hex:str) -> Any: def decode_select_response(resp_hex:str) -> object:
"""ETSI TS 102 221 Section 11.1.1.3""" """ETSI TS 102 221 Section 11.1.1.3"""
fixup_fcp_proprietary_tlv_map(FCP_Proprietary_TLV_MAP) fixup_fcp_proprietary_tlv_map(FCP_Proprietary_TLV_MAP)
resp_hex = resp_hex.upper() resp_hex = resp_hex.upper()

View File

@@ -979,7 +979,7 @@ class CardProfileSIM(CardProfile):
super().__init__('SIM', desc='GSM SIM Card', cla="a0", sel_ctrl="0000", files_in_mf=[DF_TELECOM(), DF_GSM()], sw=sw) super().__init__('SIM', desc='GSM SIM Card', cla="a0", sel_ctrl="0000", files_in_mf=[DF_TELECOM(), DF_GSM()], sw=sw)
@staticmethod @staticmethod
def decode_select_response(resp_hex:str) -> Any: def decode_select_response(resp_hex:str) -> object:
resp_bin = h2b(resp_hex) resp_bin = h2b(resp_hex)
struct_of_file_map = { struct_of_file_map = {
0: 'transparent', 0: 'transparent',