[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2021-12-12 Thread Irit Katriel
Irit Katriel added the comment: While I was unable to reproduce this rendering error, there are other issues due to nesting of argument groups, and I wonder if we should deprecate those operations, along the lines of Paul's patch on this issue (but with deprecation rather than raising an

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2021-12-10 Thread Irit Katriel
Irit Katriel added the comment: I am unable to reproduce this on 3.11: % ./python.exe tt.py -h usage: tt.py [-h] [[-hello]] options: -h, --help show this help message and exit -hello A flag -- nosy: +iritkatriel status: open -> pending

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2017-01-31 Thread paul j3
paul j3 added the comment: A similar issue about nesting an Argument Group inside a Mutually Exclusive Group. http://bugs.python.org/issue24736 -- ___ Python tracker

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-26 Thread paul j3
paul j3 added the comment: This patch adds a class TestMutuallyExclusiveGroupErrors test_invalid_add_group() test, closely modeled on test_invalid_add_argument() I'm using ValueError in group add methods (maintaining the similarity with add_argument errors). I haven't

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: On further thought, I think group2 = group1.add_mutually_exclusive_group() should have raised an error, stating that a group (argument or mutually exclusive) cannot be added to a mutually exclusive group. Also an argument group should not be added to another

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread Sam Kerr
Sam Kerr added the comment: What I was going for was the ability to have a group contain a mutually exclusive group and a non-exclusive group, but using the mutually exclusive group meant you could not use the non-exclusive group. Such as: [ [ -opt1 | -opt2 | -opt3 ] [ [-opt4] [-opt5]

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread Sam Kerr
Sam Kerr added the comment: I fat fingered the example, sorry: [ [ -opt1 | -opt2 | -opt3 ] | [ [-opt4] [-opt5] [-opt6] ] ] Note the new pipe between the 2 subgroups -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22047

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: Here's a preliminary patch that raises an error if there's an attempt to nest a mutually exclusive group in another, or there's an attempt to add an argument group to either kind of group. It still needs test_argparse.py and argparse.rst changes I'm raising a

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-25 Thread paul j3
paul j3 added the comment: ArgumentGroups and MutuallyExclusiveGroups, as currently defined, won't give you that kind of usage. I have appended a script that uses UsageGroups, which I am developing for http://bugs.python.org/issue11588, to solve this. It defines 2 'mxg' groups (groups with

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-24 Thread paul j3
paul j3 added the comment: That's an artifact of how the group usage is formatted (which isn't very robust). It's not designed to handle nested groups. Mutually exclusive groups aren't meant to nest inside other mutually exclusive groups. While it possible, it doesn't help you.

[issue22047] argparse improperly prints mutually exclusive options when they are in a group

2014-07-23 Thread Sam Kerr
New submission from Sam Kerr: The following code: import argparse parser = argparse.ArgumentParser() group1 = parser.add_mutually_exclusive_group() group2 = group1.add_mutually_exclusive_group() group2.add_argument('-hello',action='store_true', help=A flag) args =