File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1114,12 +1114,16 @@ def parse_cmd_var(cmd_list: List[str]) -> dict:
1114
1114
"""Helper functions that parses a list into a key-value dictionary. The list contains keys separated by the prefix
1115
1115
'--' and the value of the key is the subsequent element.
1116
1116
"""
1117
- it = iter (cmd_list )
1118
- return {
1119
- key : next (it , None ) if not key .startswith ("--" ) else next (it , None )
1120
- for key in it
1121
- if key .startswith ("--" )
1122
- }
1117
+ parsed_cmd = {}
1118
+
1119
+ for i , cmd in enumerate (cmd_list ):
1120
+ if cmd .startswith ("--" ):
1121
+ if i + 1 < len (cmd_list ) and not cmd_list [i + 1 ].startswith ("--" ):
1122
+ parsed_cmd [cmd ] = cmd_list [i + 1 ]
1123
+ i += 1
1124
+ else :
1125
+ parsed_cmd [cmd ] = None
1126
+ return parsed_cmd
1123
1127
1124
1128
1125
1129
def validate_cmd_var (cmd_var : List [str ], overrides : List [str ]) -> List [str ]:
You can’t perform that action at this time.
0 commit comments