laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38174?usp=email )
Change subject: pySim/profile: Change match_with_profile from static to class method ......................................................................
pySim/profile: Change match_with_profile from static to class method
This was suggested by vyanitskiy during gerrit patch review in https://gerrit.osmocom.org/c/pysim/+/38049 in order to make the upcoming eUICC CardProfiles simpler.
Change-Id: Ia7c049b31cb1c5c5bb682406d9dd7a73bcd43185 --- M pySim/cdma_ruim.py M pySim/profile.py M pySim/ts_102_221.py M pySim/ts_51_011.py 4 files changed, 8 insertions(+), 8 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve
diff --git a/pySim/cdma_ruim.py b/pySim/cdma_ruim.py index 96ff1a4..747a0d2 100644 --- a/pySim/cdma_ruim.py +++ b/pySim/cdma_ruim.py @@ -190,8 +190,8 @@ # TODO: Response parameters/data in case of DF_CDMA (section 2.6) return CardProfileSIM.decode_select_response(data_hex)
- @staticmethod - def match_with_card(scc: SimCardCommands) -> bool: + @classmethod + def match_with_card(cls, scc: SimCardCommands) -> bool: return match_ruim(scc)
class AddonRUIM(CardProfileAddon): diff --git a/pySim/profile.py b/pySim/profile.py index 74946ba..ae9e19f 100644 --- a/pySim/profile.py +++ b/pySim/profile.py @@ -137,9 +137,9 @@ """ return data_hex
- @staticmethod + @classmethod @abc.abstractmethod - def match_with_card(scc: SimCardCommands) -> bool: + def match_with_card(cls, scc: SimCardCommands) -> bool: """Check if the specific profile matches the card. This method is a placeholder that is overloaded by specific dirived classes. The method actively probes the card to make sure the profile class matches the diff --git a/pySim/ts_102_221.py b/pySim/ts_102_221.py index aba28cd..c1c1388 100644 --- a/pySim/ts_102_221.py +++ b/pySim/ts_102_221.py @@ -884,8 +884,8 @@ d = t.to_dict() return flatten_dict_lists(d['fcp_template'])
- @staticmethod - def match_with_card(scc: SimCardCommands) -> bool: + @classmethod + def match_with_card(cls, scc: SimCardCommands) -> bool: return match_uicc(scc)
@with_default_category('TS 102 221 Specific Commands') diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index c6720fe..69c8c79 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -1192,8 +1192,8 @@ ret['life_cycle_status_int'] = 'terminated' return ret
- @staticmethod - def match_with_card(scc: SimCardCommands) -> bool: + @classmethod + def match_with_card(cls, scc: SimCardCommands) -> bool: return match_sim(scc)