[issue18349] argparse usage should preserve () in metavars such as range(20)

2021-12-10 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11: >>> import argparse >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=int, choices=range(20), >>> metavar='range(0,20)') _StoreAction(option_strings=[], dest='foo', nargs=None, const=None, default=None, type=, choic

[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-16 Thread paul j3
paul j3 added the comment: I just submitted at patch to http://bugs.python.org/issue11874 that takes care of this issue as well. I rewrote _format_actions_usage() so it formats the parts directly, so there is no need cleanup or parse the full text string. -- _

[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-15 Thread paul j3
paul j3 added the comment: This issue should also preserve a metavar like: '(one)two', i.e. '(' at the start. In http://bugs.python.org/issue10984 these _re replacements are applied to individual action strings as well as the whole usage line. So if () are to be removed from '[-h] (-y)', t

[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-08 Thread paul j3
paul j3 added the comment: I just posted a patch to http://bugs.python.org/issue16468 that uses (and tests) this fix. -- ___ Python tracker ___ _

[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-02 Thread paul j3
Changes by paul j3 : -- components: +Library (Lib) type: -> behavior versions: +Python 3.4 ___ Python tracker ___ ___ Python-bugs-lis

[issue18349] argparse usage should preserve () in metavars such as range(20)

2013-07-02 Thread paul j3
New submission from paul j3: As discussed in issue 16468, a metavar may be used to provide an alternative representation of a choices option. However if a metvar like 'range(20)' is used, usage formatter strips off the '()'. >>> parser.add_argument('foo', type=int, choices=range(