File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -229,14 +229,10 @@ def middle(list, type_name):
229
229
# arguments after converting it's case. Offer a suggestion if the hyphens/underscores
230
230
# do not match the expected style of the argument.
231
231
def parse_type (string ):
232
- string = case (string )
233
- newstring = string .replace ("-" ,"_" )
234
- if string in list :
235
- return string
236
- elif string not in list and newstring in list :
237
- raise argparse .ArgumentTypeError ("{0} is not a supported {1}. Did you mean {2}?" .format (string , type_name , newstring ))
238
- else :
239
- raise argparse .ArgumentTypeError ("{0} is not a supported {1}. Supported {1}s are:\n {2}" .format (string , type_name , columnate (list )))
232
+ for option in list :
233
+ if case (string ) == case (option ):
234
+ return option
235
+ raise argparse .ArgumentTypeError ("{0} is not a supported {1}. Supported {1}s are:\n {2}" .format (string , type_name , columnate (list )))
240
236
return parse_type
241
237
return middle
242
238
You can’t perform that action at this time.
0 commit comments