[issue11588] Add "necessarily inclusive" groups to argparse

2019-11-06 Thread Jack Wong
Change by Jack Wong : -- nosy: +iforapsy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11588] Add "necessarily inclusive" groups to argparse

2019-04-22 Thread Mike Auty
Change by Mike Auty : -- nosy: +ikelos ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11588] Add "necessarily inclusive" groups to argparse

2017-05-26 Thread Pedro
Pedro added the comment: Just voicing my support for this. I was also looking for a solution on StackOverflow and ended up here. -- nosy: +pgacv2 ___ Python tracker

[issue11588] Add "necessarily inclusive" groups to argparse

2017-01-31 Thread paul j3
paul j3 added the comment: Another issue requesting a 'mutually dependent group' http://bugs.python.org/issue23298 -- ___ Python tracker ___

[issue11588] Add "necessarily inclusive" groups to argparse

2016-05-16 Thread paul j3
paul j3 added the comment: So far I've proposed adding a 'hook' at the end of '_parse_known_args', that would give the user access to the 'seen_non_default_actions' variable. This function could perform an almost arbitrarily complex set of logical co-occurrence tests on this set (or list) of

[issue11588] Add "necessarily inclusive" groups to argparse

2015-12-22 Thread Chris Mayo
Changes by Chris Mayo : -- nosy: +cjmayo ___ Python tracker ___ ___ Python-bugs-list

[issue11588] Add necessarily inclusive groups to argparse

2014-09-05 Thread paul j3
paul j3 added the comment: Attached is a patch for 3.5.0 dev that adds UsageGroups. Now different 'kinds' are implemented as subclasses, which are accessed via the registry: _XorUsageGroup - replicate action of MutuallyExclusiveGroups _AndUsageGroup - an inclusive group

[issue11588] Add necessarily inclusive groups to argparse

2014-09-03 Thread paul j3
paul j3 added the comment: http://stackoverflow.com/questions/25626109/python-argparse-conditionally-required-arguments asks about implementing a 'conditionally-required-arguments' case in `argparse`. The post-parsing test is simple enough: if args.argument and (args.a is None or args.b

[issue11588] Add necessarily inclusive groups to argparse

2014-06-12 Thread paul j3
paul j3 added the comment: I have developed a UsageGroup class that can implement nested 'inclusive' tests. Using this, the original example in this issue could be coded as 3 groups, 2 mutually_exclusive and inclusive one. parser = ArgumentParser(prog='PROG',

[issue11588] Add necessarily inclusive groups to argparse

2014-04-08 Thread paul j3
paul j3 added the comment: http://stackoverflow.com/questions/22929087 A question that could be addressed with this patch(es) In a subparser: I have 4 arguments: -g, -wid, -w1, and -w2. -w1 and -w2 always appear together -wid and (-w1 -w2) are mutually exclusive, but one or the

[issue11588] Add necessarily inclusive groups to argparse

2014-03-04 Thread paul j3
paul j3 added the comment: A couple more thoughts on an expanded argument testing mechanism: - do we need both 'seen_actions' and 'seen_non_default_actions'? 'seen_actions' is used only to test whether all required actions have been seen. These 2 sets differ in how positionals with '?*'

[issue11588] Add necessarily inclusive groups to argparse

2014-02-25 Thread paul j3
paul j3 added the comment: The addition of a simple decorator to the 'ArgumentParser' class, would simplify registering the tests: def crosstest(self, func): # decorator to facilitate adding these functions name = func.__name__ self.register('cross_tests', name,

[issue11588] Add necessarily inclusive groups to argparse

2014-02-22 Thread paul j3
paul j3 added the comment: This is an example of using 'patch_w_mxg2.diff' to handle the inclusive group case proposed by the OP. Since 'seen_non_default_actions' (and 'seen_actions') is a set of 'Actions', it is convenient to use 'set' methods with pointers to the actions that a collected

[issue11588] Add necessarily inclusive groups to argparse

2014-02-21 Thread paul j3
paul j3 added the comment: This patch uses: tests = self._registries['cross_tests'].values() to get a list of functions to run at the end of '_parse_known_args'. I replaced all of the mutually_exclusive_group tests (3 places) in the ArgumentParser with a static function defined in class

[issue11588] Add necessarily inclusive groups to argparse

2014-02-14 Thread paul j3
paul j3 added the comment: The suggestion in this issue is to add a 'mutually_inclusive_group' mechanism, one that would let users specify that certain sets of arguments must occur together. Furthermore there was mention of allowing some sort of nesting. Modeling it on the

[issue11588] Add necessarily inclusive groups to argparse

2014-02-14 Thread paul j3
paul j3 added the comment: Regarding a usage line like: (-o FILE | (-O DIR (-p PATTERN | -s SUFFIX)) The simplest option is to just a custom written 'usage' parameter. With the existing HelpFormatter, a nested grouping like this is next to impossible. It formats the arguments (e.g.'-O

[issue11588] Add necessarily inclusive groups to argparse

2011-04-27 Thread Manveru
Manveru manv...@manveru.pl added the comment: I am subscribing to this idea as I've just fall into such use case where I need it. I would like to submit a patch, but I still have difficulties to understand argparse code not much spare time to spent on this. -- nosy: +manveru

[issue11588] Add necessarily inclusive groups to argparse

2011-04-27 Thread Xuanji Li
Changes by Xuanji Li xua...@gmail.com: -- nosy: +xuanji ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11588 ___ ___ Python-bugs-list mailing list

[issue11588] Add necessarily inclusive groups to argparse

2011-03-26 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think this is a great suggestion. Care to work on a patch? -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11588

[issue11588] Add necessarily inclusive groups to argparse

2011-03-17 Thread John Didion
New submission from John Didion johndid...@gmail.com: Just as some options are mutually exclusive, there are others that are necessarily inclusive, i.e. all or nothing. I propose the addition of ArgumentParser.add_necessarily_inclusive_group(required=True). This also means that argparse will

[issue11588] Add necessarily inclusive groups to argparse

2011-03-17 Thread SilentGhost
Changes by SilentGhost ghost@gmail.com: -- nosy: +bethard ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11588 ___ ___ Python-bugs-list mailing

[issue11588] Add necessarily inclusive groups to argparse

2011-03-17 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- versions: +Python 3.3 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11588 ___ ___