[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2014-08-07 Thread paul j3
paul j3 added the comment: Another issue dealing with abbreviations is close to being committed. http://bugs.python.org/issue14910 argparse: disable abbreviation -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
paul j3 added the comment: I think the correction to the problem that I noted in the previous post is to return 'None, arg_string, None', rather than 'action, arg_string, None' in the case where the action is found in a subparser. This is what '_parse_optional' does at the end: # it

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
paul j3 added the comment: In the last patch, 'parser.scan = True' is needed to activate this fix. I left that switch in for testing convenience. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: Removed file: http://bugs.python.org/file31888/subparser_patch.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-28 Thread paul j3
paul j3 added the comment: This the argparse patch as described in the previous post, along with test_argparse tests. For now the tests handle both subparser required cases and not required ones ( http://bugs.python.org/issue9253 ). While error messages can differ based on this

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-26 Thread paul j3
paul j3 added the comment: Steven's patch (subparse_optionals.diff) run with jakub's test case (argparse_subparses_ambiguous_bug.py) works. But if the input string is print(parser.parse_args('--foo baz'.split())) produces Namespace(cmd=None, foo='baz', foo1=None, foo2=None) (I

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2013-09-16 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___ ___ Python-bugs-list mailing list

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think the real fix needs to search recursively though all subparsers. Here's a first draft of a patch that does this. I believe your sample code works after this patch. I don't have the time to turn your bug report into proper test

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-24 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo stage: - test needed versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-19 Thread Jakub Warmuz
Jakub Warmuz jakub.warmuz+bugs.python@gmail.com added the comment: Attached quickdirty fix I'm currently using in my project. Maybe this will help to create a valid patch. Instead of changing _parse_optional, I've overridden _get_option_tuples to scan subparsers for matching optional

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Jakub Warmuz
New submission from Jakub Warmuz jakub.warmuz+bugs.python@gmail.com: Assuming following: 1. optional argument, say --foo, in a subparser; 2. at least two different optional arguments in the main parser prefixed with --foo, say --foo1 and --foo2; parsing fails with error: ambiguous option:

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___ ___

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Tshepang Lekhonkhobe
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: More or less a duplicate of 12713? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Tshepang Lekhonkhobe
Tshepang Lekhonkhobe tshep...@gmail.com added the comment: Sorry, I meant #12713. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14365 ___ ___

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yep. Closing as duplicate. -- resolution: - duplicate status: open - closed superseder: - argparse: allow abbreviation of sub commands by users ___ Python tracker rep...@bugs.python.org

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Jakub Warmuz
Jakub Warmuz jakub.warmuz+bugs.python@gmail.com added the comment: I don't understand how both bugs are related. Surely, patch provided for #12713 does not fix the issue I described. -- ___ Python tracker rep...@bugs.python.org

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: My mistake. I see that the error you're getting is a bad interaction between the option in the main parser and an ambiguous option in the subparser. -- resolution: duplicate - status: closed - open superseder: argparse: allow

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The problem is basically that _parse_known_args calls _parse_optional to determine whether something is an optional or a positional. But _parse_optional only checks if arg_string in self._option_string_actions, that is, if the string