Unverified Commit ba991d5c authored by Chang Su's avatar Chang Su Committed by GitHub
Browse files

[Bugfix] Fix FlexibleArgumentParser replaces _ with - for actual args (#5795)

parent 1744cc99
...@@ -822,7 +822,13 @@ class FlexibleArgumentParser(argparse.ArgumentParser): ...@@ -822,7 +822,13 @@ class FlexibleArgumentParser(argparse.ArgumentParser):
processed_args = [] processed_args = []
for arg in args: for arg in args:
if arg.startswith('--'): if arg.startswith('--'):
processed_args.append('--' + arg[len('--'):].replace('_', '-')) if '=' in arg:
key, value = arg.split('=', 1)
key = '--' + key[len('--'):].replace('_', '-')
processed_args.append(f'{key}={value}')
else:
processed_args.append('--' +
arg[len('--'):].replace('_', '-'))
else: else:
processed_args.append(arg) processed_args.append(arg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment