dexter has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/38542?usp=email )


Change subject: global_platform: ensure ArgumentParser gets a list for choices
......................................................................

global_platform: ensure ArgumentParser gets a list for choices

When we use the argument parser with choices, we sometimes use a
list that we derive from a dictionary. However if we do that we
still must ensure that we really put a list and not a dict_values
or dict_keys class as parameter because this won't work any longer
with cmd2 version 2.5.0

Related: OS#6601
Change-Id: I165fefd8feb0d96cedc15d036fb32da381f711b3
---
M pySim/global_platform/__init__.py
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/42/38542/1

diff --git a/pySim/global_platform/__init__.py 
b/pySim/global_platform/__init__.py
index e499e0f..53e13e8 100644
--- a/pySim/global_platform/__init__.py
+++ b/pySim/global_platform/__init__.py
@@ -589,7 +589,7 @@
         put_key_parser.add_argument('--old-key-version-nr', type=auto_uint8, 
default=0, help='Old Key Version Number')
         put_key_parser.add_argument('--key-version-nr', type=auto_uint8, 
required=True, help='Key Version Number')
         put_key_parser.add_argument('--key-id', type=auto_uint7, 
required=True, help='Key Identifier (base)')
-        put_key_parser.add_argument('--key-type', 
choices=KeyType.ksymapping.values(), action='append', required=True, help='Key 
Type')
+        put_key_parser.add_argument('--key-type', 
choices=list(KeyType.ksymapping.values()), action='append', required=True, 
help='Key Type')
         put_key_parser.add_argument('--key-data', type=is_hexstr, 
action='append', required=True, help='Key Data Block')
         put_key_parser.add_argument('--key-check', type=is_hexstr, 
action='append', help='Key Check Value')
         put_key_parser.add_argument('--suppress-key-check', 
action='store_true', help='Suppress generation of Key Check Values')
@@ -650,7 +650,7 @@
             return data

         get_status_parser = argparse.ArgumentParser()
-        get_status_parser.add_argument('subset', 
choices=StatusSubset.ksymapping.values(),
+        get_status_parser.add_argument('subset', 
choices=list(StatusSubset.ksymapping.values()),
                                        help='Subset of statuses to be included 
in the response')
         get_status_parser.add_argument('--aid', type=is_hexstr, default='',
                                        help='AID Search Qualifier (search only 
for given AID)')
@@ -685,9 +685,9 @@
             return grd_list

         set_status_parser = argparse.ArgumentParser()
-        set_status_parser.add_argument('scope', 
choices=SetStatusScope.ksymapping.values(),
+        set_status_parser.add_argument('scope', 
choices=list(SetStatusScope.ksymapping.values()),
                                        help='Defines the scope of the 
requested status change')
-        set_status_parser.add_argument('status', 
choices=CLifeCycleState.ksymapping.values(),
+        set_status_parser.add_argument('status', 
choices=list(CLifeCycleState.ksymapping.values()),
                                        help='Specify the new intended status')
         set_status_parser.add_argument('--aid', type=is_hexstr,
                                        help='AID of the target Application or 
Security Domain')
@@ -726,7 +726,7 @@
         inst_inst_parser.add_argument('--install-parameters', type=is_hexstr, 
default='',
                                       help='Install Parameters')
         inst_inst_parser.add_argument('--privilege', action='append', 
dest='privileges', default=[],
-                                      
choices=Privileges._construct.flags.keys(),
+                                      
choices=list(Privileges._construct.flags.keys()),
                                       help='Privilege granted to newly 
installed Application')
         inst_inst_parser.add_argument('--install-token', type=is_hexstr, 
default='',
                                       help='Install Token (Section GPCS 
C.4.2/C.4.7)')

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38542?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I165fefd8feb0d96cedc15d036fb32da381f711b3
Gerrit-Change-Number: 38542
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to